summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPablo Mazzini <pmazzini@gmail.com>2018-07-29 13:24:36 +0200
committerPablo Mazzini <pmazzini@gmail.com>2018-07-29 13:24:36 +0200
commit377731752ec3ddf7162413ad5e5ef8620e0b3857 (patch)
tree77d43444c3369acd69c6ead9bd353a7b00bba987
parent620189eaa8ecfd3cd9f8209a145d2b24a0cf447f (diff)
OptSubnetMask: add options test
-rw-r--r--dhcpv4/options_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/dhcpv4/options_test.go b/dhcpv4/options_test.go
index 41ef415..01d7427 100644
--- a/dhcpv4/options_test.go
+++ b/dhcpv4/options_test.go
@@ -17,6 +17,14 @@ func TestParseOption(t *testing.T) {
require.Equal(t, 4, generic.Length())
require.Equal(t, "Name Server -> [192 168 1 254]", generic.String())
+ // Option subnet mask
+ option = []byte{1, 4, 255, 255, 255, 0}
+ opt, err = ParseOption(option)
+ require.NoError(t, err)
+ require.Equal(t, OptionSubnetMask, opt.Code(), "Code")
+ require.Equal(t, 4, opt.Length(), "Length")
+ require.Equal(t, option, opt.ToBytes(), "ToBytes")
+
// Message type
option = []byte{53, 1, 1}
opt, err = ParseOption(option)