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
This commit is contained in:
parent
b943810bfb
commit
eb7f1ce7e5
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user