commit
message
[FINV] More tests
author
Ben Vogt <[email protected]>
date
2017-05-05 00:06:51
stats
2 file(s) changed,
12 insertions(+),
1 deletions(-)
files
src/Formulas/Statistical.ts
tests/Formulas/StatisticalTest.ts
1diff --git a/src/Formulas/Statistical.ts b/src/Formulas/Statistical.ts
2index 32e4baa..504f341 100644
3--- a/src/Formulas/Statistical.ts
4+++ b/src/Formulas/Statistical.ts
5@@ -532,7 +532,6 @@ var FDIST$LEFTTAILED = function (...values) : number|undefined|boolean {
6 * @param values[2] deg_freedom2 - Required. The denominator degrees of freedom.
7 * @returns {number} inverse of the (right-tailed) F probability distribution
8 * @constructor
9- * TODO: This function needs to be tested more thoroughly.
10 */
11 var FINV = function (...values) : number {
12 /**
13diff --git a/tests/Formulas/StatisticalTest.ts b/tests/Formulas/StatisticalTest.ts
14index e16c8de..3b000fb 100644
15--- a/tests/Formulas/StatisticalTest.ts
16+++ b/tests/Formulas/StatisticalTest.ts
17@@ -241,7 +241,19 @@ test("EXPONDIST", function(){
18
19 test("FINV", function(){
20 assertEquals(FINV(0.42, 2, 3), 1.174597274485816);
21+ assertEquals(FINV(0.42, 2, 5), 1.0370426242728021);
22+ assertEquals(FINV(0.42, 33, 5), 1.303222112500911);
23+ assertEquals(FINV(["0.42"], [33, []], [5]), 1.303222112500911);
24 assertEquals(FINV("0.42", 2, 3), 1.174597274485816);
25+ catchAndAssertEquals(function() {
26+ FINV();
27+ }, ERRORS.NA_ERROR);
28+ catchAndAssertEquals(function() {
29+ FINV(0.42, 2, 4, 4);
30+ }, ERRORS.NA_ERROR);
31+ catchAndAssertEquals(function() {
32+ FINV(0.42, 2, []);
33+ }, ERRORS.REF_ERROR);
34 catchAndAssertEquals(function() {
35 FINV(-10, 2, 3);
36 }, ERRORS.NUM_ERROR);