diff --git a/net/prefix_test.go b/net/prefix_test.go index 82a6bafa67e0c2afb723b9ad7cac75452df4a3cd..d886a49e4ae1ed49fede133df33ac4d90331dd16 100644 --- a/net/prefix_test.go +++ b/net/prefix_test.go @@ -344,3 +344,12 @@ func TestStrToAddr(t *testing.T) { assert.Equal(t, test.expected, res) } } + +func TestEqualOperator(t *testing.T) { + p1 := NewPfx(IPv4(100), 4) + p2 := NewPfx(IPv4(100), 4) + + if p1 != p2 { + assert.Fail(t, "p1 != p2 (even if attributes are equal)") + } +} diff --git a/routingtable/adjRIBIn/adj_rib_in_test.go b/routingtable/adjRIBIn/adj_rib_in_test.go index 761e6293dad71fb76bde56ef9010b4da353ceea4..0fb052db2a5e34f26eb2132cf86cd03632f420c7 100644 --- a/routingtable/adjRIBIn/adj_rib_in_test.go +++ b/routingtable/adjRIBIn/adj_rib_in_test.go @@ -29,7 +29,7 @@ func TestAddPath(t *testing.T) { }, }), }, - removePfx: net.NewPfx(net.IPv4(0), 0), + removePfx: net.Prefix{}, removePath: nil, expected: []*route.Route{ route.NewRoute(net.NewPfx(net.IPv4FromOctets(10, 0, 0, 0), 8), &route.Path{ @@ -184,7 +184,8 @@ func TestRemovePath(t *testing.T) { assert.Equal(t, test.removePath, removePathParams.Path) } else { removePathParams := mc.GetRemovePathParams() - if removePathParams.Pfx != net.NewPfx(net.IPv4(0), 0) { + uninitialized := net.Prefix{} + if removePathParams.Pfx != uninitialized { t.Errorf("Test %q failed: Call to RemovePath propagated unexpectedly", test.name) } }