public void testCeilingPowerOfTwoZero() { try { BigIntegerMath.ceilingPowerOfTwo(BigInteger.ZERO); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } }
public void testCeilingPowerOfTwo() { for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) { BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x); assertTrue(BigIntegerMath.isPowerOfTwo(result)); assertTrue(result.compareTo(x) >= 0); assertTrue(result.compareTo(x.add(x)) < 0); } }
public void testCeilingPowerOfTwoNegative() { for (BigInteger x : NEGATIVE_BIGINTEGER_CANDIDATES) { try { BigIntegerMath.ceilingPowerOfTwo(x); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } } }