From c90ab10024ada840e24bb028a3405961e8e4c26a Mon Sep 17 00:00:00 2001 From: Christopher Koch Date: Sat, 29 Dec 2018 14:48:10 -0800 Subject: dhcpv4: nicer API for option parsing. From: r := d.GetOneOption(OptionRouter).(*OptRouter).Routers d.UpdateOption(&OptRouter{Routers: []net.IP{net.IP{192, 168, 0, 1}}}) To: r := GetRouter(d.Options) d.UpdateOption(OptRouter(net.IP{192, 168, 0, 1}, ...)) --- dhcpv4/bsdp/bsdp_option_version_test.go | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 dhcpv4/bsdp/bsdp_option_version_test.go (limited to 'dhcpv4/bsdp/bsdp_option_version_test.go') diff --git a/dhcpv4/bsdp/bsdp_option_version_test.go b/dhcpv4/bsdp/bsdp_option_version_test.go deleted file mode 100644 index 69d4c86..0000000 --- a/dhcpv4/bsdp/bsdp_option_version_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package bsdp - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestOptVersionInterfaceMethods(t *testing.T) { - o := Version1_1 - require.Equal(t, OptionVersion, o.Code(), "Code") - require.Equal(t, []byte{1, 1}, o.ToBytes(), "ToBytes") -} - -func TestParseOptVersion(t *testing.T) { - data := []byte{1, 1} - o, err := ParseOptVersion(data) - require.NoError(t, err) - require.Equal(t, Version1_1, o) - - // Short byte stream - data = []byte{2} - _, err = ParseOptVersion(data) - require.Error(t, err, "should get error from short byte stream") -} - -func TestOptVersionString(t *testing.T) { - require.Equal(t, "BSDP Version -> 1.1", Version1_1.String()) -} -- cgit v1.2.3