misc naming
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Brian Tiger Chow committed
Dec 18, 2014 at 19:09 UTC
06d4df23f15216f81092739a6684bcd3b3868d31
1 file changed
+9
-9
net/net_test.go
+9
-9
@@ -36,28 +36,28 @@ func TestConnectednessCorrect(t *testing.T) {
36
// test those connected show up correctly
37
38
// test connected
39
- testConnectedness(t, nets[0], nets[1], inet.Connected)
40
- testConnectedness(t, nets[0], nets[3], inet.Connected)
41
- testConnectedness(t, nets[1], nets[2], inet.Connected)
42
- testConnectedness(t, nets[3], nets[2], inet.Connected)
39
+ expectConnectedness(t, nets[0], nets[1], inet.Connected)
40
+ expectConnectedness(t, nets[0], nets[3], inet.Connected)
41
+ expectConnectedness(t, nets[1], nets[2], inet.Connected)
42
+ expectConnectedness(t, nets[3], nets[2], inet.Connected)
43
44
// test not connected
45
- testConnectedness(t, nets[0], nets[2], inet.NotConnected)
46
- testConnectedness(t, nets[1], nets[3], inet.NotConnected)
45
+ expectConnectedness(t, nets[0], nets[2], inet.NotConnected)
46
+ expectConnectedness(t, nets[1], nets[3], inet.NotConnected)
47
48
for _, n := range nets {
49
n.Close()
50
}
51
}
52
53
-func testConnectedness(t *testing.T, a, b inet.Network, c inet.Connectedness) {
53
+func expectConnectedness(t *testing.T, a, b inet.Network, expected inet.Connectedness) {
54
es := "%s is connected to %s, but Connectedness incorrect. %s %s"
55
- if a.Connectedness(b.LocalPeer()) != c {
55
+ if a.Connectedness(b.LocalPeer()) != expected {
56
t.Errorf(es, a, b, printConns(a), printConns(b))
57
}
58
59
// test symmetric case
60
- if b.Connectedness(a.LocalPeer()) != c {
60
+ if b.Connectedness(a.LocalPeer()) != expected {
61
t.Errorf(es, b, a, printConns(b), printConns(a))
62
}
63
}