public void TestSizeInBits1() { Console.WriteLine("testing TestSizeInBits1"); EwahCompressedBitArray bitmap = new EwahCompressedBitArray(); bitmap.SetSizeInBits(1, false); Assert.AreEqual(1, bitmap.SizeInBits); bitmap.Not(); Assert.AreEqual(1, bitmap.GetCardinality()); }
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 TestMassiveAndNot() { Console.WriteLine("testing massive and not"); int N = 1024; var ewah = new EwahCompressedBitArray[N]; for (int k = 0; k < ewah.Length; ++k) { ewah[k] = new EwahCompressedBitArray(); } for (int k = 0; k < 30000; ++k) { ewah[(k + 2 * k * k) % ewah.Length].Set(k); } EwahCompressedBitArray answer = ewah[0]; EwahCompressedBitArray answer2 = ewah[0]; ; for (int k = 1; k < ewah.Length; ++k) { answer = answer.AndNot(ewah[k]); EwahCompressedBitArray copy = null; try { copy = (EwahCompressedBitArray)ewah[k].Clone(); copy.Not(); answer2.And(copy); assertEqualsPositions(answer.GetPositions(), answer2.GetPositions()); } catch (InvalidOperationException e) { Console.Error.WriteLine(e.StackTrace); } } Console.WriteLine("testing massive and not:ok"); }