(t *testing.T)
| 2667 | } |
| 2668 | |
| 2669 | func TestRunContainerIntersectCardinality(t *testing.T) { |
| 2670 | t.Run("Two Empty Runs", func(t *testing.T) { |
| 2671 | first := runContainer16{} |
| 2672 | second := runContainer16{} |
| 2673 | result := first.intersectCardinality(&second) |
| 2674 | assert.Equal(t, 0, result) |
| 2675 | }) |
| 2676 | |
| 2677 | t.Run("First Run Empty", func(t *testing.T) { |
| 2678 | first := runContainer16{} |
| 2679 | second := runContainer16{} |
| 2680 | second.iaddRange(0, 1024) |
| 2681 | result := first.intersectCardinality(&second) |
| 2682 | assert.Equal(t, 0, result) |
| 2683 | }) |
| 2684 | |
| 2685 | t.Run("Second Run Empty", func(t *testing.T) { |
| 2686 | first := runContainer16{} |
| 2687 | second := runContainer16{} |
| 2688 | first.iaddRange(0, 1024) |
| 2689 | result := first.intersectCardinality(&second) |
| 2690 | assert.Equal(t, 0, result) |
| 2691 | }) |
| 2692 | |
| 2693 | t.Run("Disjoint Ranges", func(t *testing.T) { |
| 2694 | first := runContainer16{} |
| 2695 | first.iaddRange(512, 1024) |
| 2696 | second := runContainer16{} |
| 2697 | second.iaddRange(0, 256) |
| 2698 | result := first.intersectCardinality(&second) |
| 2699 | assert.Equal(t, 0, result) |
| 2700 | }) |
| 2701 | |
| 2702 | t.Run("Complete Overlap", func(t *testing.T) { |
| 2703 | first := runContainer16{} |
| 2704 | first.iaddRange(0, 256) |
| 2705 | second := runContainer16{} |
| 2706 | second.iaddRange(0, 256) |
| 2707 | result := first.intersectCardinality(&second) |
| 2708 | assert.Equal(t, 256, result) |
| 2709 | }) |
| 2710 | |
| 2711 | t.Run("Single Element Intersection", func(t *testing.T) { |
| 2712 | first := runContainer16{} |
| 2713 | first.iaddRange(0, 257) |
| 2714 | second := runContainer16{} |
| 2715 | second.iaddRange(256, 512) |
| 2716 | result := first.intersectCardinality(&second) |
| 2717 | assert.Equal(t, 1, result) |
| 2718 | }) |
| 2719 | } |
| 2720 | |
| 2721 | // go test -bench BenchmarkShortIteratorAdvance -run - |
| 2722 | func BenchmarkShortIteratorAdvanceRuntime(b *testing.B) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…