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