bitmapContainer's numberOfRuns() function should be correct against the runContainer equivalent
(t *testing.T)
| 11 | |
| 12 | // bitmapContainer's numberOfRuns() function should be correct against the runContainer equivalent |
| 13 | func TestBitmapContainerNumberOfRuns024(t *testing.T) { |
| 14 | seed := int64(42) |
| 15 | rand.Seed(seed) |
| 16 | |
| 17 | trials := []trial{ |
| 18 | {n: 1000, percentFill: .1, ntrial: 10}, |
| 19 | } |
| 20 | |
| 21 | for _, tr := range trials { |
| 22 | for j := 0; j < tr.ntrial; j++ { |
| 23 | ma := make(map[int]bool) |
| 24 | |
| 25 | n := tr.n |
| 26 | a := []uint16{} |
| 27 | |
| 28 | draw := int(float64(n) * tr.percentFill) |
| 29 | for i := 0; i < draw; i++ { |
| 30 | r0 := rand.Intn(n) |
| 31 | a = append(a, uint16(r0)) |
| 32 | ma[r0] = true |
| 33 | } |
| 34 | |
| 35 | // RunContainer compute this automatically |
| 36 | rc := newRunContainer16FromVals(false, a...) |
| 37 | rcNr := rc.numberOfRuns() |
| 38 | |
| 39 | // vs bitmapContainer |
| 40 | bc := newBitmapContainer() |
| 41 | for k := range ma { |
| 42 | bc.iadd(uint16(k)) |
| 43 | } |
| 44 | |
| 45 | bcNr := bc.numberOfRuns() |
| 46 | assert.Equal(t, rcNr, bcNr) |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // bitmap containers get cardinality in range, miss the last index, issue #183 |
| 52 | func TestBitmapcontainerAndCardinality(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…