Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package routingtable
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/bio-routing/bio-rd/net"
"github.com/bio-routing/bio-rd/route"
)
type MockClient struct {
foo int
}
func (m MockClient) AddPath(net.Prefix, *route.Path) error {
return nil
}
func (m MockClient) RemovePath(net.Prefix, *route.Path) bool {
return false
}
func (m MockClient) UpdateNewClient(RouteTableClient) error {
return nil
}
func TestClients(t *testing.T) {
tests := []struct {
name string
clients []MockClient
expected []RouteTableClient
}{
{
name: "No clients",
clients: []MockClient{},
expected: []RouteTableClient{},
},
{
name: "No clients",
clients: []MockClient{
MockClient{
foo: 1,
},
MockClient{
foo: 2,
},
},
expected: []RouteTableClient{
MockClient{
foo: 1,
},
MockClient{
foo: 2,
},
},
},
}
for _, test := range tests {
cm := NewClientManager(MockClient{})
for _, client := range test.clients {
cm.Register(client)
}
ret := cm.Clients()
assert.Equal(t, test.expected, ret)
}
}