(t *testing.T)
| 2487 | } |
| 2488 | |
| 2489 | func TestNextMany(t *testing.T) { |
| 2490 | count := 70000 |
| 2491 | |
| 2492 | for _, gap := range []uint32{1, 8, 32, 128} { |
| 2493 | expected := make([]uint32, count) |
| 2494 | { |
| 2495 | v := uint32(0) |
| 2496 | for i := range expected { |
| 2497 | expected[i] = v |
| 2498 | v += gap |
| 2499 | } |
| 2500 | } |
| 2501 | bm := BitmapOf(expected...) |
| 2502 | for _, bufSize := range []int{1, 64, 4096, count} { |
| 2503 | buf := make([]uint32, bufSize) |
| 2504 | it := bm.ManyIterator() |
| 2505 | cur := 0 |
| 2506 | for n := it.NextMany(buf); n != 0; n = it.NextMany(buf) { |
| 2507 | // much faster tests... (10s -> 5ms) |
| 2508 | if cur+n > count { |
| 2509 | assert.LessOrEqual(t, count, cur+n) |
| 2510 | } |
| 2511 | |
| 2512 | for i, v := range buf[:n] { |
| 2513 | // much faster tests... |
| 2514 | if v != expected[cur+i] { |
| 2515 | assert.Equal(t, expected[cur+i], v) |
| 2516 | } |
| 2517 | } |
| 2518 | |
| 2519 | cur += n |
| 2520 | } |
| 2521 | |
| 2522 | assert.Equal(t, count, cur) |
| 2523 | } |
| 2524 | } |
| 2525 | } |
| 2526 | |
| 2527 | func TestBigRandom(t *testing.T) { |
| 2528 | rTest(t, 15) |
nothing calls this directly
no test coverage detected
searching dependent graphs…