MCPcopy Create free account
hub / github.com/RoaringBitmap/roaring / TestAndNot

Function TestAndNot

roaring64/roaring64_test.go:1774–1824  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1772}
1773
1774func TestAndNot(t *testing.T) {
1775 rr := NewBitmap()
1776
1777 for k := 4000; k < 4256; k++ {
1778 rr.AddInt(k)
1779 }
1780 for k := 65536; k < 65536+4000; k++ {
1781 rr.AddInt(k)
1782 }
1783 for k := 3 * 65536; k < 3*65536+9000; k++ {
1784 rr.AddInt(k)
1785 }
1786 for k := 4 * 65535; k < 4*65535+7000; k++ {
1787 rr.AddInt(k)
1788 }
1789 for k := 6 * 65535; k < 6*65535+10000; k++ {
1790 rr.AddInt(k)
1791 }
1792 for k := 8 * 65535; k < 8*65535+1000; k++ {
1793 rr.AddInt(k)
1794 }
1795 for k := 9 * 65535; k < 9*65535+30000; k++ {
1796 rr.AddInt(k)
1797 }
1798
1799 rr2 := NewBitmap()
1800
1801 for k := 4000; k < 4256; k++ {
1802 rr2.AddInt(k)
1803 }
1804 for k := 65536; k < 65536+4000; k++ {
1805 rr2.AddInt(k)
1806 }
1807 for k := 3*65536 + 2000; k < 3*65536+6000; k++ {
1808 rr2.AddInt(k)
1809 }
1810 for k := 6 * 65535; k < 6*65535+1000; k++ {
1811 rr2.AddInt(k)
1812 }
1813 for k := 7 * 65535; k < 7*65535+1000; k++ {
1814 rr2.AddInt(k)
1815 }
1816 for k := 10 * 65535; k < 10*65535+5000; k++ {
1817 rr2.AddInt(k)
1818 }
1819
1820 correct := AndNot(rr, rr2)
1821 rr.AndNot(rr2)
1822
1823 assert.True(t, correct.Equals(rr))
1824}
1825
1826func TestStats(t *testing.T) {
1827 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…