From 36562bc7a9a30b65e9b85550be64bbb93ac4991b Mon Sep 17 00:00:00 2001 From: Kent Gruber Date: Tue, 1 May 2018 22:38:48 -0400 Subject: [PATCH] add test for EachAccessPoint --- network/wifi_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/network/wifi_test.go b/network/wifi_test.go index 79582c1c..96931872 100644 --- a/network/wifi_test.go +++ b/network/wifi_test.go @@ -41,3 +41,18 @@ func TestWiFiMarshalJSON(t *testing.T) { t.Error("unable to marshal JSON from WiFi struct") } } + +func TestEachAccessPoint(t *testing.T) { + exampleWiFi := buildExampleWiFi() + exampleAP := NewAccessPoint("my_wifi", "ff:ff:ff:ff:ff:ff", 2472, int8(0)) + exampleWiFi.aps["ff:ff:ff:ff:ff:f1"] = exampleAP + exampleWiFi.aps["ff:ff:ff:ff:ff:f2"] = exampleAP + count := 0 + exampleCB := func(mac string, ap *AccessPoint) { + count++ + } + exampleWiFi.EachAccessPoint(exampleCB) + if count != 2 { + t.Error("unable to perform callback function for each access point") + } +}