public void TestWAHBitArray4()
        {
            var b     = new WAHBitArray();
            int count = 25;

            for (int i = 0; i < 5; i++)
            {
                b.Set(i, true);
            }
            for (int i = 5; i < count + 5; i++)
            {
                b.Set(i, false);
            }
            for (int i = 30; i < 64; i++)
            {
                b.Set(i, i != 35);
            }
            for (int i = 64; i < 100; i++)
            {
                b.Set(i, true);
            }
            var expected = b.GetBitIndexes().ToArray();
            var b2       = new WAHBitArray(WAHBitArray.TYPE.Compressed_WAH, b.GetCompressed());
            var actual   = b2.GetBitIndexes().ToArray();

            expected.Should(Be.EqualTo(actual));
        }
Exemple #2
0
        public static void WAH_test()
        {
            int count = 500;

            for (int i = 0; i < 1000; i++)
            {
                Console.Write(".");
                if (i % 80 == 0)
                {
                    Console.WriteLine();
                }
                WAHBitArray ba = new WAHBitArray();
                for (int j = 0; j < count; j++)
                {
                    ba.Set(i * count + j, true);
                }

                WAHBitArray.TYPE type;
                var bits = ba.GetCompressed(out type);

                var ba2 = new WAHBitArray(type, bits);

                var  res = ba2.Xor(ba);
                long c   = res.CountOnes();
                Assert.AreEqual(0, c);
            }

            //Random r = new Random();
            //WAHBitArray b = new WAHBitArray();
            //for (int i = 0; i < 100000; i++)
            //{
            //    b.Set(
            //}
        }
        public void TestWAHBitArray1()
        {
            var b     = new WAHBitArray();
            int count = 31;

            for (int i = 0; i < count; i++)
            {
                b.Set(i, true);
            }
            var expected = b.GetBitIndexes().ToArray();
            var b2       = new WAHBitArray(WAHBitArray.TYPE.Compressed_WAH, b.GetCompressed());
            var actual   = b2.GetBitIndexes().ToArray();

            expected.Should(Be.EqualTo(actual));
        }