@@ -23,23 +23,36 @@ func main() {
23
23
h := hashids.NewWithData (hd)
24
24
e , _ := h.Encode ([]int {45 , 434 , 1313 , 99 })
25
25
fmt.Println (e)
26
- d := h.Decode (e)
26
+ d , _ := h.DecodeWithError (e)
27
27
fmt.Println (d)
28
28
}
29
29
```
30
30
31
31
### Test results
32
32
33
33
```
34
- === RUN TestEncryptDecrypt
35
- --- PASS: TestEncryptDecrypt (0.00 seconds)
36
- hashids_test.go:21: [45 434 1313 99] -> woQ2vqjnG7nnhzEsDkiYadKa3O71br -> [45 434 1313 99]
37
- === RUN TestDefaultLength
38
- --- PASS: TestDefaultLength (0.00 seconds)
39
- hashids_test.go:47: [45 434 1313 99] -> 7nnhzEsDkiYa -> [45 434 1313 99]
40
- === RUN TestCustomAlphabet
41
- --- PASS: TestCustomAlphabet (0.00 seconds)
42
- hashids_test.go:74: [45 434 1313 99] -> MAkhkloFAxAoskax -> [45 434 1313 99]
34
+ === RUN TestEncryptDecrypt
35
+ --- PASS: TestEncryptDecrypt (0.00s)
36
+ hashids_test.go:22: [45 434 1313 99] -> woQ2vqjnG7nnhzEsDkiYadKa3O71br -> [45 434 1313 99]
37
+ === RUN TestEncryptDecryptInt64
38
+ --- PASS: TestEncryptDecryptInt64 (0.00s)
39
+ hashids_test.go:49: [45 434 1313 99 9223372036854775807] -> ZvGlaahBptQNfPOuPjJ51zO3wVzP01 -> [45 434 1313 99 9223372036854775807]
40
+ === RUN TestEncryptWithKnownHash
41
+ --- PASS: TestEncryptWithKnownHash (0.00s)
42
+ hashids_test.go:75: [45 434 1313 99] -> 7nnhzEsDkiYa
43
+ === RUN TestDecryptWithKnownHash
44
+ --- PASS: TestDecryptWithKnownHash (0.00s)
45
+ hashids_test.go:92: 7nnhzEsDkiYa -> [45 434 1313 99]
46
+ === RUN TestDefaultLength
47
+ --- PASS: TestDefaultLength (0.00s)
48
+ hashids_test.go:115: [45 434 1313 99] -> 7nnhzEsDkiYa -> [45 434 1313 99]
49
+ === RUN TestMinLength
50
+ --- PASS: TestMinLength (0.00s)
51
+ === RUN TestCustomAlphabet
52
+ --- PASS: TestCustomAlphabet (0.00s)
53
+ hashids_test.go:150: [45 434 1313 99] -> MAkhkloFAxAoskax -> [45 434 1313 99]
54
+ === RUN TestDecryptWithError
55
+ --- PASS: TestDecryptWithError (0.00s)
43
56
PASS
44
57
```
45
58
0 commit comments