Rename powFractionTestCases to powTestCases
diff --git a/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/BigFractionTest.java b/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/BigFractionTest.java
index fe504d3..3a24a20 100644
--- a/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/BigFractionTest.java
+++ b/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/BigFractionTest.java
@@ -88,14 +88,6 @@
() -> BigFraction.from(2.0 * Integer.MAX_VALUE, 1.0e-5, 100000));
}
- @Test
- public void testGoldenRatio() {
- // the golden ratio is notoriously a difficult number for continuous fraction
- Assertions.assertThrows(FractionException.class,
- () -> BigFraction.from((1 + Math.sqrt(5)) / 2, 1.0e-12, 25)
- );
- }
-
// MATH-179
@Test
public void testDoubleConstructor() throws Exception {
@@ -142,11 +134,19 @@
}
}
+ @Test
+ public void testDoubleConstructorGoldenRatioThrows() {
+ // the golden ratio is notoriously a difficult number for continuous fraction
+ Assertions.assertThrows(FractionException.class,
+ () -> BigFraction.from((1 + Math.sqrt(5)) / 2, 1.0e-12, 25)
+ );
+ }
+
// MATH-1029
@Test
public void testPositiveValueOverflow() {
Assertions.assertThrows(ArithmeticException.class,
- () -> assertFraction((long) 1e10, 1, BigFraction.from(1e10, 1000))
+ () -> BigFraction.from(1e10, 1000)
);
}
@@ -543,7 +543,7 @@
@Test
public void testPow() {
- for (CommonTestCases.BinaryIntOperatorTestCase testCase : CommonTestCases.powFractionTestCases()) {
+ for (CommonTestCases.BinaryIntOperatorTestCase testCase : CommonTestCases.powTestCases()) {
BigFraction f1 = BigFraction.of(testCase.firstOperandNumerator, testCase.firstOperandDenominator);
int exponent = testCase.secondOperand;
assertFraction(testCase.expectedNumerator, testCase.expectedDenominator, f1.pow(exponent));
diff --git a/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/CommonTestCases.java b/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/CommonTestCases.java
index efebc48..336add7 100644
--- a/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/CommonTestCases.java
+++ b/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/CommonTestCases.java
@@ -52,6 +52,8 @@
*/
private static final List<UnaryOperatorTestCase> negateTestCasesList;
+ // TODO addIntTestCasesList
+
/**
* See {@link #addFractionTestCases()}
*/
@@ -73,9 +75,9 @@
private static final List<BinaryOperatorTestCase> subtractFractionTestCasesList;
/**
- * See {@link #powFractionTestCases()}
+ * See {@link #powTestCases()}
*/
- private static final List<BinaryIntOperatorTestCase> powFractionTestCasesList;
+ private static final List<BinaryIntOperatorTestCase> powTestCasesList;
static {
numDenConstructorTestCasesList = collectNumDenConstructorTestCases();
@@ -87,7 +89,7 @@
divideByFractionTestCasesList = collectDivideByFractionTestCases();
multiplyByFractionTestCasesList = collectMultiplyByFractionTestCases();
subtractFractionTestCasesList = collectSubtractFractionTestCases();
- powFractionTestCasesList = collectPowFractionTestCases();
+ powTestCasesList = collectPowTestCases();
}
private CommonTestCases() {}
@@ -382,10 +384,10 @@
/**
* Defines test cases as described in
- * {@link #powFractionTestCases()} and collects them into a {@code List}.
+ * {@link #powTestCases()} and collects them into a {@code List}.
* @return a list of test cases as described above
*/
- private static List<BinaryIntOperatorTestCase> collectPowFractionTestCases() {
+ private static List<BinaryIntOperatorTestCase> collectPowTestCases() {
List<BinaryIntOperatorTestCase> testCases = new ArrayList<>();
testCases.add(new BinaryIntOperatorTestCase(3, 7, 0, 1, 1));
@@ -537,8 +539,8 @@
*
* @return a list of test cases as described above
*/
- static List<BinaryIntOperatorTestCase> powFractionTestCases() {
- return Collections.unmodifiableList(powFractionTestCasesList);
+ static List<BinaryIntOperatorTestCase> powTestCases() {
+ return Collections.unmodifiableList(powTestCasesList);
}
// CHECKSTYLE: stop VisibilityModifier
diff --git a/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/FractionTest.java b/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/FractionTest.java
index 584c28f..fccf015 100644
--- a/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/FractionTest.java
+++ b/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/FractionTest.java
@@ -65,14 +65,6 @@
Assertions.assertThrows(ArithmeticException.class, () -> Fraction.of(1, 0));
}
- @Test
- public void testGoldenRatio() {
- // the golden ratio is notoriously a difficult number for continuous fraction
- Assertions.assertThrows(ArithmeticException.class,
- () -> Fraction.from((1 + Math.sqrt(5)) / 2, 1.0e-12, 25)
- );
- }
-
// MATH-179
@Test
public void testDoubleConstructor() throws Exception {
@@ -114,6 +106,14 @@
}
@Test
+ public void testDoubleConstructorGoldenRatioThrows() {
+ // the golden ratio is notoriously a difficult number for continuous fraction
+ Assertions.assertThrows(ArithmeticException.class,
+ () -> Fraction.from((1 + Math.sqrt(5)) / 2, 1.0e-12, 25)
+ );
+ }
+
+ @Test
public void testIntegerOverflow() {
checkIntegerOverflow(0.75000000001455192);
checkIntegerOverflow(1.0e10);
@@ -396,7 +396,7 @@
@Test
public void testPow() {
- for (CommonTestCases.BinaryIntOperatorTestCase testCase : CommonTestCases.powFractionTestCases()) {
+ for (CommonTestCases.BinaryIntOperatorTestCase testCase : CommonTestCases.powTestCases()) {
Fraction f1 = Fraction.of(testCase.firstOperandNumerator, testCase.firstOperandDenominator);
int exponent = testCase.secondOperand;
assertFraction(testCase.expectedNumerator, testCase.expectedDenominator, f1.pow(exponent));