use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class LongMathTest method testIsPrimeOnRandomComposites.
// isPrime is GWT-incompatible
@GwtIncompatible
public void testIsPrimeOnRandomComposites() {
Random rand = new Random(1);
for (int bits = 5; bits < 32; bits++) {
for (int i = 0; i < 100; i++) {
long p = BigInteger.probablePrime(bits, rand).longValue();
long q = BigInteger.probablePrime(bits, rand).longValue();
assertFalse(LongMath.isPrime(p * q));
}
}
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class LongMathTest method testCheckedSubtract.
// TODO
@GwtIncompatible
// slow
@AndroidIncompatible
public void testCheckedSubtract() {
for (long a : ALL_LONG_CANDIDATES) {
for (long b : ALL_LONG_CANDIDATES) {
BigInteger expectedResult = valueOf(a).subtract(valueOf(b));
boolean expectedSuccess = fitsInLong(expectedResult);
try {
assertEquals(a - b, LongMath.checkedSubtract(a, b));
assertTrue(expectedSuccess);
} catch (ArithmeticException e) {
if (expectedSuccess) {
failFormat("expected checkedSubtract(%s, %s) = %s; got ArithmeticException", a, b, expectedResult);
}
}
}
}
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class LongMathTest method testDivByZeroAlwaysFails.
// TODO
@GwtIncompatible
public void testDivByZeroAlwaysFails() {
for (long p : ALL_LONG_CANDIDATES) {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
try {
LongMath.divide(p, 0L, mode);
fail("Expected ArithmeticException");
} catch (ArithmeticException expected) {
}
}
}
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class UnsignedLongsTest method testDivideRemainderEuclideanProperty.
// Too slow in GWT (~3min fully optimized)
@GwtIncompatible
public void testDivideRemainderEuclideanProperty() {
// Use a seed so that the test is deterministic:
Random r = new Random(0L);
for (int i = 0; i < 1000000; i++) {
long dividend = r.nextLong();
long divisor = r.nextLong();
// Test that the Euclidean property is preserved:
assertEquals(0, dividend - (divisor * UnsignedLongs.divide(dividend, divisor) + UnsignedLongs.remainder(dividend, divisor)));
}
}
use of com.google.common.annotations.GwtIncompatible in project guava by google.
the class IntsTest method testStringConverter_nullPointerTester.
// NullPointerTester
@GwtIncompatible
public void testStringConverter_nullPointerTester() throws Exception {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicInstanceMethods(Ints.stringConverter());
}
Aggregations