Beispiel #1
0
 public void testFloorPowerOfTwoZero() {
   try {
     BigIntegerMath.floorPowerOfTwo(BigInteger.ZERO);
     fail("Expected IllegalArgumentException");
   } catch (IllegalArgumentException expected) {
   }
 }
Beispiel #2
0
 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);
   }
 }
Beispiel #3
0
 public void testFloorPowerOfTwoNegative() {
   for (BigInteger x : NEGATIVE_BIGINTEGER_CANDIDATES) {
     try {
       BigIntegerMath.floorPowerOfTwo(x);
       fail("Expected IllegalArgumentException");
     } catch (IllegalArgumentException expected) {
     }
   }
 }