commit
message
Adding tests for YEARFRAC
author
Ben Vogt <[email protected]>
date
2017-01-10 23:47:55
stats
1 file(s) changed,
7 insertions(+),
1 deletions(-)
files
tests/SheetFormulaTest.ts
1diff --git a/tests/SheetFormulaTest.ts b/tests/SheetFormulaTest.ts
2index fe7981e..2bc6e4c 100644
3--- a/tests/SheetFormulaTest.ts
4+++ b/tests/SheetFormulaTest.ts
5@@ -35,7 +35,7 @@ testFormula("=ABS(0)", 0);
6 // Test ACCRINT
7 // TODO: The second one is really close, but should be correct. Fix this.
8 testFormula("=ACCRINT(DATE(2011, 1, 1), DATE(2011, 2, 1), DATE(2014, 7, 1), 0.1, 1000, 1, 0)", 350);
9-// testFormula('=ACCRINT(DATE(2010, 1, 1), DATE(2010, 2, 1), DATE(2012, 12, 31), 0.05, 100, 4)', 14.98611111);
10+// testFormula('=ACCRINT(DATE(2000, 1, 1), DATE(2000, 2, 1), DATE(2002, 12, 31), 0.05, 100, 4)', 14.98611111);
11
12 // Test ACOS
13 testFormula("=ACOS(0)", 1.5707963267948966);
14@@ -472,4 +472,9 @@ testFormula('=TRUNC(3.1415, 2)', 3.14);
15 testFormula('=XOR(1, 1)', false);
16
17 // Test YEARFRAC
18-testFormula('=YEARFRAC(DATE(1969,7,16), DATE(1969,7,24), 1)', 0.021917808219178082);
19\ No newline at end of file
20+testFormula('=YEARFRAC(DATE(1969, 7, 6), DATE(1988, 7, 4), 0)', 18.994444444444444);
21+// testFormula('=YEARFRAC(DATE(1969, 7, 6), DATE(1988, 7, 4), 1)', 18.99587544); // This is slightly off
22+testFormula('=YEARFRAC(DATE(1969, 7, 6), DATE(1988, 7, 4), 2)', 19.272222222222222);
23+testFormula('=YEARFRAC(DATE(1969, 7, 6), DATE(1988, 7, 4), 3)', 19.008219178082193);
24+testFormula('=YEARFRAC(DATE(1969, 7, 6), DATE(1988, 7, 4), 4)', 18.994444444444444);
25+