diff options
author | Pablo Mazzini <pmazzini@gmail.com> | 2018-11-18 12:16:01 +0000 |
---|---|---|
committer | Pablo Mazzini <pmazzini@gmail.com> | 2018-11-18 12:16:01 +0000 |
commit | d9eb0ae23f15e432e607fb18ffa21d886957821b (patch) | |
tree | 93b62d86c2adeadb2b94b02df3083cbada247dbd /dhcpv6/iputils_test.go | |
parent | 9be884266e5fd226a2663d90f36e72fc1d15bd2e (diff) |
ExtractMAC: increase coverage
Diffstat (limited to 'dhcpv6/iputils_test.go')
-rw-r--r-- | dhcpv6/iputils_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/dhcpv6/iputils_test.go b/dhcpv6/iputils_test.go index 1da249d..82a9a39 100644 --- a/dhcpv6/iputils_test.go +++ b/dhcpv6/iputils_test.go @@ -6,6 +6,7 @@ import ( "net" "testing" + "github.com/insomniacslk/dhcp/iana" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -129,4 +130,14 @@ func Test_ExtractMAC(t *testing.T) { mac, err := ExtractMAC(packet) require.NoError(t, err) require.Equal(t, mac.String(), "24:8a:07:56:dc:a4") + + duid := Duid{ + Type: DUID_LL, + HwType: iana.HwTypeEthernet, + LinkLayerAddr: []byte{0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa}, + } + solicit, err := NewMessage(WithClientID(duid)) + require.NoError(t, err) + mac, err = ExtractMAC(solicit) + require.Equal(t, mac.String(), "aa:aa:aa:aa:aa:aa") } |