MCPcopy
hub / github.com/RoaringBitmap/roaring / TestNextAbsentValueArray

Function TestNextAbsentValueArray

arraycontainer_test.go:488–528  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

486}
487
488func TestNextAbsentValueArray(t *testing.T) {
489 t.Run("Java Port 1", func(t *testing.T) {
490 // [Java 1] https://github.com/RoaringBitmap/RoaringBitmap/blob/5235aa62c32fa3bf7fae40a562e3edc75f61be4e/RoaringBitmap/src/test/java/org/roaringbitmap/TestArrayContainer.java#L850
491 ac := newArrayContainer()
492 ac.iaddRange(64, 129)
493 assert.Equal(t, 0, ac.nextAbsentValue(0))
494 assert.Equal(t, 63, ac.nextAbsentValue(63))
495 assert.Equal(t, 129, ac.nextAbsentValue(64))
496 assert.Equal(t, 129, ac.nextAbsentValue(65))
497 assert.Equal(t, 129, ac.nextAbsentValue(128))
498 assert.Equal(t, 129, ac.nextAbsentValue(129))
499 })
500
501 t.Run("Java Port 2", func(t *testing.T) {
502 // [Example 2] https://github.com/RoaringBitmap/RoaringBitmap/blob/5235aa62c32fa3bf7fae40a562e3edc75f61be4e/RoaringBitmap/src/test/java/org/roaringbitmap/TestArrayContainer.java#L861
503 ac := newArrayContainer()
504 ac.iaddRange(64, 129)
505 ac.iaddRange(200, 501)
506 ac.iaddRange(5000, 5201)
507 assert.Equal(t, 0, ac.nextAbsentValue(0))
508 assert.Equal(t, 63, ac.nextAbsentValue(63))
509 assert.Equal(t, 129, ac.nextAbsentValue(64))
510 assert.Equal(t, 129, ac.nextAbsentValue(65))
511 assert.Equal(t, 129, ac.nextAbsentValue(128))
512 assert.Equal(t, 129, ac.nextAbsentValue(129))
513 assert.Equal(t, 199, ac.nextAbsentValue(199))
514 assert.Equal(t, 501, ac.nextAbsentValue(200))
515 assert.Equal(t, 501, ac.nextAbsentValue(250))
516 assert.Equal(t, 2500, ac.nextAbsentValue(2500))
517 assert.Equal(t, 5201, ac.nextAbsentValue(5000))
518 assert.Equal(t, 5201, ac.nextAbsentValue(5200))
519 })
520
521 t.Run("Java Port 3", func(t *testing.T) {
522 // [Java 3] https://github.com/RoaringBitmap/RoaringBitmap/blob/5235aa62c32fa3bf7fae40a562e3edc75f61be4e/RoaringBitmap/src/test/java/org/roaringbitmap/TestArrayContainer.java#L878
523 ac := newArrayContainer()
524 for i := 0; i < 1000; i++ {
525 assert.Equal(t, i, ac.nextAbsentValue(uint16(i)))
526 }
527 })
528}
529
530func TestPreviousValueArray(t *testing.T) {
531 t.Run("Java Port 1", func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

newArrayContainerFunction · 0.85
iaddRangeMethod · 0.65
nextAbsentValueMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…