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