GenFakeUPC考虑校验规则

This commit is contained in:
gazebo
2019-12-13 18:39:54 +08:00
parent f7418d2581
commit b428c0236e
2 changed files with 31 additions and 4 deletions

View File

@@ -288,11 +288,11 @@ func TestGetOneEmailFromStr(t *testing.T) {
func TestGenFakeUPC(t *testing.T) {
for _, v := range [][]string{
[]string{
"6666000000123",
"123",
"6666000298034",
"29803",
},
[]string{
"6666007654321",
"6666076543212",
"7654321",
},
} {
@@ -300,4 +300,10 @@ func TestGenFakeUPC(t *testing.T) {
t.Errorf("%s failed, result:%s, expect:%s", v[1], str, v[0])
}
}
if !IsUpcValid("6666076543212") {
t.Fatal("wrong1")
}
if IsUpcValid("6666076543210") {
t.Fatal("wrong2")
}
}