(connect bool)
| 30 | ) |
| 31 | |
| 32 | func constructPeerPool(connect bool) *PeerPool { |
| 33 | peer := &Peer{ |
| 34 | Index: uint32(1), |
| 35 | LastUpdateTime: time.Unix(0, 0), |
| 36 | connected: connect, |
| 37 | } |
| 38 | peers := make(map[uint32]*Peer) |
| 39 | peers[1] = peer |
| 40 | peerpool := &PeerPool{ |
| 41 | maxSize: int(3), |
| 42 | configs: make(map[uint32]*vconfig.PeerConfig), |
| 43 | IDMap: make(map[string]uint32), |
| 44 | peers: peers, |
| 45 | } |
| 46 | return peerpool |
| 47 | } |
| 48 | func TestIsNewPeer(t *testing.T) { |
| 49 | peerpool := constructPeerPool(false) |
| 50 | isnew := peerpool.isNewPeer(uint32(2)) |
no outgoing calls
no test coverage detected