diff --git a/common/basetilehash_test.go b/common/basetilehash_test.go index 45ea811..856083c 100644 --- a/common/basetilehash_test.go +++ b/common/basetilehash_test.go @@ -26,7 +26,27 @@ func randomBaseTileHash(updates int) *BaseTileHash { 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} { bth := randomBaseTileHash(updates) entries := map[*btHashEntry]bool{}