add test for AddIfNew

This commit is contained in:
Kent Gruber 2018-05-01 15:03:42 -04:00
commit 65b28e028f

View file

@ -171,3 +171,12 @@ func TestGetByIp(t *testing.T) {
t.Fatalf("expected '%v', got '%v'", exp, got)
}
}
func TestAddIfNew(t *testing.T) {
exampleLAN := buildExampleLAN()
iface, _ := FindInterface("")
// won't add our own IP address
if exampleLAN.AddIfNew(iface.IpAddress, iface.HwAddress) != nil {
t.Error("added address that should've been ignored ( your own )")
}
}