This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 47c5e40c162f73a5cab398b38d79f82ce1ac088b Author: Gary Gregory <[email protected]> AuthorDate: Sun Nov 15 07:55:54 2026 -0500 Expand Fraction comparison boundary coverage Add 10,816 parameterized cases checking ordering against exact BigInteger cross-products and verifying antisymmetry, including equal values with different representations. Assisted-By: OpenAI Codex --- .../java/org/apache/commons/lang3/math/FractionTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/java/org/apache/commons/lang3/math/FractionTest.java b/src/test/java/org/apache/commons/lang3/math/FractionTest.java index de786cd3f..7279cee7f 100644 --- a/src/test/java/org/apache/commons/lang3/math/FractionTest.java +++ b/src/test/java/org/apache/commons/lang3/math/FractionTest.java @@ -347,6 +347,18 @@ void testCompareTo() { } + @ParameterizedTest(name = "[{index}] compare {0} to {1}") + @MethodSource("arithmeticBoundaryValues") + void testCompareToBoundaryValues(final Fraction left, final Fraction right) { + // Compare exact cross-products to check ordering without fixed-width overflow. + final BigInteger leftProduct = BigInteger.valueOf(left.getNumerator()).multiply(BigInteger.valueOf(right.getDenominator())); + final BigInteger rightProduct = BigInteger.valueOf(right.getNumerator()).multiply(BigInteger.valueOf(left.getDenominator())); + final int expected = leftProduct.compareTo(rightProduct); + final int actual = Integer.signum(left.compareTo(right)); + assertEquals(expected, actual); + assertEquals(-actual, Integer.signum(right.compareTo(left))); + } + @Test void testConstants() { assertEquals(0, Fraction.ZERO.getNumerator());
