diff options
Diffstat (limited to 'dhcpv4/option_domain_search_test.go')
-rw-r--r-- | dhcpv4/option_domain_search_test.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/dhcpv4/option_domain_search_test.go b/dhcpv4/option_domain_search_test.go index 4848a83..590ccd0 100644 --- a/dhcpv4/option_domain_search_test.go +++ b/dhcpv4/option_domain_search_test.go @@ -3,6 +3,7 @@ package dhcpv4 import ( "testing" + "github.com/insomniacslk/dhcp/rfc1035label" "github.com/stretchr/testify/require" ) @@ -15,9 +16,11 @@ func TestParseOptDomainSearch(t *testing.T) { } opt, err := ParseOptDomainSearch(data) require.NoError(t, err) - require.Equal(t, len(opt.DomainSearch), 2) - require.Equal(t, opt.DomainSearch[0], "example.com") - require.Equal(t, opt.DomainSearch[1], "subnet.example.org") + require.Equal(t, 2, len(opt.DomainSearch.Labels)) + require.Equal(t, data[2:], opt.DomainSearch.ToBytes()) + require.Equal(t, len(data[2:]), opt.DomainSearch.Length()) + require.Equal(t, opt.DomainSearch.Labels[0], "example.com") + require.Equal(t, opt.DomainSearch.Labels[1], "subnet.example.org") } func TestOptDomainSearchToBytes(t *testing.T) { @@ -28,9 +31,11 @@ func TestOptDomainSearchToBytes(t *testing.T) { 6, 's', 'u', 'b', 'n', 'e', 't', 7, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 3, 'o', 'r', 'g', 0, } opt := OptDomainSearch{ - DomainSearch: []string{ - "example.com", - "subnet.example.org", + DomainSearch: &rfc1035label.Labels{ + Labels: []string{ + "example.com", + "subnet.example.org", + }, }, } require.Equal(t, opt.ToBytes(), expected) |