diff options
author | Chris Koch <chrisko@google.com> | 2023-02-19 13:59:24 -0800 |
---|---|---|
committer | Chris K <c@chrisko.ch> | 2023-02-19 22:39:16 -0800 |
commit | 5369909a5de7c157e56e0feebbfde0b190e7a614 (patch) | |
tree | d72fdc57ca90546c5578f1949a95c9945615642a /dhcpv6/option_requestedoption_test.go | |
parent | a3bc2a6d841c820e7297fe54731f8d91d0721426 (diff) |
Tests for option deserialization & getters
Tests that for the correct option code, the correct deserialization is
applied.
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/option_requestedoption_test.go')
-rw-r--r-- | dhcpv6/option_requestedoption_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/dhcpv6/option_requestedoption_test.go b/dhcpv6/option_requestedoption_test.go index e5d7bfc..bb837db 100644 --- a/dhcpv6/option_requestedoption_test.go +++ b/dhcpv6/option_requestedoption_test.go @@ -1,11 +1,31 @@ package dhcpv6 import ( + "reflect" "testing" "github.com/stretchr/testify/require" ) +func TestParseMessageOptionsWithORO(t *testing.T) { + buf := []byte{ + 0, 6, // ORO option + 0, 2, // length + 0, 3, // IANA Option + 0, 6, // ORO + 0, 2, // length + 0, 4, // IATA + } + + want := OptionCodes{OptionIANA, OptionIATA} + var mo MessageOptions + if err := mo.FromBytes(buf); err != nil { + t.Errorf("FromBytes = %v", err) + } else if got := mo.RequestedOptions(); !reflect.DeepEqual(got, want) { + t.Errorf("ORO = %v, want %v", got, want) + } +} + func TestOptRequestedOption(t *testing.T) { expected := []byte{0, 1, 0, 2} var o optRequestedOption |