diff options
author | Sean Karlage <skarlage@fb.com> | 2018-03-03 11:20:51 -0800 |
---|---|---|
committer | Sean Karlage <skarlage@fb.com> | 2018-03-03 11:26:42 -0800 |
commit | a22cefc86285b6ba1d9879486fda11054d070b78 (patch) | |
tree | 5c77fa1b8e6ddc33b26adb32d2668229304b1502 /dhcpv4/options_test.go | |
parent | 28e9aa6c820ffcb9028422b1179c1326dc76229c (diff) |
Add better formatting for vendor opts
Diffstat (limited to 'dhcpv4/options_test.go')
-rw-r--r-- | dhcpv4/options_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/dhcpv4/options_test.go b/dhcpv4/options_test.go index 5a34ed5..47258aa 100644 --- a/dhcpv4/options_test.go +++ b/dhcpv4/options_test.go @@ -146,3 +146,21 @@ func TestOptionsToStringDHCPMessageType(t *testing.T) { t.Fatalf("Invalid string representation: %v", stropt) } } + +func TestBSDPOptionToString(t *testing.T) { + // Parse message type + option := Option{ + Code: BSDPOptionMessageType, + Data: []byte{BSDPMessageTypeList}, + } + stropt := option.BSDPString() + AssertEqual(t, stropt, "BSDP Message Type -> [1]", "BSDP string representation") + + // Parse failure + option = Option{ + Code: OptionCode(12), // invalid BSDP Opcode + Data: []byte{1, 2, 3}, + } + stropt = option.BSDPString() + AssertEqual(t, stropt, "Unknown -> [1 2 3]", "BSDP string representation") +} |