You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
989 B
42 lines
989 B
package regx
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestRegx_IsIdCardFormat(t *testing.T) {
|
|
fmt.Println(regx.IsIdCardFormat("888388899880318888"))
|
|
|
|
}
|
|
|
|
func TestRegx_Convert15To18(t *testing.T) {
|
|
fmt.Println(regx.Convert15To18("111111111111111"))
|
|
//111111111111111
|
|
//111111191111111113
|
|
|
|
}
|
|
func TestRegx_GetSex(t *testing.T) {
|
|
fmt.Println(regx.GetSex("324054400330403410"))
|
|
//1
|
|
fmt.Println(regx.GetSex("324054400330403400"))
|
|
//0
|
|
fmt.Println(regx.GetYearByIdCard("324054400330403400"))
|
|
fmt.Println(regx.GetMonthByIdCard("324054400330403400"))
|
|
fmt.Println(regx.GetDayByIdCard("324054400330403400"))
|
|
|
|
}
|
|
|
|
func TestRegx_GetAge(t *testing.T) {
|
|
fmt.Println(regx.GetAgeByIdCard("324054202010233400"))
|
|
fmt.Println(regx.IsValidIdCard("324054202010233400"))
|
|
|
|
}
|
|
|
|
func TestRegx_GetProvinceByIdCard(t *testing.T) {
|
|
fmt.Println(regx.GetProvinceByIdCard("324054202010233400"))
|
|
fmt.Println(regx.GetProvinceByIdCard("422322202010233400"))
|
|
fmt.Println(regx.IsIdCardCheck("422322202010233400"))
|
|
|
|
}
|