public void AndNotBigInteger() { foreach (BigInteger[] element in booleanPairs) { BigInteger i1 = element[0], i2 = element[1]; BigInteger res = BigMath.AndNot(i1, i2); int len = System.Math.Max(i1.BitLength, i2.BitLength) + 66; for (int i = 0; i < len; i++) { Assert.True((BigInteger.TestBit(i1, i) && !BigInteger.TestBit(i2, i)) == BigInteger.TestBit(res, i), "andNot"); } // asymmetrical i1 = element[1]; i2 = element[0]; res = BigMath.AndNot(i1, i2); for (int i = 0; i < len; i++) { Assert.True((BigInteger.TestBit(i1, i) && !BigInteger.TestBit(i2, i)) == BigInteger.TestBit(res, i), "andNot reversed"); } } Assert.Throws <NullReferenceException>(() => BigMath.AndNot(BigInteger.Zero, null)); BigInteger bi = new BigInteger(0, new byte[] { }); Assert.Equal(BigInteger.Zero, BigMath.AndNot(bi, BigInteger.Zero)); }