use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class DoubleMathTest method testRoundNaNToLongAlwaysFails.
// DoubleMath.roundToLong(double, RoundingMode)
@GwtIncompatible
public void testRoundNaNToLongAlwaysFails() {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
try {
DoubleMath.roundToLong(Double.NaN, mode);
fail("Expected ArithmeticException");
} catch (ArithmeticException expected) {
}
}
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class DoubleMathTest method testRoundIntegralDoubleToBigInteger.
// DoubleMath.roundToBigInteger(double, RoundingMode)
@GwtIncompatible
public void testRoundIntegralDoubleToBigInteger() {
for (double d : INTEGRAL_DOUBLE_CANDIDATES) {
for (RoundingMode mode : ALL_SAFE_ROUNDING_MODES) {
BigDecimal expected = new BigDecimal(d).setScale(0, mode);
assertEquals(expected.toBigInteger(), DoubleMath.roundToBigInteger(d, mode));
}
}
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class IntMathTest method testLog10NegativeAlwaysThrows.
// log10
@GwtIncompatible
public void testLog10NegativeAlwaysThrows() {
for (int x : NEGATIVE_INTEGER_CANDIDATES) {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
try {
IntMath.log10(x, mode);
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
}
}
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class LongMathTest method testConstantsHalfPowersOf10.
// TODO
@GwtIncompatible
public void testConstantsHalfPowersOf10() {
for (int i = 0; i < LongMath.halfPowersOf10.length; i++) {
assertEquals(BigIntegerMath.sqrt(BigInteger.TEN.pow(2 * i + 1), FLOOR), BigInteger.valueOf(LongMath.halfPowersOf10[i]));
}
BigInteger nextBigger = BigIntegerMath.sqrt(BigInteger.TEN.pow(2 * LongMath.halfPowersOf10.length + 1), FLOOR);
assertTrue(nextBigger.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0);
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class LongMathTest method testSqrtNegativeAlwaysThrows.
// TODO
@GwtIncompatible
public void testSqrtNegativeAlwaysThrows() {
for (long x : NEGATIVE_LONG_CANDIDATES) {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
try {
LongMath.sqrt(x, mode);
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
}
}
}
Aggregations