(t *testing.T)
| 122 | } |
| 123 | |
| 124 | func TestConnectingNodeAPI(t *testing.T) { |
| 125 | a := require.New(t) |
| 126 | server := NewNetServer() |
| 127 | |
| 128 | a.Equal(server.GetOutConnectingListLen(), uint(0), "fail to test GetOutConnectingListLen") |
| 129 | |
| 130 | addOK := server.AddOutConnectingList("192.168.1.1:28339") |
| 131 | a.Equal(server.GetOutConnectingListLen(), uint(1), "fail to test AddOutConnectingList") |
| 132 | a.Equal(addOK, true, "fail to test AddOutConnectingList") |
| 133 | |
| 134 | // add same |
| 135 | addOK = server.AddOutConnectingList("192.168.1.1:28339") |
| 136 | a.Equal(server.GetOutConnectingListLen(), uint(1), "fail to test AddOutConnectingList") |
| 137 | a.Equal(addOK, false, "fail to test AddOutConnectingList") |
| 138 | |
| 139 | // add new |
| 140 | server.AddOutConnectingList("192.168.2.2:2") |
| 141 | a.Equal(server.GetOutConnectingListLen(), uint(2), "fail to test AddOutConnectingList") |
| 142 | |
| 143 | // test exist |
| 144 | a.Equal(server.IsAddrFromConnecting("192.168.2.2:2"), true, "fail to test IsAddrFromConnecting") |
| 145 | a.Equal(server.IsAddrFromConnecting("192.168.2.3:3"), false, "fail to test IsAddrFromConnecting") |
| 146 | |
| 147 | server.RemoveFromConnectingList("192.168.2.2:2") |
| 148 | a.Equal(server.GetOutConnectingListLen(), uint(1), "fail to test RemoveFromConnectingList") |
| 149 | } |
| 150 | |
| 151 | func TestInConnAPI(t *testing.T) { |
| 152 | a := require.New(t) |
nothing calls this directly
no test coverage detected