-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsid_test.go
54 lines (41 loc) · 808 Bytes
/
sid_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package sid
import (
"log"
"testing"
)
func TestIdBase64(t *testing.T) {
id := IdBase64()
if len(id) != 23 {
log.Fatal("id length should be 23")
}
if id[11] != '-' {
log.Fatal("id should have a dash [-] in the middle")
}
}
func TestIdBase32(t *testing.T) {
id := IdBase32()
if len(id) != 27 {
log.Fatal("id length should be 27")
}
if id[13] != '-' {
log.Fatal("id should have a dash [-] in the middle")
}
}
func TestIdHex(t *testing.T) {
id := IdHex()
if len(id) != 33 {
log.Fatal("id length should be 33")
}
if id[16] != '-' {
log.Fatal("id should have a dash [-] in the middle")
}
}
func TestId(t *testing.T) {
id := Id()
if len(id) != 39 {
log.Fatal("id length should be 39")
}
if id[19] != '-' {
log.Fatal("id should have a dash [-] in the middle")
}
}