forked from txthinking/x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
is_test.go
69 lines (64 loc) · 1.25 KB
/
is_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package ant
import(
"testing"
)
func TestIsEmail(t *testing.T){
es := []string{
"error@mail",
"correct@mail.com",
"_hi@mail.com",
"aa_hi@qq.com",
"a$_hi@qq.com",
"!@@@1.com",
"!~@@1.cm",
"a@1.cm",
}
for _, v := range es{
ok, err := IsEmail(v)
if err != nil{
t.Fatal(v, err)
}
t.Log(v, ok)
}
}
func TestIsBankCard(t *testing.T){
a := []int64{
4512893900582108,
6228480010323650910,
6228480010323650919, // error
}
for _, v := range a{
ok, err := IsBankCard(v)
if err != nil{
t.Fatal(v, err)
}
t.Log(v, ok)
}
}
func TestIsChineseID(t *testing.T){
a := []string{
"61052819890402574X",
"411081198804220861",
"411081198804220851",
}
for _, v := range a{
ok, err := IsChineseID(v)
if err != nil{
t.Fatal(v, err)
}
t.Log(v, ok)
}
}
func TestIsChineseWords(t *testing.T){
a := []string{
"猪八戒",
"xia往往",
}
for _, v := range a{
ok, err := IsChineseWords(v)
if err != nil{
t.Fatal(v, err)
}
t.Log(v, ok)
}
}