代码拉取完成,页面将自动刷新
package idvalidator
import (
"testing"
)
// go test -v -cover -coverprofile=cover.out
// go tool cover -func=cover.out
// go tool cover -html=cover.out
func TestIsValidBasic(t *testing.T) {
errIds := []string{
"44030819990110", // 号码位数不合法
"440308199902301512", // 出生日期码不合法
"440308199901101513", // 验证码不合法
"610104620932690", // 出生日期码不合法
"11010119900307867X", // 校验位不合法
"TES12345678901 j", // 特殊字符格式不合法
}
for _, id := range errIds {
if IsValidBasic(id) {
t.Errorf("ID must be invalid.: %s", id)
}
}
}
func TestGetInfoBasic(t *testing.T) {
_, e1 := GetBasicInfo("440301197110292910")
if e1 != nil {
t.Errorf("`e1` must be nil.: %v", e1)
}
_, e2 := GetBasicInfo("500154199302305886")
if e2 == nil {
t.Errorf("`e2` must not be nil.: %v", e2)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。