iteratorBitsInvariant checks that creating a bitmap from iterator bits gives the same bitmap
(t *testing.T, b *Bitmap)
| 83 | |
| 84 | // iteratorBitsInvariant checks that creating a bitmap from iterator bits gives the same bitmap |
| 85 | func iteratorBitsInvariant(t *testing.T, b *Bitmap) { |
| 86 | original := b.Clone() |
| 87 | |
| 88 | // Create new bitmap from iterator |
| 89 | result := NewBitmap() |
| 90 | iter := original.Iterator() |
| 91 | for iter.HasNext() { |
| 92 | result.Add(iter.Next()) |
| 93 | } |
| 94 | |
| 95 | // Should be equal to original |
| 96 | if !original.Equals(result) { |
| 97 | t.Errorf("bitmap reconstructed from iterator should equal original, original card=%d, result card=%d", |
| 98 | original.GetCardinality(), result.GetCardinality()) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | // unsetIteratorBitsInvariant checks that creating a bitmap from unset iterator, then flipping, gives the same bitmap |
| 103 | func unsetIteratorBitsInvariant(t *testing.T, b *Bitmap) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…