public void TestYnosa()
        {
            Console.WriteLine("testing Ynosa");
            var a1 = new EwahCompressedBitArray();
            var a2 = new EwahCompressedBitArray();

            a1.Set(5);
            a1.Set(15);
            a2.Set(5);
            Assert.IsTrue(a1.Intersects(a2));
            Console.WriteLine("testing Ynosa:ok");
        }
Beispiel #2
0
 public static void Main(string[] args)
 {
     var ewahBitmap1 = new EwahCompressedBitArray();
     var ewahBitmap2 = new EwahCompressedBitArray();
     ewahBitmap1.Set(0);
     ewahBitmap1.Set(2);
     ewahBitmap1.Set(64);
     ewahBitmap1.Set(1 << 30);
     Console.WriteLine("Running demo program:");
     Console.WriteLine("bitmap 1:");
     foreach (int k in ewahBitmap1)
         Console.WriteLine(k);
     ewahBitmap2.Set(1);
     ewahBitmap2.Set(3);
     ewahBitmap2.Set(64);
     ewahBitmap2.Set(1 << 30);
     Console.WriteLine("bitmap 2:");
     foreach (int k in ewahBitmap2)
         Console.WriteLine(k);
     Console.WriteLine();
     Console.WriteLine("bitmap 1 OR bitmap 2:");
     EwahCompressedBitArray orbitmap = ewahBitmap1.Or(ewahBitmap2);
     foreach (int k in orbitmap)
         Console.WriteLine(k);
     Console.WriteLine("memory usage: " + orbitmap.SizeInBytes + " bytes");
     Console.WriteLine();
     Console.WriteLine("bitmap 1 AND bitmap 2:");
     EwahCompressedBitArray andbitmap = ewahBitmap1.And(ewahBitmap2);
     foreach (int k in andbitmap)
         Console.WriteLine(k);
     Console.WriteLine("memory usage: " + andbitmap.SizeInBytes + " bytes");
     Console.WriteLine("bitmap 1 XOR bitmap 2:");
     EwahCompressedBitArray xorbitmap = ewahBitmap1.Xor(ewahBitmap2);
     foreach (int k in xorbitmap)
         Console.WriteLine(k);
     Console.WriteLine("memory usage: " + andbitmap.SizeInBytes + " bytes");
     Console.WriteLine("End of demo.");
     Console.WriteLine("");
     var tr = new EwahCompressedBitArrayTest();
     tr.TestNot();
     tr.TestCardinality();
     tr.TestEwahCompressedBitArray();
     tr.TestExternalization();
     tr.TestLargeEwahCompressedBitArray();
     tr.TestMassiveAnd();
     tr.TestMassiveAndNot();
     tr.TestMassiveOr();
     tr.TestMassiveXOR();
     tr.HabermaasTest();
     tr.VanSchaikTest();
 }
        public void TestIntersectOddNess()
        {
            Console.WriteLine("testing IntersectOddNess");
            var a1 = new EwahCompressedBitArray();
            var a2 = new EwahCompressedBitArray();

            a1.Set(12);
            a2.Set(0);
            a2.Set(1);
            a2.Set(4);
            a2.Set(14);
            Assert.IsFalse(a1.Intersects(a2));
            Console.WriteLine("testing IntersectOddNess:ok");
        }
 public void testsetSizeInBits()
 {
     Console.WriteLine("testing setSizeInBits");
     for (int k = 0; k < 4096; ++k)
     {
         EwahCompressedBitArray ewah = new EwahCompressedBitArray();
         ewah.SizeInBits = k;
         Assert.AreEqual(ewah.SizeInBits, k);
         Assert.AreEqual(ewah.GetCardinality(), 0);
         EwahCompressedBitArray ewah2 = new EwahCompressedBitArray();
         ewah2.SetSizeInBits(k, false);
         Assert.AreEqual(ewah2.SizeInBits, k);
         Assert.AreEqual(ewah2.GetCardinality(), 0);
         EwahCompressedBitArray ewah3 = new EwahCompressedBitArray();
         for (int i = 0; i < k; ++i)
         {
             ewah3.Set(i);
         }
         Assert.AreEqual(ewah3.SizeInBits, k);
         Assert.AreEqual(ewah3.GetCardinality(), k);
         EwahCompressedBitArray ewah4 = new EwahCompressedBitArray();
         ewah4.SetSizeInBits(k, true);
         Assert.AreEqual(ewah4.SizeInBits, k);
         Assert.AreEqual(ewah4.GetCardinality(), k);
     }
 }
        public void EwahIteratorProblem()
        {
            Console.WriteLine("testing ArnonMoscona");
            var bitmap = new EwahCompressedBitArray();

            for (int i = 9434560; i <= 9435159; i++)
            {
                bitmap.Set(i);
            }

            List <int> v = bitmap.GetPositions();
            int        k = 0;

            foreach (int ival in bitmap)
            {
                Assert.AreEqual(ival, v[k++]);
            }
            Assert.AreEqual(k, v.Count);

            for (k = 2; k <= 1024; k *= 2)
            {
                int[] bitsToSet = CreateSortedIntArrayOfBitsToSet(k, 434455 + 5 * k);
                var   ewah      = new EwahCompressedBitArray();
                foreach (int i in bitsToSet)
                {
                    ewah.Set(i);
                }
                assertEqualsPositions(bitsToSet, ewah.GetPositions());
            }
        }
        public void TestCardinality()
        {
            Console.WriteLine("testing EWAH GetCardinality");
            var bitmap = new EwahCompressedBitArray();

            bitmap.Set(int.MaxValue);
            // Console.format("Total Items %d\n", bitmap.GetCardinality());
            Assert.AreEqual(bitmap.GetCardinality(), 1);
            Console.WriteLine("testing EWAH GetCardinality:ok");
        }
        public void TestHasNextSafe()
        {
            Console.WriteLine("testing TestHasNextSafe");
            EwahCompressedBitArray bitmap = new EwahCompressedBitArray();

            bitmap.Set(0);
            IEnumerator <int> it = ((IEnumerable <int>)bitmap).GetEnumerator();

            Assert.AreEqual(it.MoveNext(), true);
            Assert.AreEqual(0, it.Current);
        }
Beispiel #8
0
        public void TestCustomSerializationStrategy()
        {
            Console.WriteLine("testing Custom serialization strategy");

            // Create a compressed bit array, and randomly assign up to 20,000 bits to it.
            var bmp = new EwahCompressedBitArray();
            var r   = new Random();

            for (int i = 0; i < 23000; i++)
            {
                if (r.NextDouble() < 0.5)
                {
                    bmp.Set(i);
                }
            }

            byte[] originalDeserialized = null;
            byte[] newFormDeserialized  = null;
            EwahCompressedBitArray newFormReserialized  = null;
            EwahCompressedBitArray originalReserialized = null;

            // First de-serialize+ re-serialize 'normally'
            using (var ms = new MemoryStream()) {
                BinaryFormatter bf = new BinaryFormatter();
                bf.Serialize(ms, bmp);
                originalDeserialized = ms.ToArray();
                ms.Seek(0, SeekOrigin.Begin);
                originalReserialized = (EwahCompressedBitArray)bf.Deserialize(ms);
            }

            // Now de-serialize + re-serialize with the new form.
            using (var ms = new MemoryStream()) {
                EwahCompressedBitArraySerializer bf = new EwahCompressedBitArraySerializer();
                bf.Serialize(ms, bmp);
                newFormDeserialized = ms.ToArray();
                ms.Seek(0, SeekOrigin.Begin);
                newFormReserialized = (EwahCompressedBitArray)bf.Deserialize(ms);
            }

            // Assert that the new form is more compact than the original form.
            Assert.Less(newFormDeserialized.Length, originalDeserialized.Length);

            // Compare the 'normal' de-serialized + re-serialized form, against the original.
            Assert.AreEqual(bmp, originalReserialized);

            // Compare the 'new form' de-serialized + re-serialized form, against the original.
            Assert.AreEqual(bmp, newFormReserialized);

            // Compare the 'normal' de-serialized + re-serialized form, against the newly de-serialized + re-serialized form.
            Assert.AreEqual(newFormReserialized, originalReserialized);

            Console.WriteLine("testing Custom serialization strategy:ok");
        }
        public void TestLargeEwahCompressedBitArray()
        {
            Console.WriteLine("testing EWAH over a large array");
            var       myarray1 = new EwahCompressedBitArray();
            const int n        = 11000000;

            for (int i = 0; i < n; ++i)
            {
                myarray1.Set(i);
            }
            Assert.AreEqual(myarray1.SizeInBits, n);
            Console.WriteLine("testing EWAH over a large array:ok");
        }
        public void HabermaasTest()
        {
            Console.WriteLine("testing habermaasTest");
            var bitArrayaa = new BitArray(1000131);
            var aa         = new EwahCompressedBitArray();

            int[] val = { 55400, 1000000, 1000128 };
            foreach (int t in val)
            {
                aa.Set(t);
                bitArrayaa.Set(t, true);
            }
            assertEquals(bitArrayaa, aa);
            var bitArrayab = new BitArray(1000131);
            var ab         = new EwahCompressedBitArray();

            for (int i = 4096; i < (4096 + 5); i++)
            {
                ab.Set(i);
                bitArrayab.Set(i, true);
            }
            ab.Set(99000);
            bitArrayab.Set(99000, true);
            ab.Set(1000130);
            bitArrayab.Set(1000130, true);
            assertEquals(bitArrayab, ab);
            EwahCompressedBitArray bb    = aa.Or(ab);
            EwahCompressedBitArray bbAnd = aa.And(ab);
            var bitArraybb = (BitArray)bitArrayaa.Clone();

            bitArraybb.Or(bitArrayab);
            var bitArraybbAnd = (BitArray)bitArrayaa.Clone();

            bitArraybbAnd.And(bitArrayab);
            AreEqual(bbAnd, bitArraybbAnd);
            AreEqual(bb, bitArraybb);
            Console.WriteLine("testing habermaasTest:ok");
        }
        public void TestNot()
        {
            Console.WriteLine("testing not");
            var bmp = new EwahCompressedBitArray();

            for (int i = 0; i <= 184; i++)
            {
                bmp.Set(i);
            }
            Assert.AreEqual(185, bmp.GetCardinality());
            bmp.Not();
            Assert.AreEqual(0, bmp.GetCardinality());
            Console.WriteLine("testing not:ok");
        }
        public void TestCustomSerializationStrategy()
        {
            Console.WriteLine("testing Custom serialization strategy");

            // Create a compressed bit array, and randomly assign up to 20,000 bits to it.
            var bmp = new EwahCompressedBitArray();
            var r= new Random();
            for (int i = 0; i < 23000; i++) {
                if (r.NextDouble() < 0.5) {
                    bmp.Set(i);
                }
            }

            byte[] originalDeserialized= null;
            byte[] newFormDeserialized= null;
            EwahCompressedBitArray newFormReserialized= null;
            EwahCompressedBitArray originalReserialized= null;

            // First de-serialize+ re-serialize 'normally'
            using (var ms = new MemoryStream()) {
                BinaryFormatter bf = new BinaryFormatter();
                bf.Serialize(ms, bmp);
                originalDeserialized = ms.ToArray();
                ms.Seek(0, SeekOrigin.Begin);
                originalReserialized = (EwahCompressedBitArray)bf.Deserialize(ms);
            }

            // Now de-serialize + re-serialize with the new form.
            using (var ms = new MemoryStream()) {
                EwahCompressedBitArraySerializer bf = new EwahCompressedBitArraySerializer();
                bf.Serialize(ms, bmp);
                newFormDeserialized = ms.ToArray();
                ms.Seek(0, SeekOrigin.Begin);
                newFormReserialized = (EwahCompressedBitArray)bf.Deserialize(ms);
            }

            // Assert that the new form is more compact than the original form.
            Assert.Less(newFormDeserialized.Length, originalDeserialized.Length);

            // Compare the 'normal' de-serialized + re-serialized form, against the original.
            Assert.AreEqual(bmp, originalReserialized);

            // Compare the 'new form' de-serialized + re-serialized form, against the original.
            Assert.AreEqual(bmp, newFormReserialized);

            // Compare the 'normal' de-serialized + re-serialized form, against the newly de-serialized + re-serialized form.
            Assert.AreEqual(newFormReserialized, originalReserialized);

            Console.WriteLine("testing Custom serialization strategy:ok");
        }
Beispiel #13
0
        public UniversalSubjectPosition2(SortedSet <long> allRITEIds)
        {
            CausesOfLoss = new HashSet <SymbolicValue>()
            {
                "EQ", "WS", "CS", "FL", "WT", "FR", "TR", "SH", "FF", "SL", "WI", "SU", "HA", "TO", "SW", "FZ", "IC", "SN", "WF", "TS"
            };
            ResolvedExposureTypes = new HashSet <int>(ExposureType.GetIndividualIntExposureTypes(ExposureType.EExposureType.Loss));

            AllRITEIds          = new EwahCompressedBitArray();
            OffsetForAllRITEIds = allRITEIds.First();
            foreach (long RITEId in allRITEIds)
            {
                AllRITEIds.Set((int)(RITEId - OffsetForAllRITEIds));
            }
        }
        public void TestSetGet()
        {
            Console.WriteLine("testing EWAH Set/get");
            var ewcb = new EwahCompressedBitArray();

            int[] val = { 5, 4400, 44600, 55400, 1000000 };
            for (int k = 0; k < val.Length; ++k)
            {
                ewcb.Set(val[k]);
            }
            List <int> result = ewcb.GetPositions();

            AreEqual(val, result);
            Console.WriteLine("testing EWAH Set/get:ok");
        }
 public void TayaraTest()
 {
     Console.WriteLine("Tayara test");
     for (int offset = 64; offset < (1 << 30); offset *= 2)
     {
         EwahCompressedBitArray a = new EwahCompressedBitArray();
         EwahCompressedBitArray b = new EwahCompressedBitArray();
         for (int k = 0; k < 64; ++k)
         {
             a.Set(offset + k);
             b.Set(offset + k);
         }
         Assert.AreEqual(a.And(b).Equals(a), true);
         Assert.AreEqual(a.Or(b).Equals(a), true);
     }
 }
        /**
         * Pseudo-non-deterministic test inspired by S.J.vanSchaik.
         * (Yes, non-deterministic tests are bad, but the test is actually deterministic.)
         */

        /**
         * Pseudo-non-deterministic test inspired by Federico Fissore.
         *
         * @param length the number of set bits in a bitmap
         */

        private static void ShouldSetBits(int length)
        {
            Console.WriteLine("testing shouldSetBits " + length);
            int[] bitsToSet = CreateSortedIntArrayOfBitsToSet(length, 434222);
            var   ewah      = new EwahCompressedBitArray();

            Console.WriteLine(" ... setting " + bitsToSet.Length + " values");
            foreach (int i in bitsToSet)
            {
                ewah.Set(i);
            }
            Console.WriteLine(" ... verifying " + bitsToSet.Length + " values");
            AreEqual(ewah, bitsToSet);
            Console.WriteLine(" ... checking GetCardinality");
            Assert.AreEqual(bitsToSet.Length, ewah.GetCardinality());
        }
        public void SsiYanKaiTest()
        {
            Console.WriteLine("testing SsiYanKaiTest");
            EwahCompressedBitArray a          = EwahCompressedBitArray.BitmapOf(39935, 39936, 39937, 39938, 39939, 39940, 39941, 39942, 39943, 39944, 39945, 39946, 39947, 39948, 39949, 39950, 39951, 39952, 39953, 39954, 39955, 39956, 39957, 39958, 39959, 39960, 39961, 39962, 39963, 39964, 39965, 39966, 39967, 39968, 39969, 39970, 39971, 39972, 39973, 39974, 39975, 39976, 39977, 39978, 39979, 39980, 39981, 39982, 39983, 39984, 39985, 39986, 39987, 39988, 39989, 39990, 39991, 39992, 39993, 39994, 39995, 39996, 39997, 39998, 39999, 40000, 40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009, 40010, 40011, 40012, 40013, 40014, 40015, 40016, 40017, 40018, 40019, 40020, 40021, 40022, 40023, 40024, 40025, 40026, 40027, 40028, 40029, 40030, 40031, 40032, 40033, 40034, 40035, 40036, 40037, 40038, 40039, 40040, 40041, 40042, 40043, 40044, 40045, 40046, 40047, 40048, 40049, 40050, 40051, 40052, 40053, 40054, 40055, 40056, 40057, 40058, 40059, 40060, 40061, 40062, 40063, 40064, 40065, 40066, 40067, 40068, 40069, 40070, 40071, 40072, 40073, 40074, 40075, 40076, 40077, 40078, 40079, 40080, 40081, 40082, 40083, 40084, 40085, 40086, 40087, 40088, 40089, 40090, 40091, 40092, 40093, 40094, 40095, 40096, 40097, 40098, 40099, 40100);
            EwahCompressedBitArray b          = EwahCompressedBitArray.BitmapOf(39935, 39936, 39937, 39938, 39939, 39940, 39941, 39942, 39943, 39944, 39945, 39946, 39947, 39948, 39949, 39950, 39951, 39952, 39953, 39954, 39955, 39956, 39957, 39958, 39959, 39960, 39961, 39962, 39963, 39964, 39965, 39966, 39967, 39968, 39969, 39970, 39971, 39972, 39973, 39974, 39975, 39976, 39977, 39978, 39979, 39980, 39981, 39982, 39983, 39984, 39985, 39986, 39987, 39988, 39989, 39990, 39991, 39992, 39993, 39994, 39995, 39996, 39997, 39998, 39999, 270000);
            HashSet <int>          aPositions = new HashSet <int>(a.GetPositions());
            int intersection                  = 0;
            EwahCompressedBitArray inter      = new EwahCompressedBitArray();
            HashSet <int>          bPositions = new HashSet <int>(b.GetPositions());

            foreach (int integer in bPositions)
            {
                if (aPositions.Contains(integer))
                {
                    inter.Set(integer);
                    ++intersection;
                }
            }
            EwahCompressedBitArray and2 = a.And(b);
            List <int>             l1   = inter.GetPositions();
            List <int>             l2   = and2.GetPositions();
            var ok = true;

            if (l1.Count != l2.Count)
            {
                Console.WriteLine("cardinality differs = " + l1.Count + " " + l2.Count);
                ok = false;
            }
            for (int k = 0; k < l1.Count; ++k)
            {
                if (l1[k] != l2[k])
                {
                    Console.WriteLine("differ at " + k + " = " + l1[k] + " " + l2[k]);
                    ok = false;
                }
            }
            Assert.IsTrue(ok);
            Assert.AreEqual(true, and2.Equals(inter));
            Assert.AreEqual(inter.GetHashCode(), and2.GetHashCode());
            Assert.AreEqual(intersection, and2.GetCardinality());
        }
        public void testDebugSetSizeInBitsTest()
        {
            Console.WriteLine("testing DebugSetSizeInBits");
            EwahCompressedBitArray b = new EwahCompressedBitArray();

            b.Set(4);

            b.SetSizeInBits(6, true);

            List <int> positions = b.GetPositions();

            Assert.AreEqual(2, positions.Count);
            Assert.AreEqual(4, positions[0]);
            Assert.AreEqual(5, positions[1]);

            IEnumerator <int> iterator = ((IEnumerable <int>)b).GetEnumerator();

            Assert.AreEqual(true, iterator.MoveNext());
            Assert.AreEqual(4, iterator.Current);
            Assert.AreEqual(true, iterator.MoveNext());
            Assert.AreEqual(5, iterator.Current);
            Assert.AreEqual(false, iterator.MoveNext());
        }
        public void VanSchaikTest()
        {
            Console.WriteLine("testing vanSchaikTest (this takes some time)");
            const int    totalNumBits = 32768;
            const double odds         = 0.9;
            var          rand         = new Random(323232323);

            for (int t = 0; t < 100; t++)
            {
                int numBitsSet = 0;
                var cBitMap    = new EwahCompressedBitArray();
                for (int i = 0; i < totalNumBits; i++)
                {
                    if (rand.NextDouble() < odds)
                    {
                        cBitMap.Set(i);
                        numBitsSet++;
                    }
                }
                Assert.AreEqual(cBitMap.GetCardinality(), numBitsSet);
            }
            Console.WriteLine("testing vanSchaikTest:ok");
        }
        public void TestExternalization()
        {
            Console.WriteLine("testing EWAH externalization");
            var ewcb = new EwahCompressedBitArray();

            int[] val = { 5, 4400, 44600, 55400, 1000000 };
            foreach (int t in val)
            {
                ewcb.Set(t);
            }

            var bos = new MemoryStream();
            var bf  = new BinaryFormatter();

            bf.Serialize(bos, ewcb);
            bos.Position = 0;

            ewcb = (EwahCompressedBitArray)bf.Deserialize(bos);

            List <int> result = ewcb.GetPositions();

            AreEqual(val, result);
            Console.WriteLine("testing EWAH externalization:ok");
        }
        public void TestCloneEwahCompressedBitArray()
        {
            Console.WriteLine("testing EWAH clone");
            EwahCompressedBitArray a = new EwahCompressedBitArray();

            a.Set(410018);
            a.Set(410019);
            a.Set(410020);
            a.Set(410021);
            a.Set(410022);
            a.Set(410023);

            EwahCompressedBitArray b = (EwahCompressedBitArray)a.Clone();

            a.SetSizeInBits(487123, false);
            b.SetSizeInBits(487123, false);

            Assert.AreEqual(a, b);
        }
        public void TestEwahCompressedBitArray()
        {
            Console.WriteLine("testing EWAH (basic)");
            const long zero       = 0;
            const long specialval = 1L | (1L << 4) | (1L << 63);
            const long notzero    = ~zero;
            var        myarray1   = new EwahCompressedBitArray
            {
                zero, zero, zero, specialval, specialval, notzero, zero
            };

            Assert.AreEqual(myarray1.GetPositions().Count, 6 + 64);
            var myarray2 = new EwahCompressedBitArray();

            myarray2.Add(zero);
            myarray2.Add(specialval);
            myarray2.Add(specialval);
            myarray2.Add(notzero);
            myarray2.Add(zero);
            myarray2.Add(zero);
            myarray2.Add(zero);
            Assert.AreEqual(myarray2.GetPositions().Count, 6 + 64);
            List <int> data1     = myarray1.GetPositions();
            List <int> data2     = myarray2.GetPositions();
            var        logicalor = new List <int>();

            {
                var tmp = new HashSet <int>();
                tmp.AddRange(data1);
                tmp.AddRange(data2);
                logicalor.AddRange(tmp);
            }
            logicalor.Sort();
            var logicaland = new List <int>();

            logicaland.AddRange(data1);
            logicaland.Retain(data2);
            logicaland.Sort();
            EwahCompressedBitArray arrayand = myarray1.And(myarray2);

            AreEqual(arrayand.GetPositions(), logicaland);
            EwahCompressedBitArray arrayor = myarray1.Or(myarray2);

            AreEqual(arrayor.GetPositions(), logicalor);
            EwahCompressedBitArray arrayandbis = myarray2.And(myarray1);

            AreEqual(arrayandbis.GetPositions(), logicaland);
            EwahCompressedBitArray arrayorbis = myarray2.Or(myarray1);

            AreEqual(arrayorbis.GetPositions(), logicalor);
            var x = new EwahCompressedBitArray();

            foreach (int i in myarray1.GetPositions())
            {
                x.Set(i);
            }
            AreEqual(x.GetPositions(), myarray1.GetPositions());
            x = new EwahCompressedBitArray();
            foreach (int i in myarray2.GetPositions())
            {
                x.Set(i);
            }
            AreEqual(x.GetPositions(), myarray2.GetPositions());
            x = new EwahCompressedBitArray();
            foreach (int pos in myarray1)
            {
                x.Set(pos);
            }
            AreEqual(x.GetPositions(), myarray1.GetPositions());
            x = new EwahCompressedBitArray();
            foreach (int pos in myarray2)
            {
                x.Set(pos);
            }
            AreEqual(x.GetPositions(), myarray2.GetPositions());
            Console.WriteLine("testing EWAH (basic):ok");
        }
Beispiel #23
0
 public bool Set(int i)
 {
     return(_bitmap.Set(i));
 }
        /**
         * a non-deterministic test proposed by Marc Polizzi.
         *
         * @param maxlength the maximum uncompressed size of the bitmap
         */

        public static void PolizziTest(int maxlength)
        {
            Console.WriteLine("Polizzi test with max length = " + maxlength);
            for (int k = 0; k < 10000; k += 77)
            {
                var rnd          = new Random();
                var ewahBitmap1  = new EwahCompressedBitArray();
                var clrBitArray1 = new BitArray(10000);
                var ewahBitmap2  = new EwahCompressedBitArray();
                var clrBitArray2 = new BitArray(10000);
                int len          = rnd.Next(maxlength);
                for (int pos = 0; pos < len; pos++)
                {
                    // random *** number of bits set ***
                    if (rnd.Next(7) == 0)
                    {
                        // random *** increasing *** values
                        ewahBitmap1.Set(pos);
                        clrBitArray1.Set(pos, true);
                    }
                    if (rnd.Next(11) == 0)
                    {
                        // random *** increasing *** values
                        ewahBitmap2.Set(pos);
                        clrBitArray2.Set(pos, true);
                    }
                }
                assertEquals(clrBitArray1, ewahBitmap1);
                assertEquals(clrBitArray2, ewahBitmap2);
                // XOR
                {
                    EwahCompressedBitArray xorEwahBitmap = ewahBitmap1.Xor(ewahBitmap2);
                    var xorclrBitArray = (BitArray)clrBitArray1.Clone();
                    xorclrBitArray.Xor(clrBitArray2);
                    assertEquals(xorclrBitArray, xorEwahBitmap);
                }
                // AND
                {
                    EwahCompressedBitArray andEwahBitmap = ewahBitmap1.And(ewahBitmap2);
                    var andclrBitArray = (BitArray)clrBitArray1.Clone();
                    andclrBitArray.And(clrBitArray2);
                    assertEquals(andclrBitArray, andEwahBitmap);
                }
                // AND
                {
                    EwahCompressedBitArray andEwahBitmap = ewahBitmap2.And(ewahBitmap1);
                    var andclrBitArray = (BitArray)clrBitArray1.Clone();
                    andclrBitArray.And(clrBitArray2);
                    assertEquals(andclrBitArray, andEwahBitmap);
                }
                // AND NOT
                {
                    EwahCompressedBitArray andNotEwahBitmap = ewahBitmap1
                                                              .AndNot(ewahBitmap2);
                    var andNotclrBitArray = (BitArray)clrBitArray1.Clone();
                    andNotclrBitArray.AndNot(clrBitArray2);
                    assertEquals(andNotclrBitArray, andNotEwahBitmap);
                }
                // AND NOT
                {
                    EwahCompressedBitArray andNotEwahBitmap = ewahBitmap2
                                                              .AndNot(ewahBitmap1);
                    var andNotclrBitArray = (BitArray)clrBitArray2.Clone();
                    andNotclrBitArray.AndNot(clrBitArray1);
                    assertEquals(andNotclrBitArray, andNotEwahBitmap);
                }
                // OR
                {
                    EwahCompressedBitArray orEwahBitmap = ewahBitmap1.Or(ewahBitmap2);
                    var orclrBitArray = (BitArray)clrBitArray1.Clone();
                    orclrBitArray.Or(clrBitArray2);
                    assertEquals(orclrBitArray, orEwahBitmap);
                }
                // OR
                {
                    EwahCompressedBitArray orEwahBitmap = ewahBitmap2.Or(ewahBitmap1);
                    var orclrBitArray = (BitArray)clrBitArray1.Clone();
                    orclrBitArray.Or(clrBitArray2);
                    assertEquals(orclrBitArray, orEwahBitmap);
                }
            }
        }