add test for GetAlias

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

View file

@ -180,3 +180,15 @@ func TestAddIfNew(t *testing.T) {
t.Error("added address that should've been ignored ( your own )") t.Error("added address that should've been ignored ( your own )")
} }
} }
func TestGetAlias(t *testing.T) {
exampleAlias := "picat"
exampleLAN := buildExampleLAN()
exampleEndpoint := buildExampleEndpoint()
exampleLAN.hosts[exampleEndpoint.HwAddress] = exampleEndpoint
exp := exampleAlias
got := exampleLAN.GetAlias(exampleEndpoint.HwAddress)
if got != exp {
t.Fatalf("expected '%v', got '%v'", exp, got)
}
}