summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv4')
-rw-r--r--dhcpv4/options_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/dhcpv4/options_test.go b/dhcpv4/options_test.go
index 7f4b5f8..41ef415 100644
--- a/dhcpv4/options_test.go
+++ b/dhcpv4/options_test.go
@@ -64,6 +64,30 @@ func TestParseOption(t *testing.T) {
require.Equal(t, OptionClassIdentifier, opt.Code(), "Code")
require.Equal(t, 4, opt.Length(), "Length")
require.Equal(t, option, opt.ToBytes(), "ToBytes")
+
+ // Option TFTP server name
+ option = []byte{66, 4, 't', 'e', 's', 't'}
+ opt, err = ParseOption(option)
+ require.NoError(t, err)
+ require.Equal(t, OptionTFTPServerName, opt.Code(), "Code")
+ require.Equal(t, 4, opt.Length(), "Length")
+ require.Equal(t, option, opt.ToBytes(), "ToBytes")
+
+ // Option Bootfile name
+ option = []byte{67, 9, 'l', 'i', 'n', 'u', 'x', 'b', 'o', 'o', 't'}
+ opt, err = ParseOption(option)
+ require.NoError(t, err)
+ require.Equal(t, OptionBootfileName, opt.Code(), "Code")
+ require.Equal(t, 9, opt.Length(), "Length")
+ require.Equal(t, option, opt.ToBytes(), "ToBytes")
+
+ // Option user class information
+ option = []byte{77, 5, 4, 't', 'e', 's', 't'}
+ opt, err = ParseOption(option)
+ require.NoError(t, err)
+ require.Equal(t, OptionUserClassInformation, opt.Code(), "Code")
+ require.Equal(t, 5, opt.Length(), "Length")
+ require.Equal(t, option, opt.ToBytes(), "ToBytes")
}
func TestParseOptionZeroLength(t *testing.T) {