mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-23 16:50:18 +01:00
Test linked list in both directions in base tile hash.
This commit is contained in:
parent
9a355d08fd
commit
674912ed5f
@ -26,7 +26,27 @@ func randomBaseTileHash(updates int) *BaseTileHash {
|
|||||||
return bth
|
return bth
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBaseTileHash(t *testing.T) {
|
func TestBaseTileHashLenList(t *testing.T) {
|
||||||
|
for _, updates := range []int{53, 111, 1345, 11261} {
|
||||||
|
bth := randomBaseTileHash(updates)
|
||||||
|
countNext := 0
|
||||||
|
for cur := bth.root.next; cur != &bth.root; cur = cur.next {
|
||||||
|
countNext++
|
||||||
|
}
|
||||||
|
countPrev := 0
|
||||||
|
for cur := bth.root.prev; cur != &bth.root; cur = cur.prev {
|
||||||
|
countPrev++
|
||||||
|
}
|
||||||
|
if countPrev != countNext {
|
||||||
|
t.Errorf("count prev != count next: %d %d", countPrev, countNext)
|
||||||
|
}
|
||||||
|
if countPrev != len(bth.hashes) {
|
||||||
|
t.Errorf("count prev != len(hash): %d %d", countPrev, len(bth.hashes))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBaseTileHashIntegrity(t *testing.T) {
|
||||||
for _, updates := range []int{10, 100, 1000, 10000} {
|
for _, updates := range []int{10, 100, 1000, 10000} {
|
||||||
bth := randomBaseTileHash(updates)
|
bth := randomBaseTileHash(updates)
|
||||||
entries := map[*btHashEntry]bool{}
|
entries := map[*btHashEntry]bool{}
|
||||||
|
Loading…
Reference in New Issue
Block a user