Files
go-easy-utils/validUtil/other_number_test.go
2023-03-12 19:15:32 +08:00

22 lines
498 B
Go

package validUtil
import "testing"
func TestIsPostalCode(t *testing.T) {
// Test valid postal codes
validCodes := []string{"100000", "200000", "999999"}
for _, code := range validCodes {
if !IsPostalCode(code) {
t.Errorf("%s should be a valid postal code", code)
}
}
// Test invalid postal codes
invalidCodes := []string{"1234567", "2000000", "123a56"}
for _, code := range invalidCodes {
if IsPostalCode(code) {
t.Errorf("%s should be an invalid postal code", code)
}
}
}