From e9697e06598909166f7ea7c5a51c35f57cfb1597 Mon Sep 17 00:00:00 2001 From: Kent Gruber Date: Tue, 1 May 2018 14:59:25 -0400 Subject: [PATCH] add test for Get --- network/lan_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/network/lan_test.go b/network/lan_test.go index d6a7cab2..79ba4d76 100644 --- a/network/lan_test.go +++ b/network/lan_test.go @@ -79,3 +79,16 @@ func TestSetAliasFor(t *testing.T) { t.Error("unable to set alias for a given mac address") } } + +func TestGet(t *testing.T) { + exampleLAN := buildExampleLAN() + exampleEndpoint := buildExampleEndpoint() + exampleLAN.hosts[exampleEndpoint.HwAddress] = exampleEndpoint + foundEndpoint, foundBool := exampleLAN.Get(exampleEndpoint.HwAddress) + if foundEndpoint != exampleEndpoint { + t.Fatalf("expected '%v', got '%v'", foundEndpoint, exampleEndpoint) + } + if !foundBool { + t.Error("unable to get known endpoint via mac address from LAN struct") + } +}