summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/options_test.go
diff options
context:
space:
mode:
authorHu Jun <hujun.work@gmail.com>2020-06-23 17:13:04 -0700
committerHu Jun <hujun.work@gmail.com>2020-06-23 17:13:04 -0700
commit53863bbc3e1a9321931fe2d1187eb04f67ab75f4 (patch)
treea34bffdc80721c45d68acbd2060b23bf98efa203 /dhcpv4/options_test.go
parent5461cb587315d93b3e9ba193d594df681e05b220 (diff)
parentd74cd86ad5b8d0fbef8217631f7968bd7bab0d72 (diff)
Merge branch 'master' of https://github.com/insomniacslk/dhcp into dhcpv4_release
Diffstat (limited to 'dhcpv4/options_test.go')
-rw-r--r--dhcpv4/options_test.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/dhcpv4/options_test.go b/dhcpv4/options_test.go
index 6c5393c..3850d2d 100644
--- a/dhcpv4/options_test.go
+++ b/dhcpv4/options_test.go
@@ -194,9 +194,25 @@ func TestOptionsMarshal(t *testing.T) {
5, 1, 10,
),
},
+ {
+ // Test 0-length options
+ opts: Options{
+ 80: []byte{},
+ },
+ want: []byte{80, 0},
+ },
+ {
+ // Test special options, handled by the message marshalling code
+ // and ignored by the options marshalling code
+ opts: Options{
+ 0: []byte{}, // Padding
+ 255: []byte{}, // End of options
+ },
+ want: nil, // not written out
+ },
} {
t.Run(fmt.Sprintf("Test %02d", i), func(t *testing.T) {
- require.Equal(t, uio.ToBigEndian(tt.opts), tt.want)
+ require.Equal(t, tt.want, uio.ToBigEndian(tt.opts))
})
}
}