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