From c66b596122b6c27546ed21c7604bd0d6a042fd6c Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 27 Oct 2015 09:34:32 +0900 Subject: server: fix radix key bug in rpki test also clean up functions to create a radix key. Signed-off-by: FUJITA Tomonori --- table/destination_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'table/destination_test.go') diff --git a/table/destination_test.go b/table/destination_test.go index abf1c652..e8edf562 100644 --- a/table/destination_test.go +++ b/table/destination_test.go @@ -19,7 +19,7 @@ import ( //"fmt" "github.com/osrg/gobgp/packet" "github.com/stretchr/testify/assert" - //"net" + "net" "testing" "time" ) @@ -191,3 +191,9 @@ func updateMsgD3() *bgp.BGPMessage { UpdatePathAttrs4ByteAs(updateMsg.Body.(*bgp.BGPUpdate)) return updateMsg } + +func TestRadixkey(t *testing.T) { + assert.Equal(t, "000010100000001100100000", CidrToRadixkey("10.3.32.0/24")) + assert.Equal(t, "000010100000001100100000", IpToRadixkey(net.ParseIP("10.3.32.0"), 24)) + assert.Equal(t, "000010100000001100100000", IpToRadixkey(net.ParseIP("10.3.32.0").To4(), 24)) +} -- cgit v1.2.3