summaryrefslogtreecommitdiffhomepage
path: root/table/table_test.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-09 13:21:41 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-09 13:21:41 +0900
commit900cb321fb3dc353b102aa1970e652184abc24eb (patch)
tree2fa7ba4dd183781051b10c1df52043e433da0ca3 /table/table_test.go
parent0ad83ce995ab8c87c2f68aa4d52a22e1a232ab1d (diff)
table: fix tableKey()
tableKey() must use Prefix (address + mask) as key. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/table_test.go')
-rw-r--r--table/table_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/table/table_test.go b/table/table_test.go
index 74381e8b..4af1d221 100644
--- a/table/table_test.go
+++ b/table/table_test.go
@@ -32,7 +32,7 @@ func TestTableTableKeyDefault(t *testing.T) {
td := NewTableDefault(0)
nlri := bgp.NewNLRInfo(24, "13.2.3.1")
tk := td.tableKey(nlri)
- assert.Nil(t, tk)
+ assert.Equal(t, tk, "")
}
func TestTableDeleteDestByNlri(t *testing.T) {
@@ -43,10 +43,10 @@ func TestTableDeleteDestByNlri(t *testing.T) {
for _, path := range pathT {
tableKey := ipv4t.tableKey(path.getNlri())
dest := ipv4t.createDest(path.getNlri())
- ipv4t.setDestination(tableKey.String(), dest)
+ ipv4t.setDestination(tableKey, dest)
}
tableKey := ipv4t.tableKey(pathT[0].getNlri())
- gdest := ipv4t.getDestination(tableKey.String())
+ gdest := ipv4t.getDestination(tableKey)
rdest := deleteDestByNlri(ipv4t, pathT[0].getNlri())
assert.Equal(t, rdest, gdest)
}
@@ -59,13 +59,13 @@ func TestTableDeleteDest(t *testing.T) {
for _, path := range pathT {
tableKey := ipv4t.tableKey(path.getNlri())
dest := ipv4t.createDest(path.getNlri())
- ipv4t.setDestination(tableKey.String(), dest)
+ ipv4t.setDestination(tableKey, dest)
}
tableKey := ipv4t.tableKey(pathT[0].getNlri())
dest := ipv4t.createDest(pathT[0].getNlri())
- ipv4t.setDestination(tableKey.String(), dest)
+ ipv4t.setDestination(tableKey, dest)
deleteDest(ipv4t, dest)
- gdest := ipv4t.getDestination(tableKey.String())
+ gdest := ipv4t.getDestination(tableKey)
assert.Nil(t, gdest)
}
@@ -84,7 +84,7 @@ func TestTableSetDestinations(t *testing.T) {
for _, path := range pathT {
tableKey := ipv4t.tableKey(path.getNlri())
dest := ipv4t.createDest(path.getNlri())
- destinations[tableKey.String()] = dest
+ destinations[tableKey] = dest
}
ipv4t.setDestinations(destinations)
ds := ipv4t.getDestinations()
@@ -99,7 +99,7 @@ func TestTableGetDestinations(t *testing.T) {
for _, path := range pathT {
tableKey := ipv4t.tableKey(path.getNlri())
dest := ipv4t.createDest(path.getNlri())
- destinations[tableKey.String()] = dest
+ destinations[tableKey] = dest
}
ipv4t.setDestinations(destinations)
ds := ipv4t.getDestinations()