diff options
author | Christopher Koch <chrisko@google.com> | 2018-12-29 14:48:10 -0800 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2019-01-24 08:05:49 +0000 |
commit | c90ab10024ada840e24bb028a3405961e8e4c26a (patch) | |
tree | 9b8af0c1b80ee6efc112921f9a14b92d6c73f8eb /dhcpv4/bsdp/bsdp_option_version_test.go | |
parent | 2be5cae32d33f01ddecf6f167a9c0e5290e6d58f (diff) |
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}, ...))
Diffstat (limited to 'dhcpv4/bsdp/bsdp_option_version_test.go')
-rw-r--r-- | dhcpv4/bsdp/bsdp_option_version_test.go | 29 |
1 files changed, 0 insertions, 29 deletions
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()) -} |