(t *testing.T)
| 171 | } |
| 172 | |
| 173 | func TestOutConnAPI(t *testing.T) { |
| 174 | a := require.New(t) |
| 175 | si := NewNetServer() |
| 176 | server, ok := si.(*NetServer) |
| 177 | a.True(ok, "fail to case P2PServer") |
| 178 | |
| 179 | a.Equal(server.GetOutConnRecordLen(), int(0), "fail to test GetOutConnRecordLen") |
| 180 | server.AddOutConnRecord("192.168.1.1:200") |
| 181 | a.Equal(server.GetOutConnRecordLen(), int(1), "fail to test AddOutConnRecord") |
| 182 | server.AddOutConnRecord("192.168.1.1:200") |
| 183 | a.Equal(server.GetOutConnRecordLen(), int(1), "fail to test AddOutConnRecord") |
| 184 | server.AddOutConnRecord("192.168.1.1:300") |
| 185 | a.Equal(server.GetOutConnRecordLen(), int(2), "fail to test AddOutConnRecord") |
| 186 | server.RemoveFromOutConnRecord("192.168.1.1:300") |
| 187 | a.Equal(server.GetOutConnRecordLen(), int(1), "fail to test RemoveFromOutConnRecord") |
| 188 | a.Equal(server.IsAddrInOutConnRecord("192.168.1.1:300"), false, "fail to test IsAddrInOutConnRecord") |
| 189 | a.Equal(server.IsAddrInOutConnRecord("192.168.1.1:200"), true, "fail to test IsAddrInOutConnRecord") |
| 190 | } |
nothing calls this directly
no test coverage detected