diff options
Diffstat (limited to 'packet/bgp_test.go')
-rw-r--r-- | packet/bgp_test.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packet/bgp_test.go b/packet/bgp_test.go index 46ff293d..2cc36a85 100644 --- a/packet/bgp_test.go +++ b/packet/bgp_test.go @@ -2,6 +2,7 @@ package bgp import ( "bytes" + "github.com/stretchr/testify/assert" "net" "testing" ) @@ -131,3 +132,12 @@ func Test_Message(t *testing.T) { } } } + +func Test_IPAddrPrefixString(t *testing.T) { + ipv4 := NewIPAddrPrefix(24, "129.6.10.0") + assert.Equal(t, "129.6.10.0/24", ipv4.String()) + ipv6 := NewIPv6AddrPrefix(18, "3343:faba:3903::1") + assert.Equal(t, "3343:faba:3903::1/18", ipv6.String()) + ipv6 = NewIPv6AddrPrefix(18, "3343:faba:3903::0") + assert.Equal(t, "3343:faba:3903::/18", ipv6.String()) +} |