| 605 | } |
| 606 | |
| 607 | func TestIntersectCompressedWithLinJump(t *testing.T) { |
| 608 | lengths := []int{0, 1, 3, 11, 100} |
| 609 | |
| 610 | for _, N1 := range lengths { |
| 611 | for _, N2 := range lengths { |
| 612 | // Intersection of blockNums and otherNums is commonNums. |
| 613 | commonNums, blockNums, otherNums := fillNums(N1, N2) |
| 614 | |
| 615 | enc := codec.Encoder{BlockSize: 10} |
| 616 | for _, num := range blockNums { |
| 617 | enc.Add(num) |
| 618 | } |
| 619 | |
| 620 | pack := enc.Done() |
| 621 | dec := codec.Decoder{Pack: pack} |
| 622 | dec.Seek(0, codec.SeekStart) |
| 623 | |
| 624 | actual := make([]uint64, 0) |
| 625 | IntersectCompressedWithLinJump(&dec, otherNums, &actual) |
| 626 | require.Equal(t, commonNums, actual) |
| 627 | codec.FreePack(pack) |
| 628 | } |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | func TestIntersectCompressedWithBin(t *testing.T) { |
| 633 | //lengths := []int{0, 1, 3, 11, 100, 500, 1000} |