(t *testing.T)
| 19 | } |
| 20 | |
| 21 | func TestCommonBits(t *testing.T) { |
| 22 | tests := []testPairCommonBits{ |
| 23 | {s1: []byte{1, 4, 53, 128}, s2: []byte{0, 0, 0, 0}, match: 7}, |
| 24 | {s1: []byte{0, 4, 53, 128}, s2: []byte{0, 0, 0, 0}, match: 13}, |
| 25 | {s1: []byte{0, 4, 53, 253}, s2: []byte{0, 4, 53, 252}, match: 31}, |
| 26 | {s1: []byte{192, 168, 1, 1}, s2: []byte{192, 169, 1, 1}, match: 15}, |
| 27 | {s1: []byte{65, 168, 1, 1}, s2: []byte{192, 169, 1, 1}, match: 0}, |
| 28 | } |
| 29 | |
| 30 | for _, p := range tests { |
| 31 | v := commonBits(p.s1, p.s2) |
| 32 | if v != p.match { |
| 33 | t.Error( |
| 34 | "For slice", p.s1, p.s2, |
| 35 | "expected match", p.match, |
| 36 | ",but got", v, |
| 37 | ) |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func benchmarkTrie(peerNumber, addressNumber, _ int, b *testing.B) { |
| 43 | var trie *trieEntry |
nothing calls this directly
no test coverage detected