-
Notifications
You must be signed in to change notification settings - Fork 0
/
kernel_test.go
76 lines (66 loc) · 1.52 KB
/
kernel_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
70
71
72
73
74
75
76
// Path: kernel
// FileName: check_test.go
// Created by dkedTeam
// Author: GJing
// Date: 2024/3/25$ 10:44$
package idcard
import (
"fmt"
"testing"
)
func TestGetCheckCode(t *testing.T) {
code := getCheckCode("110101200007280708")
fmt.Println(code)
code = getCheckCode("110101200007281604")
fmt.Println(code)
code = getCheckCode("110101200007286405")
fmt.Println(code)
code = getCheckCode("11010120000728010X")
fmt.Println(code)
code = getCheckCode("110101200007281604")
fmt.Println(code)
}
func TestRandAreaCode(t *testing.T) {
fmt.Println(randAreaCode())
area, err := getAreaName(randAreaCode())
fmt.Println("area", area, "err=", err)
}
func TestParseData(t *testing.T) {
res, err := ParseNumber("230000198209171361")
fmt.Println("err=", err)
fmt.Println(res)
}
func TestRandBirthday(t *testing.T) {
birth := randBirthday()
fmt.Println(birth)
}
func TestRandOrderCode(t *testing.T) {
for range 80 {
code := randOrderCode()
fmt.Println(code)
}
}
func TestRandNumber(t *testing.T) {
id := RandIdCard()
fmt.Println(id)
res, _ := ParseNumber(id)
fmt.Println(res)
}
func TestRandAreaName(t *testing.T) {
fmt.Println(randAreaName())
}
func TestGenerateIdCard(t *testing.T) {
for range 3 {
id, err := GenerateIdCard(randAreaName(), randBirthday(), "女")
fmt.Println("id=", id, "err=", err)
res, err1 := ParseNumber(id)
if err1 != nil {
fmt.Println("id解析失败", err1)
return
}
fmt.Println("res=", res)
}
}
func TestCheckIdCard(t *testing.T) {
fmt.Println(CheckIdCard("23000019820917136"))
}