go test pls
This commit is contained in:
33
main_test.go
Normal file
33
main_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func Test_notUSA(t *testing.T) {
|
||||
cases := []struct {
|
||||
ip string
|
||||
ok bool
|
||||
}{
|
||||
{
|
||||
ip: "8.8.8.8",
|
||||
ok: false,
|
||||
},
|
||||
{
|
||||
ip: "192.168.0.86",
|
||||
ok: false,
|
||||
},
|
||||
{
|
||||
ip: "127.0.0.1",
|
||||
ok: false,
|
||||
},
|
||||
{
|
||||
ip: "223.144.0.0",
|
||||
ok: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
if notUSA(c.ip) != c.ok {
|
||||
t.Errorf("WRONG VALIDATION for %v, expected %v", c.ip, c.ok)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user