diff options
author | Andrea Barberio <insomniac@slackware.it> | 2019-01-19 11:55:16 +0000 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2019-01-19 14:00:07 +0000 |
commit | 5e6e8baddaa29b866abe0b865e0c66c9190ec2f7 (patch) | |
tree | 4f17e1f590f131bfaef2f137c2999f023f55111a /dhcpv6/duid_test.go | |
parent | 9abedd99f2dd7f161645d2fd66644e2dcd6a459a (diff) |
dhcpv6: added Duid.Equal
Diffstat (limited to 'dhcpv6/duid_test.go')
-rw-r--r-- | dhcpv6/duid_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/dhcpv6/duid_test.go b/dhcpv6/duid_test.go index 840ab4a..5efa0e1 100644 --- a/dhcpv6/duid_test.go +++ b/dhcpv6/duid_test.go @@ -118,3 +118,31 @@ func TestOpaqueDuid(t *testing.T) { t.Fatalf("ToBytes: unexpected result: got %x, want %x", got, want) } } + +func TestDuidEqual(t *testing.T) { + d := Duid{ + Type: DUID_LL, + HwType: iana.HWTypeEthernet, + LinkLayerAddr: net.HardwareAddr{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, + } + o := Duid{ + Type: DUID_LL, + HwType: iana.HWTypeEthernet, + LinkLayerAddr: net.HardwareAddr{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, + } + require.True(t, d.Equal(o)) +} + +func TestDuidEqualNotEqual(t *testing.T) { + d := Duid{ + Type: DUID_LL, + HwType: iana.HWTypeEthernet, + LinkLayerAddr: net.HardwareAddr{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, + } + o := Duid{ + Type: DUID_LL, + HwType: iana.HWTypeEthernet, + LinkLayerAddr: net.HardwareAddr{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0x00}, + } + require.False(t, d.Equal(o)) +} |