aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2017-10-31 01:13:25 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2017-10-31 01:13:25 +0000
commit0e75ed911103eaaa1abd2813d37a1b1b9e658019 (patch)
treeddeaa233596a94d79a02f592e982523d7f2dc9e2 /src/test
parentc84a6dd569f527b26e8f6a6398d3d5972d04b450 (diff)
downloadjackcess-0e75ed911103eaaa1abd2813d37a1b1b9e658019.tar.gz
jackcess-0e75ed911103eaaa1abd2813d37a1b1b9e658019.zip
implement some financial functions
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/exprs@1129 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java b/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
index ed1aa23..30b60ad 100644
--- a/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
@@ -87,6 +87,42 @@ public class DefaultFunctionsTest extends TestCase
assertEquals("ah", eval("=Right(\"blah\", 2)"));
assertEquals("", eval("=Right(\"blah\", 0)"));
assertEquals("blah", eval("=Right(\"blah\", 17)"));
+
+ }
+
+
+ public void testFinancialFuncs() throws Exception
+ {
+ assertEquals("-9.578594039813165",
+ eval("=CStr(NPer(0.12/12,-100,-1000))"));
+ assertEquals("-9.488095005505832",
+ eval("=CStr(NPer(0.12/12,-100,-1000,0,1))"));
+ assertEquals("60.08212285376166",
+ eval("=CStr(NPer(0.12/12,-100,-1000,10000))"));
+ assertEquals("59.673865674294554",
+ eval("=CStr(NPer(0.12/12,-100,-1000,10000,1))"));
+ assertEquals("69.66071689357483",
+ eval("=CStr(NPer(0.12/12,-100,0,10000))"));
+ assertEquals("69.16196067980039",
+ eval("=CStr(NPer(0.12/12,-100,0,10000,1))"));
+
+ assertEquals("8166.966985640913",
+ eval("=CStr(FV(0.12/12,60,-100))"));
+ assertEquals("8248.636655497321",
+ eval("=CStr(FV(0.12/12,60,-100,0,1))"));
+ assertEquals("6350.270287076823",
+ eval("=CStr(FV(0.12/12,60,-100,1000))"));
+ assertEquals("6431.939956933231",
+ eval("=CStr(FV(0.12/12,60,-100,1000,1))"));
+
+ assertEquals("4495.503840622403",
+ eval("=CStr(PV(0.12/12,60,-100))"));
+ assertEquals("4540.458879028627",
+ eval("=CStr(PV(0.12/12,60,-100,0,1))"));
+ assertEquals("-1008.992318755193",
+ eval("=CStr(PV(0.12/12,60,-100,10000))"));
+ assertEquals("-964.0372803489684",
+ eval("=CStr(PV(0.12/12,60,-100,10000,1))"));
}
}