add test for GetByIp

possible TODO: rename GetByIp to GetByIP like golint says to do?
This commit is contained in:
Kent Gruber 2018-05-01 15:03:20 -04:00
parent 4b82e917c7
commit dcc7ca2cbd

View file

@ -159,3 +159,15 @@ func TestEachHost(t *testing.T) {
t.Fatalf("expected '%d', got '%d'", exp, got) t.Fatalf("expected '%d', got '%d'", exp, got)
} }
} }
func TestGetByIp(t *testing.T) {
exampleLAN := buildExampleLAN()
exampleEndpoint := buildExampleEndpoint()
exampleLAN.hosts[exampleEndpoint.HwAddress] = exampleEndpoint
exp := exampleEndpoint
got := exampleLAN.GetByIp(exampleEndpoint.IpAddress)
if got != exp {
t.Fatalf("expected '%v', got '%v'", exp, got)
}
}