@@ -502,6 +502,43 @@ func sortUint64(nums []uint64) {
502502 sort .Slice (nums , func (i , j int ) bool { return nums [i ] < nums [j ] })
503503}
504504
505+ func fillNumsDiff (N1 , N2 , N3 int ) ([]uint64 , []uint64 , []uint64 ) {
506+ rand .Seed (time .Now ().UnixNano ())
507+
508+ commonNums := make ([]uint64 , N1 )
509+ blockNums := make ([]uint64 , N1 + N2 )
510+ otherNums := make ([]uint64 , N1 + N3 )
511+ allC := make (map [uint64 ]bool )
512+
513+ for i := 0 ; i < N1 ; i ++ {
514+ val := rand .Uint64 () % 1000
515+ commonNums [i ] = val
516+ blockNums [i ] = val
517+ otherNums [i ] = val
518+ allC [val ] = true
519+ }
520+
521+ for i := N1 ; i < N1 + N2 ; i ++ {
522+ val := rand .Uint64 () % 1000
523+ blockNums [i ] = val
524+ allC [val ] = true
525+ }
526+
527+ for i := N1 ; i < N1 + N3 ; i ++ {
528+ val := rand .Uint64 ()
529+ for ok := true ; ok ; _ , ok = allC [val ] {
530+ val = rand .Uint64 () % 1000
531+ }
532+ otherNums [i ] = val
533+ }
534+
535+ sortUint64 (commonNums )
536+ sortUint64 (blockNums )
537+ sortUint64 (otherNums )
538+
539+ return commonNums , blockNums , otherNums
540+ }
541+
505542func fillNums (N1 , N2 int ) ([]uint64 , []uint64 , []uint64 ) {
506543 rand .Seed (time .Now ().UnixNano ())
507544
@@ -554,12 +591,12 @@ func TestIntersectCompressedWithLinJump(t *testing.T) {
554591}
555592
556593func TestIntersectCompressedWithBin (t * testing.T ) {
557- lengths := []int {0 , 1 , 3 , 11 , 100 , 500 , 1000 }
594+ // lengths := []int{0, 1, 3, 11, 100, 500, 1000}
558595
559- for _ , N1 := range lengths {
560- for _ , N2 := range lengths {
596+ for _ , N1 := range [] int { 11 } {
597+ for _ , N2 := range [] int { 3 } {
561598 // Intersection of blockNums and otherNums is commonNums.
562- commonNums , blockNums , otherNums := fillNums ( N1 , N2 )
599+ commonNums , blockNums , otherNums := fillNumsDiff ( N1 / 10 , N1 , N2 )
563600
564601 enc := codec.Encoder {BlockSize : 10 }
565602 for _ , num := range blockNums {
0 commit comments