You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2020/04/05 21:42:19 UTC
[commons-numbers] 04/05: Increase coverage in ContinuedFractionTest
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git
commit 0824c497aa0e52f06111ec576d3046f9ca950621
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Sun Apr 5 22:15:02 2020 +0100
Increase coverage in ContinuedFractionTest
---
.../numbers/fraction/ContinuedFractionTest.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/ContinuedFractionTest.java b/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/ContinuedFractionTest.java
index 5cef76d..a6fe628 100644
--- a/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/ContinuedFractionTest.java
+++ b/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/ContinuedFractionTest.java
@@ -44,6 +44,25 @@ public class ContinuedFractionTest {
Assertions.assertEquals(1.61803399, gr, eps);
}
+ @Test
+ public void testMaxIterationsThrows() throws Exception {
+ ContinuedFraction cf = new ContinuedFraction() {
+ @Override
+ public double getA(int n, double x) {
+ return 1;
+ }
+
+ @Override
+ public double getB(int n, double x) {
+ return 1;
+ }
+ };
+
+ final double eps = 1e-8;
+ final int maxIterations = 3;
+ Assertions.assertThrows(FractionException.class, () -> cf.evaluate(0, eps, maxIterations));
+ }
+
// NUMBERS-46
@Test
public void testOneIteration() {