(t *testing.T)
| 149 | } |
| 150 | |
| 151 | func TestInConnAPI(t *testing.T) { |
| 152 | a := require.New(t) |
| 153 | si := NewNetServer() |
| 154 | server, ok := si.(*NetServer) |
| 155 | a.True(ok, "fail to cast P2PServer") |
| 156 | |
| 157 | a.Equal(server.GetInConnRecordLen(), int(0), "fail to test GetInConnRecordLen") |
| 158 | server.AddInConnRecord("192.168.1.1:1024") |
| 159 | a.Equal(server.GetInConnRecordLen(), int(1), "fail to test AddInConnRecord") |
| 160 | server.AddInConnRecord("192.168.1.1:1024") |
| 161 | a.Equal(server.GetInConnRecordLen(), int(1), "fail to test GetInConnRecordLen") |
| 162 | server.AddInConnRecord("192.168.1.2:2048") |
| 163 | a.Equal(server.GetInConnRecordLen(), int(2), "fail to test AddInConnRecord") |
| 164 | server.RemoveFromInConnRecord("192.168.1.2:2048") |
| 165 | a.Equal(server.GetInConnRecordLen(), int(1), "fail to test RemoveFromInConnRecord") |
| 166 | // same IP, different port |
| 167 | server.AddInConnRecord("192.168.1.1:2048") |
| 168 | a.Equal(server.GetInConnRecordLen(), int(2), "fail to test RemoveFromInConnRecord") |
| 169 | |
| 170 | a.Equal(server.GetIpCountInInConnRecord("192.168.1.1"), uint(2), "fail to test GetIpCountInInConnRecord") |
| 171 | } |
| 172 | |
| 173 | func TestOutConnAPI(t *testing.T) { |
| 174 | a := require.New(t) |
nothing calls this directly
no test coverage detected