From 87a1d193035df8a9071f9ed275c7e456ad37d18b Mon Sep 17 00:00:00 2001 From: "Amol S. Deshmukh" Date: Wed, 22 Jun 2005 20:49:14 +0000 Subject: [PATCH] updated test cases to consider the case that rate=0 git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353727 13f79535-47bb-0310-9956-ffa450edef68 --- .../formula/functions/TestFinanceLib.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/functions/TestFinanceLib.java b/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/functions/TestFinanceLib.java index b8bffc25f3..ca680b0c81 100644 --- a/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/functions/TestFinanceLib.java +++ b/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/functions/TestFinanceLib.java @@ -16,6 +16,11 @@ public class TestFinanceLib extends AbstractNumericTestCase { int n; boolean t = false; + r = 0; n = 3; y = 2; p = 7; t = true; + f = FinanceLib.fv(r, n, y, p, t); + x = -13; + assertEquals("fv ", x, f); + r = 1; n = 10; y = 100; p = 10000; t = false; f = FinanceLib.fv(r, n, y, p, t); x = -10342300; @@ -75,6 +80,11 @@ public class TestFinanceLib extends AbstractNumericTestCase { double f, r, y, p, x; int n; boolean t = false; + + r = 0; n = 3; p = 2; f = 7; t = true; + y = FinanceLib.pmt(r, n, p, f, t); + x = -3; + assertEquals("pmt ", x, y); // cross check with pv r = 1; n = 10; p = -109.66796875; f = 10000; t = false; @@ -103,7 +113,12 @@ public class TestFinanceLib extends AbstractNumericTestCase { double f, r, y, p, x; int n; boolean t = false; - + + r = 0; n = 3; y = 2; f = 7; t = true; + f = FinanceLib.pv(r, n, y, f, t); + x = -13; + assertEquals("pv ", x, f); + r = 1; n = 10; y = 100; f = 10000; t = false; p = FinanceLib.pv(r, n, y, f, t); x = -109.66796875; @@ -138,10 +153,14 @@ public class TestFinanceLib extends AbstractNumericTestCase { } public void testNper() { - double f, r, y, p, x; - int n; + double f, r, y, p, x, n; boolean t = false; + r = 0; y = 7; p = 2; f = 3; t = false; + n = FinanceLib.nper(r, y, p, f, t); + x = -0.71428571429; // can you believe it? excel returns nper as a fraction!?? + assertEquals("nper ", x, n); + // cross check with pv r = 1; y = 100; p = -109.66796875; f = 10000; t = false; n = FinanceLib.nper(r, y, p, f, t); -- 2.39.5