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