use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class BigIntegerMathTest method testLog10Exact.
// Relies on the correctness of log10(BigInteger, FLOOR).
// TODO
@GwtIncompatible
public void testLog10Exact() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
int logFloor = BigIntegerMath.log10(x, FLOOR);
boolean expectSuccess = TEN.pow(logFloor).equals(x);
try {
assertEquals(logFloor, BigIntegerMath.log10(x, UNNECESSARY));
assertTrue(expectSuccess);
} catch (ArithmeticException e) {
assertFalse(expectSuccess);
}
}
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class BigIntegerMathTest method testLog10Floor.
// TODO
@GwtIncompatible
public void testLog10Floor() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
for (RoundingMode mode : asList(FLOOR, DOWN)) {
int result = BigIntegerMath.log10(x, mode);
assertTrue(TEN.pow(result).compareTo(x) <= 0);
assertTrue(TEN.pow(result + 1).compareTo(x) > 0);
}
}
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class BigIntegerMathTest method testDivNonZeroExact.
// TODO
@GwtIncompatible
// slow
@AndroidIncompatible
public void testDivNonZeroExact() {
boolean isAndroid = System.getProperty("java.runtime.name").contains("Android");
for (BigInteger p : NONZERO_BIGINTEGER_CANDIDATES) {
for (BigInteger q : NONZERO_BIGINTEGER_CANDIDATES) {
if (isAndroid && p.equals(BAD_FOR_ANDROID_P) && q.equals(BAD_FOR_ANDROID_Q)) {
// https://code.google.com/p/android/issues/detail?id=196555
continue;
}
if (isAndroid && p.equals(BAD_FOR_GINGERBREAD_P) && q.equals(BAD_FOR_GINGERBREAD_Q)) {
// Works fine under Marshmallow, so I haven't filed a bug.
continue;
}
boolean dividesEvenly = p.remainder(q).equals(ZERO);
try {
BigInteger quotient = BigIntegerMath.divide(p, q, UNNECESSARY);
BigInteger undone = quotient.multiply(q);
if (!p.equals(undone)) {
failFormat("expected %s.multiply(%s) = %s; got %s", quotient, q, p, undone);
}
assertTrue(dividesEvenly);
} catch (ArithmeticException e) {
assertFalse(dividesEvenly);
}
}
}
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class BigIntegerMathTest method testRoundToDouble_minDoubleMinusOne.
@GwtIncompatible
public void testRoundToDouble_minDoubleMinusOne() {
BigInteger minDoubleAsBI = DoubleMath.roundToBigInteger(-Double.MAX_VALUE, UNNECESSARY).subtract(BigInteger.ONE);
new RoundToDoubleTester(minDoubleAsBI).setExpectation(-Double.MAX_VALUE, DOWN, CEILING, HALF_EVEN, HALF_UP, HALF_DOWN).setExpectation(Double.NEGATIVE_INFINITY, UP, FLOOR).roundUnnecessaryShouldThrow().test();
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class BigIntegerMathTest method testLog10ZeroAlwaysThrows.
// TODO
@GwtIncompatible
public void testLog10ZeroAlwaysThrows() {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
try {
BigIntegerMath.log10(ZERO, mode);
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
}
}
Aggregations