summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/bsdp/bsdp_option_generic_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv4/bsdp/bsdp_option_generic_test.go')
-rw-r--r--dhcpv4/bsdp/bsdp_option_generic_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/dhcpv4/bsdp/bsdp_option_generic_test.go b/dhcpv4/bsdp/bsdp_option_generic_test.go
index 5abcfbd..27436dd 100644
--- a/dhcpv4/bsdp/bsdp_option_generic_test.go
+++ b/dhcpv4/bsdp/bsdp_option_generic_test.go
@@ -10,6 +10,16 @@ func TestParseOptGeneric(t *testing.T) {
// Empty bytestream produces error
_, err := ParseOptGeneric([]byte{})
require.Error(t, err, "error from empty bytestream")
+
+ // Good parse
+ o, err := ParseOptGeneric([]byte{1, 1, 1})
+ require.NoError(t, err)
+ require.Equal(t, OptionMessageType, o.Code())
+ require.Equal(t, MessageTypeList, MessageType(o.Data[0]))
+
+ // Bad parse
+ o, err = ParseOptGeneric([]byte{1, 2, 1})
+ require.Error(t, err, "invalid length")
}
func TestOptGenericCode(t *testing.T) {