MCPcopy
hub / github.com/dgraph-io/dgraph / TestIntersectCompressedWithBin

Function TestIntersectCompressedWithBin

algo/uidlist_test.go:632–655  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

630}
631
632func TestIntersectCompressedWithBin(t *testing.T) {
633 //lengths := []int{0, 1, 3, 11, 100, 500, 1000}
634
635 for _, N1 := range []int{11} {
636 for _, N2 := range []int{3} {
637 // Intersection of blockNums and otherNums is commonNums.
638 commonNums, blockNums, otherNums := fillNumsDiff(N1/10, N1, N2)
639
640 enc := codec.Encoder{BlockSize: 10}
641 for _, num := range blockNums {
642 enc.Add(num)
643 }
644
645 pack := enc.Done()
646 dec := codec.Decoder{Pack: pack}
647 dec.Seek(0, codec.SeekStart)
648
649 actual := make([]uint64, 0)
650 IntersectCompressedWithBin(&dec, otherNums, &actual)
651 require.Equal(t, commonNums, actual)
652 codec.FreePack(pack)
653 }
654 }
655}
656
657func TestIntersectCompressedWithBinMissingSize(t *testing.T) {
658 lengths := []int{0, 1, 3, 11, 100, 500, 1000}

Callers

nothing calls this directly

Calls 6

AddMethod · 0.95
DoneMethod · 0.95
SeekMethod · 0.95
FreePackFunction · 0.92
fillNumsDiffFunction · 0.85

Tested by

no test coverage detected