Skip to content

Commit

Permalink
Enable additional com.google.common.math tests on J2kt
Browse files Browse the repository at this point in the history
Some had only been disabled for J2kt to mirror existing GwtIncompatible annotations. Others are now working due to improvements in J2kt Native's JRE emulation since the tests were initially enabled.

RELNOTES=n/a
PiperOrigin-RevId: 605014151
  • Loading branch information
martinkretzschmar authored and Google Java Core Libraries committed Feb 7, 2024
1 parent 1bd273f commit 7f4bbf7
Show file tree
Hide file tree
Showing 18 changed files with 10 additions and 378 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ public void testFloorPowerOfTwoZero() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testConstantSqrt2PrecomputedBits() {
assertEquals(
Expand Down Expand Up @@ -217,7 +216,6 @@ public void testLog2HalfEven() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testLog10ZeroAlwaysThrows() {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
Expand All @@ -229,7 +227,6 @@ public void testLog10ZeroAlwaysThrows() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testLog10NegativeAlwaysThrows() {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
Expand All @@ -241,7 +238,6 @@ public void testLog10NegativeAlwaysThrows() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testLog10Floor() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -253,7 +249,6 @@ public void testLog10Floor() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testLog10Ceiling() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -266,7 +261,6 @@ public void testLog10Ceiling() {
}

// Relies on the correctness of log10(BigInteger, FLOOR).
@J2ktIncompatible
@GwtIncompatible // TODO
public void testLog10Exact() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -281,7 +275,6 @@ public void testLog10Exact() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testLog10HalfUp() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -294,7 +287,6 @@ public void testLog10HalfUp() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testLog10HalfDown() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -308,7 +300,6 @@ public void testLog10HalfDown() {
}

// Relies on the correctness of log10(BigInteger, {HALF_UP,HALF_DOWN}).
@J2ktIncompatible
@GwtIncompatible // TODO
public void testLog10HalfEven() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -320,7 +311,6 @@ public void testLog10HalfEven() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testLog10TrivialOnPowerOf10() {
BigInteger x = BigInteger.TEN.pow(100);
Expand All @@ -329,15 +319,13 @@ public void testLog10TrivialOnPowerOf10() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testSqrtZeroAlwaysZero() {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
assertEquals(ZERO, BigIntegerMath.sqrt(ZERO, mode));
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testSqrtNegativeAlwaysThrows() {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
Expand All @@ -349,7 +337,6 @@ public void testSqrtNegativeAlwaysThrows() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testSqrtFloor() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -362,7 +349,6 @@ public void testSqrtFloor() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testSqrtCeiling() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -376,7 +362,6 @@ public void testSqrtCeiling() {
}

// Relies on the correctness of sqrt(BigInteger, FLOOR).
@J2ktIncompatible
@GwtIncompatible // TODO
public void testSqrtExact() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -392,7 +377,6 @@ public void testSqrtExact() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testSqrtHalfUp() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -409,7 +393,6 @@ public void testSqrtHalfUp() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testSqrtHalfDown() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -427,7 +410,6 @@ public void testSqrtHalfDown() {
}

// Relies on the correctness of sqrt(BigInteger, {HALF_UP,HALF_DOWN}).
@J2ktIncompatible
@GwtIncompatible // TODO
public void testSqrtHalfEven() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
Expand All @@ -439,7 +421,6 @@ public void testSqrtHalfEven() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
@AndroidIncompatible // slow
public void testDivNonZero() {
Expand All @@ -460,11 +441,11 @@ public void testDivNonZero() {
private static final BigInteger BAD_FOR_GINGERBREAD_P = new BigInteger("-9223372036854775808");
private static final BigInteger BAD_FOR_GINGERBREAD_Q = new BigInteger("-4294967296");

@J2ktIncompatible
@GwtIncompatible // TODO
@AndroidIncompatible // slow
public void testDivNonZeroExact() {
boolean isAndroid = System.getProperty("java.runtime.name").contains("Android");
String runtimeName = System.getProperty("java.runtime.name");
boolean isAndroid = runtimeName != null && runtimeName.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)) {
Expand Down Expand Up @@ -492,7 +473,6 @@ public void testDivNonZeroExact() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testZeroDivIsAlwaysZero() {
for (BigInteger q : NONZERO_BIGINTEGER_CANDIDATES) {
Expand All @@ -502,7 +482,6 @@ public void testZeroDivIsAlwaysZero() {
}
}

@J2ktIncompatible
@GwtIncompatible // TODO
public void testDivByZeroAlwaysFails() {
for (BigInteger p : ALL_BIGINTEGER_CANDIDATES) {
Expand Down Expand Up @@ -540,7 +519,6 @@ public void testBinomialSmall() {
runBinomialTest(0, 30);
}

@J2ktIncompatible
@GwtIncompatible // too slow
public void testBinomialLarge() {
runBinomialTest(31, 100);
Expand Down Expand Up @@ -575,7 +553,7 @@ public void testBinomialOutside() {
}

@J2ktIncompatible
@GwtIncompatible
@GwtIncompatible // EnumSet.complementOf
private static final class RoundToDoubleTester {
private final BigInteger input;
private final Map<RoundingMode, Double> expectedValues = new EnumMap<>(RoundingMode.class);
Expand Down Expand Up @@ -819,7 +797,6 @@ public void testNullPointers() {
tester.testAllPublicStaticMethods(BigIntegerMath.class);
}

@J2ktIncompatible
@GwtIncompatible // String.format
private static void failFormat(String template, Object... args) {
fail(String.format(template, args));
Expand Down
Loading

0 comments on commit 7f4bbf7

Please sign in to comment.