diff options
author | Christopher Koch <chrisko@google.com> | 2018-12-29 09:16:15 -0800 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2019-01-11 19:38:21 +0000 |
commit | 9492662dae0651fd4d6698d35b58ade7300e149e (patch) | |
tree | 77f53ebd6dfded05880c322005909b97a1cf140c /dhcpv4/option_generic_test.go | |
parent | 512011c2eb80a7c0316405ef7aaae6e0b5b09b1c (diff) |
dhcpv4: simplify marshaling options to binary.
- Consolidate writing the option code and length to Options.Marshal
rather than doing it in each individual option.
- Use uio in marshaling code.
Diffstat (limited to 'dhcpv4/option_generic_test.go')
-rw-r--r-- | dhcpv4/option_generic_test.go | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/dhcpv4/option_generic_test.go b/dhcpv4/option_generic_test.go index 5c34903..8a1acc1 100644 --- a/dhcpv4/option_generic_test.go +++ b/dhcpv4/option_generic_test.go @@ -26,19 +26,7 @@ func TestOptionGenericToBytes(t *testing.T) { Data: []byte{byte(MessageTypeDiscover)}, } serialized := o.ToBytes() - expected := []byte{53, 1, 1} - require.Equal(t, expected, serialized) -} - -func TestOptionGenericToBytesZeroOptions(t *testing.T) { - o := OptionGeneric{OptionCode: OptionEnd} - serialized := o.ToBytes() - expected := []byte{255} - require.Equal(t, expected, serialized) - - o = OptionGeneric{OptionCode: OptionPad} - serialized = o.ToBytes() - expected = []byte{0} + expected := []byte{1} require.Equal(t, expected, serialized) } |