diff options
Diffstat (limited to 'internal/pkg/table/destination_test.go')
-rw-r--r-- | internal/pkg/table/destination_test.go | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/internal/pkg/table/destination_test.go b/internal/pkg/table/destination_test.go index 110278fb..b1c1b2e8 100644 --- a/internal/pkg/table/destination_test.go +++ b/internal/pkg/table/destination_test.go @@ -17,7 +17,7 @@ package table import ( //"fmt" - "fmt" + "net" "testing" "time" @@ -292,35 +292,6 @@ func updateMsgD3() *bgp.BGPMessage { 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").To4(), 24)) - assert.Equal(t, "000010100000001100100000", IpToRadixkey(net.ParseIP("10.3.32.0").To4(), 24)) - assert.Equal(t, CidrToRadixkey("::ffff:0.0.0.0/96")+"000010100000001100100000", CidrToRadixkey("::ffff:10.3.32.0/120")) -} - -func TestIpToRadixkey(t *testing.T) { - for i := byte(0); i < 255; i += 3 { - for y := byte(1); y < 128; y *= 2 { - ip := net.IPv4(i, i+2, i+3, i-y) - for n := uint8(16); n <= 32; n += 2 { - exp := CidrToRadixkey(fmt.Sprintf("%v/%d", ip.To4(), n)) - got := IpToRadixkey(ip.To4(), n) - if exp != got { - t.Fatalf(`exp %v; got %v`, exp, got) - } - } - for n := uint8(116); n <= 128; n += 2 { - exp := CidrToRadixkey(fmt.Sprintf("::ffff:%v/%d", ip.To16(), n)) - got := IpToRadixkey(ip.To16(), n) - if exp != got { - t.Fatalf(`exp %v; got %v`, exp, got) - } - } - } - } -} - func TestMultipath(t *testing.T) { UseMultiplePaths.Enabled = true origin := bgp.NewPathAttributeOrigin(0) |