From 56ed4760f09d10c4e604e29073a8dba0cf7c60fa Mon Sep 17 00:00:00 2001 From: dimagolomozy Date: Mon, 16 Aug 2021 19:23:54 +0300 Subject: [PATCH] capture test --- capture/capture_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 capture/capture_test.go diff --git a/capture/capture_test.go b/capture/capture_test.go new file mode 100644 index 0000000..9f3772d --- /dev/null +++ b/capture/capture_test.go @@ -0,0 +1,22 @@ +package capture + +import ( + "testing" +) + +func TestSetInterfaces(t *testing.T) { + listener := &Listener{ + loopIndex: 99999, + } + listener.setInterfaces() + + for _, nic := range listener.Interfaces { + if (len(nic.Addresses)) == 0 { + t.Errorf("nic %s was captured with 0 addresses", nic.Name) + } + } + + if listener.loopIndex == 99999 { + t.Errorf("loopback nic index was not found") + } +}