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

Function TestAndNot

roaring_test.go:2909–2959  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2907}
2908
2909func TestAndNot(t *testing.T) {
2910 rr := NewBitmap()
2911
2912 for k := 4000; k < 4256; k++ {
2913 rr.AddInt(k)
2914 }
2915 for k := 65536; k < 65536+4000; k++ {
2916 rr.AddInt(k)
2917 }
2918 for k := 3 * 65536; k < 3*65536+9000; k++ {
2919 rr.AddInt(k)
2920 }
2921 for k := 4 * 65535; k < 4*65535+7000; k++ {
2922 rr.AddInt(k)
2923 }
2924 for k := 6 * 65535; k < 6*65535+10000; k++ {
2925 rr.AddInt(k)
2926 }
2927 for k := 8 * 65535; k < 8*65535+1000; k++ {
2928 rr.AddInt(k)
2929 }
2930 for k := 9 * 65535; k < 9*65535+30000; k++ {
2931 rr.AddInt(k)
2932 }
2933
2934 rr2 := NewBitmap()
2935
2936 for k := 4000; k < 4256; k++ {
2937 rr2.AddInt(k)
2938 }
2939 for k := 65536; k < 65536+4000; k++ {
2940 rr2.AddInt(k)
2941 }
2942 for k := 3*65536 + 2000; k < 3*65536+6000; k++ {
2943 rr2.AddInt(k)
2944 }
2945 for k := 6 * 65535; k < 6*65535+1000; k++ {
2946 rr2.AddInt(k)
2947 }
2948 for k := 7 * 65535; k < 7*65535+1000; k++ {
2949 rr2.AddInt(k)
2950 }
2951 for k := 10 * 65535; k < 10*65535+5000; k++ {
2952 rr2.AddInt(k)
2953 }
2954
2955 correct := AndNot(rr, rr2)
2956 rr.AndNot(rr2)
2957
2958 assert.True(t, correct.Equals(rr))
2959}
2960
2961func TestStats(t *testing.T) {
2962 t.Run("Test Stats with empty bitmap", func(t *testing.T) {

Callers

nothing calls this directly

Calls 5

AddIntMethod · 0.95
AndNotMethod · 0.95
NewBitmapFunction · 0.70
AndNotFunction · 0.70
EqualsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…