Skip to content

Commit fd47dd1

Browse files
committed
test(proto): add TestToIPv6
1 parent 184d419 commit fd47dd1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

proto/ipv6_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ func IPv6FromInt(v int) IPv6 {
1717
return s
1818
}
1919

20+
func TestToIPv6(t *testing.T) {
21+
v := netaddr.MustParseIP("2001:db8:ac10:fe01:feed:babe:cafe:0")
22+
b := make([]byte, 16)
23+
binPutIPv6(b, v.As16())
24+
ip := binIPv6(b)
25+
require.Equal(t, v, ip.ToIP())
26+
}
27+
2028
func TestColIPv6_NetAddr(t *testing.T) {
2129
input := []netaddr.IP{
2230
netaddr.MustParseIP("2001:db8:ac10:fe01:feed:babe:cafe:0"),

0 commit comments

Comments
 (0)