GenFakeUPC考虑校验规则
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user