From 8bcdcb98d2ce1c575b57213cf5aa3a489c15f075 Mon Sep 17 00:00:00 2001
From: Daniel Czerwonk <daniel@dan-nrw.de>
Date: Thu, 28 Jun 2018 22:40:39 +0200
Subject: [PATCH] fixed expected value in case of none

---
 net/prefix_test.go                       | 9 +++++++++
 routingtable/adjRIBIn/adj_rib_in_test.go | 5 +++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/net/prefix_test.go b/net/prefix_test.go
index 82a6bafa..d886a49e 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 761e6293..0fb052db 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)
 			}
 		}
-- 
GitLab