go test pls

This commit is contained in:
Bel LaPointe
2018-09-30 18:59:33 -06:00
parent e1c7e2bcfd
commit 6d1ebe9265
2 changed files with 130 additions and 0 deletions

33
main_test.go Normal file
View 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)
}
}
}