diff options
Diffstat (limited to 'dhcpv6/dhcpv6_test.go')
-rw-r--r-- | dhcpv6/dhcpv6_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/dhcpv6/dhcpv6_test.go b/dhcpv6/dhcpv6_test.go index 17a8896..2e79f1f 100644 --- a/dhcpv6/dhcpv6_test.go +++ b/dhcpv6/dhcpv6_test.go @@ -82,5 +82,23 @@ func TestFromAndToBytes(t *testing.T) { require.Equal(t, expected, toBytes) } +func withServerID(d DHCPv6) DHCPv6 { + sid := OptServerId{} + d.AddOption(&sid) + return d +} + +func TestNewAdvertiseFromSolicit(t *testing.T) { + s := DHCPv6Message{} + s.SetMessage(SOLICIT) + s.SetTransactionID(0xabcdef) + cid := OptClientId{} + s.AddOption(&cid) + + a, err := NewAdvertiseFromSolicit(&s, withServerID) + require.NoError(t, err) + require.Equal(t, a.(*DHCPv6Message).TransactionID(), s.TransactionID()) +} + // TODO test NewSolicit // test String and Summary |