summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_iaprefix_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv6/option_iaprefix_test.go')
-rw-r--r--dhcpv6/option_iaprefix_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/dhcpv6/option_iaprefix_test.go b/dhcpv6/option_iaprefix_test.go
index 7a24d2b..a1c140e 100644
--- a/dhcpv6/option_iaprefix_test.go
+++ b/dhcpv6/option_iaprefix_test.go
@@ -56,6 +56,21 @@ func TestOptIAPrefixToBytes(t *testing.T) {
}
}
+func TestOptIAPrefixToBytesDefault(t *testing.T) {
+ buf := []byte{
+ 0, 0, 0, 0, // preferredLifetime
+ 0, 0, 0, 0, // validLifetime
+ 0, // prefixLength
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // ipv6Prefix
+ }
+ opt := OptIAPrefix{
+ }
+ toBytes := opt.ToBytes()
+ if !bytes.Equal(toBytes, buf) {
+ t.Fatalf("Invalid ToBytes result. Expected %v, got %v", buf, toBytes)
+ }
+}
+
func TestOptIAPrefixParseInvalidTooShort(t *testing.T) {
buf := []byte{
0xaa, 0xbb, 0xcc, 0xdd, // preferredLifetime