commit
message
[Financial] Breaking out Financial.ts tests into seperate file
author
Ben Vogt <[email protected]>
date
2017-04-29 21:48:28
stats
2 file(s) changed,
235 insertions(+),
220 deletions(-)
files
tests/FinancialTest.ts
tests/FormulasTest.ts
1diff --git a/tests/FinancialTest.ts b/tests/FinancialTest.ts
2new file mode 100644
3index 0000000..924109e
4--- /dev/null
5+++ b/tests/FinancialTest.ts
6@@ -0,0 +1,235 @@
7+import {
8+ ACCRINT,
9+ CUMPRINC,
10+ CUMIPMT,
11+ DB,
12+ DDB,
13+ DOLLAR,
14+ DOLLARDE,
15+ DOLLARFR,
16+ EFFECT
17+} from "../src/RawFormulas/Financial";
18+import {
19+ DATE
20+} from "../src/RawFormulas/Date";
21+import {
22+ PI
23+} from "../src/RawFormulas/Math";
24+import * as ERRORS from "../src/Errors"
25+import {
26+ assertEquals,
27+ catchAndAssertEquals
28+} from "./utils/Asserts";
29+
30+// Test ACCRINT
31+assertEquals(ACCRINT(DATE(2000, 1, 1), DATE(2000, 2, 1), DATE(2002, 12, 31), 0.05, 100, 4), 14.98631386861314);
32+assertEquals(ACCRINT(DATE(2011, 1, 1), DATE(2011, 2, 1), DATE(2014, 7, 1), 0.1, 1000, 1, 0), 350);
33+assertEquals(ACCRINT(DATE(2001, 1, 1), DATE(2011, 2, 1), DATE(2014, 7, 1), 0.1, 1000, 2, 1), 1349.6186192059456);
34+assertEquals(ACCRINT(39508, 39691, 39569, 0.1, 1000, 2, 0), 16.666666666666664);
35+assertEquals(ACCRINT(10000, 1, 20000, 0.1, 1000, 4, 0), 2737.5);
36+assertEquals(ACCRINT(10000, 1, 20000, 0.1, 1000, 4, 1), 2737.8507871321012); // ms: 2787.087912 (1.76% err), gs: 2737.637363 (0.007% err)
37+assertEquals(ACCRINT(10000, 1, 20000, 0.1, 1000, 4, 2), 2777.777777777778); // ms, gs: 2737.777778 (1.46% err)
38+assertEquals(ACCRINT(10000, 1, 20000, 0.1, 1000, 4, 3), 2739.72602739726); //ms, gs: 2737.60274 (0.077% err)
39+assertEquals(ACCRINT(10000, 1, 20000, 0.1, 1000, 4, 4), 2737.5);
40+assertEquals(ACCRINT(1, 44, "1461", "0.1", [1000], [1]), 400);
41+assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1), 400);
42+assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1, 0), 400);
43+assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1, 1), 400);
44+assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1, 2), 405.55555555555554); // gs: 400
45+assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1, 3), 400); // gs: 399.6575342
46+assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1, 4), 400);
47+catchAndAssertEquals(function() {
48+ ACCRINT(1, -1, 100, 0.1, 1000, 1, 4);
49+}, ERRORS.NUM_ERROR);
50+catchAndAssertEquals(function() {
51+ ACCRINT(100, 2, 1, 0.1, 1000, 1, 4);
52+}, ERRORS.NUM_ERROR);
53+catchAndAssertEquals(function() {
54+ ACCRINT(100, 2, 1, 0.1, 1000);
55+}, ERRORS.NA_ERROR);
56+catchAndAssertEquals(function() {
57+ ACCRINT(1, 2, 1461, 0.1, 1000, 1, 1, 1);
58+}, ERRORS.NA_ERROR);
59+
60+
61+// Test CUMPRINC
62+assertEquals(CUMPRINC(0.12, 12, 100, 1, 5, false), -26.324171373034403);
63+assertEquals(CUMPRINC(0.12, 12, 100, 1, 5, 0), -26.324171373034403);
64+assertEquals(CUMPRINC(0.12, 12, 100, 1, 5, true), -34.21801015449499);
65+assertEquals(CUMPRINC(0.12, 12, 100, 1, 5, -11), -34.21801015449499);
66+catchAndAssertEquals(function() {
67+ CUMPRINC(0.12, 12, 100, 1, 5, []);
68+}, ERRORS.REF_ERROR);
69+catchAndAssertEquals(function() {
70+ CUMPRINC(0.12, 12, 100, 0, 5, false);
71+}, ERRORS.NUM_ERROR);
72+catchAndAssertEquals(function() {
73+ CUMPRINC(0.12, 12, 100, 3, 1, false);
74+}, ERRORS.NUM_ERROR);
75+catchAndAssertEquals(function() {
76+ CUMPRINC();
77+}, ERRORS.NA_ERROR);
78+catchAndAssertEquals(function() {
79+ CUMPRINC(0.12, 12, 100, 1, 5, true, 55);
80+}, ERRORS.NA_ERROR);
81+catchAndAssertEquals(function() {
82+ CUMPRINC(0.12, 12, 100, 1, 5);
83+}, ERRORS.NA_ERROR);
84+
85+
86+// Test CUMIPMT
87+assertEquals(CUMIPMT(0.12, 12, 100, 1, 5, 0), -54.39423242396348);
88+assertEquals(CUMIPMT(0.12, 12, 100, 1, 5, false), -54.39423242396348);
89+assertEquals(CUMIPMT(0.12, 12, 100, 1, 5, true), -37.851993235681675);
90+assertEquals(CUMIPMT(0.12, 12, 100, 1, 5, 1), -37.851993235681675);
91+assertEquals(CUMIPMT(0.12, 12, 100, 2, 6, 1), -45.74583201714228);
92+assertEquals(CUMIPMT(0.12, 12, 100, 2, 6, true), -45.74583201714228);
93+assertEquals(CUMIPMT([0.12], ["12"], [100, "str"], "1", 5, 0), -54.39423242396348);
94+catchAndAssertEquals(function() {
95+ CUMIPMT(0.12, 12, 100, 1, 5, []);
96+}, ERRORS.REF_ERROR);
97+catchAndAssertEquals(function() {
98+ CUMIPMT(0.12, 12, 100, 0, 5, false);
99+}, ERRORS.NUM_ERROR);
100+catchAndAssertEquals(function() {
101+ CUMIPMT(0.12, 12, 100, 3, 1, false);
102+}, ERRORS.NUM_ERROR);
103+catchAndAssertEquals(function() {
104+ CUMIPMT();
105+}, ERRORS.NA_ERROR);
106+catchAndAssertEquals(function() {
107+ CUMIPMT(0.12, 12, 100, 1, 5, true, 55);
108+}, ERRORS.NA_ERROR);
109+catchAndAssertEquals(function() {
110+ CUMIPMT(0.12, 12, 100, 1, 5);
111+}, ERRORS.NA_ERROR);
112+
113+
114+// Test DB
115+assertEquals(DB(100, 50, 10, 2, 12), 6.2482428240683285);
116+assertEquals(DB("100", "50", "10", "2", "12"), 6.2482428240683285);
117+assertEquals(DB(100, 50, 10, 2, 12.9999999), 6.2482428240683285);
118+catchAndAssertEquals(function() {
119+ DB(100, 50, 10, 2, 13);
120+}, ERRORS.NUM_ERROR);
121+catchAndAssertEquals(function() {
122+ DB(100, 50, 10, 12, 2);
123+}, ERRORS.NUM_ERROR);
124+catchAndAssertEquals(function() {
125+ DB(100, -50, 10, 2, 12);
126+}, ERRORS.NUM_ERROR);
127+
128+
129+// Test DDB
130+assertEquals(DDB(100, 50, 10, 2, 2.25), 17.4375);
131+assertEquals(DDB(100, [50], 10, 2, "2.25"), 17.4375);
132+catchAndAssertEquals(function() {
133+ DDB(100, 50, 10, 12, 2.25);
134+}, ERRORS.NUM_ERROR);
135+catchAndAssertEquals(function() {
136+ DDB(100, -50, 10, 2, 12);
137+}, ERRORS.NUM_ERROR);
138+
139+
140+// Test DOLLAR
141+assertEquals(DOLLAR(1.2351, 4), 1.2351);
142+assertEquals(DOLLAR(1.2351, 2), 1.23);
143+assertEquals(DOLLAR("$3.141592653589793", "2"), 3.14);
144+assertEquals(DOLLAR("-$3.141592653589793", "2"), -3.14);
145+assertEquals(DOLLAR("$-3.141592653589793", "2"), -3.14);
146+assertEquals(DOLLAR(PI(), 1), 3.1);
147+assertEquals(DOLLAR(PI(), 0), 3);
148+assertEquals(DOLLAR(PI(), false), 3);
149+assertEquals(DOLLAR(PI(), -1), 0);
150+assertEquals(DOLLAR(31.41592653589793, -1), 30);
151+assertEquals(DOLLAR([31.41592653589793], [-1]), 30);
152+assertEquals(DOLLAR(31111.41592653589793, -4), 30000);
153+assertEquals(DOLLAR(31111.41592653589793, -2), 31100);
154+catchAndAssertEquals(function() {
155+ DOLLAR();
156+}, ERRORS.NA_ERROR);
157+catchAndAssertEquals(function() {
158+ DOLLAR(3.1, 1, 1);
159+}, ERRORS.NA_ERROR);
160+
161+
162+// Test DOLLARDE
163+assertEquals(DOLLARDE(0, 32), 0);
164+assertEquals(DOLLARDE(100.1, 32), 100.3125);
165+assertEquals(DOLLARDE(100.1, 32.9999), 100.3125);
166+assertEquals(DOLLARDE("100.1", [32, "str"]), 100.3125);
167+catchAndAssertEquals(function() {
168+ DOLLARDE(100, []);
169+}, ERRORS.REF_ERROR);
170+catchAndAssertEquals(function() {
171+ DOLLARDE(100, "str");
172+}, ERRORS.VALUE_ERROR);
173+catchAndAssertEquals(function() {
174+ DOLLARDE(100, 0);
175+}, ERRORS.DIV_ZERO_ERROR);
176+catchAndAssertEquals(function() {
177+ DOLLARDE(100, 0.99);
178+}, ERRORS.DIV_ZERO_ERROR);
179+catchAndAssertEquals(function() {
180+ DOLLARDE();
181+}, ERRORS.NA_ERROR);
182+catchAndAssertEquals(function() {
183+ DOLLARDE(3.1);
184+}, ERRORS.NA_ERROR);
185+catchAndAssertEquals(function() {
186+ DOLLARDE(3.1, 32, 22);
187+}, ERRORS.NA_ERROR);
188+
189+
190+// Test DOLLARFR
191+assertEquals(DOLLARFR(100.1, 32), 100.032);
192+assertEquals(DOLLARFR(100.1, 32), 100.032);
193+assertEquals(DOLLARFR(100.1, 32.9999), 100.032);
194+assertEquals(DOLLARFR("100.1", [32, "str"]), 100.032);
195+catchAndAssertEquals(function() {
196+ DOLLARFR(100, []);
197+}, ERRORS.REF_ERROR);
198+catchAndAssertEquals(function() {
199+ DOLLARFR(100, "str");
200+}, ERRORS.VALUE_ERROR);
201+catchAndAssertEquals(function() {
202+ DOLLARFR(100, 0);
203+}, ERRORS.DIV_ZERO_ERROR);
204+catchAndAssertEquals(function() {
205+ DOLLARFR(100, 0.99);
206+}, ERRORS.DIV_ZERO_ERROR);
207+catchAndAssertEquals(function() {
208+ DOLLARFR();
209+}, ERRORS.NA_ERROR);
210+catchAndAssertEquals(function() {
211+ DOLLARFR(3.1);
212+}, ERRORS.NA_ERROR);
213+catchAndAssertEquals(function() {
214+ DOLLARFR(3.1, 32, 22);
215+}, ERRORS.NA_ERROR);
216+
217+
218+// Test EFFECT
219+assertEquals(EFFECT(0.99, 12), 1.5890167507927795);
220+assertEquals(EFFECT(0.99, 12.111), 1.5890167507927795);
221+assertEquals(EFFECT(0.99, 12.999), 1.5890167507927795);
222+assertEquals(EFFECT("100000", 12.999), 1.123182670038387e+47);
223+assertEquals(EFFECT([100000], [12.999]), 1.123182670038387e+47);
224+catchAndAssertEquals(function() {
225+ EFFECT();
226+}, ERRORS.NA_ERROR);
227+catchAndAssertEquals(function() {
228+ EFFECT(0.99);
229+}, ERRORS.NA_ERROR);
230+catchAndAssertEquals(function() {
231+ EFFECT(-0.99, 12);
232+}, ERRORS.NUM_ERROR);
233+catchAndAssertEquals(function() {
234+ EFFECT(0.99, 0);
235+}, ERRORS.NUM_ERROR);
236+catchAndAssertEquals(function() {
237+ EFFECT(0.99, "str");
238+}, ERRORS.VALUE_ERROR);
239+catchAndAssertEquals(function() {
240+ EFFECT(0.99, []);
241+}, ERRORS.REF_ERROR);
242diff --git a/tests/FormulasTest.ts b/tests/FormulasTest.ts
243index 082a058..305b4cf 100644
244--- a/tests/FormulasTest.ts
245+++ b/tests/FormulasTest.ts
246@@ -40,38 +40,6 @@ catchAndAssertEquals(function() {
247 }, ERRORS.VALUE_ERROR);
248
249
250-// Test ACCRINT
251-assertEquals(ACCRINT(DATE(2000, 1, 1), DATE(2000, 2, 1), DATE(2002, 12, 31), 0.05, 100, 4), 14.98631386861314);
252-assertEquals(ACCRINT(DATE(2011, 1, 1), DATE(2011, 2, 1), DATE(2014, 7, 1), 0.1, 1000, 1, 0), 350);
253-assertEquals(ACCRINT(DATE(2001, 1, 1), DATE(2011, 2, 1), DATE(2014, 7, 1), 0.1, 1000, 2, 1), 1349.6186192059456);
254-assertEquals(ACCRINT(39508, 39691, 39569, 0.1, 1000, 2, 0), 16.666666666666664);
255-assertEquals(ACCRINT(10000, 1, 20000, 0.1, 1000, 4, 0), 2737.5);
256-assertEquals(ACCRINT(10000, 1, 20000, 0.1, 1000, 4, 1), 2737.8507871321012); // ms: 2787.087912 (1.76% err), gs: 2737.637363 (0.007% err)
257-assertEquals(ACCRINT(10000, 1, 20000, 0.1, 1000, 4, 2), 2777.777777777778); // ms, gs: 2737.777778 (1.46% err)
258-assertEquals(ACCRINT(10000, 1, 20000, 0.1, 1000, 4, 3), 2739.72602739726); //ms, gs: 2737.60274 (0.077% err)
259-assertEquals(ACCRINT(10000, 1, 20000, 0.1, 1000, 4, 4), 2737.5);
260-assertEquals(ACCRINT(1, 44, "1461", "0.1", [1000], [1]), 400);
261-assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1), 400);
262-assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1, 0), 400);
263-assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1, 1), 400);
264-assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1, 2), 405.55555555555554); // gs: 400
265-assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1, 3), 400); // gs: 399.6575342
266-assertEquals(ACCRINT(1, 2, 1461, 0.1, 1000, 1, 4), 400);
267-catchAndAssertEquals(function() {
268- ACCRINT(1, -1, 100, 0.1, 1000, 1, 4);
269-}, ERRORS.NUM_ERROR);
270-catchAndAssertEquals(function() {
271- ACCRINT(100, 2, 1, 0.1, 1000, 1, 4);
272-}, ERRORS.NUM_ERROR);
273-catchAndAssertEquals(function() {
274- ACCRINT(100, 2, 1, 0.1, 1000);
275-}, ERRORS.NA_ERROR);
276-catchAndAssertEquals(function() {
277- ACCRINT(1, 2, 1461, 0.1, 1000, 1, 1, 1);
278-}, ERRORS.NA_ERROR);
279-
280-
281-
282 // Test ACOS
283 assertEquals(ACOS(0), 1.5707963267948966);
284 assertEquals(ACOS(-1), 3.141592653589793);
285@@ -668,85 +636,6 @@ catchAndAssertEquals(function() {
286 }, ERRORS.NA_ERROR);
287
288
289-// Test CUMIPMT
290-assertEquals(CUMIPMT(0.12, 12, 100, 1, 5, 0), -54.39423242396348);
291-assertEquals(CUMIPMT(0.12, 12, 100, 1, 5, false), -54.39423242396348);
292-assertEquals(CUMIPMT(0.12, 12, 100, 1, 5, true), -37.851993235681675);
293-assertEquals(CUMIPMT(0.12, 12, 100, 1, 5, 1), -37.851993235681675);
294-assertEquals(CUMIPMT(0.12, 12, 100, 2, 6, 1), -45.74583201714228);
295-assertEquals(CUMIPMT(0.12, 12, 100, 2, 6, true), -45.74583201714228);
296-assertEquals(CUMIPMT([0.12], ["12"], [100, "str"], "1", 5, 0), -54.39423242396348);
297-catchAndAssertEquals(function() {
298- CUMIPMT(0.12, 12, 100, 1, 5, []);
299-}, ERRORS.REF_ERROR);
300-catchAndAssertEquals(function() {
301- CUMIPMT(0.12, 12, 100, 0, 5, false);
302-}, ERRORS.NUM_ERROR);
303-catchAndAssertEquals(function() {
304- CUMIPMT(0.12, 12, 100, 3, 1, false);
305-}, ERRORS.NUM_ERROR);
306-catchAndAssertEquals(function() {
307- CUMIPMT();
308-}, ERRORS.NA_ERROR);
309-catchAndAssertEquals(function() {
310- CUMIPMT(0.12, 12, 100, 1, 5, true, 55);
311-}, ERRORS.NA_ERROR);
312-catchAndAssertEquals(function() {
313- CUMIPMT(0.12, 12, 100, 1, 5);
314-}, ERRORS.NA_ERROR);
315-
316-
317-// Test CUMPRINC
318-assertEquals(CUMPRINC(0.12, 12, 100, 1, 5, false), -26.324171373034403);
319-assertEquals(CUMPRINC(0.12, 12, 100, 1, 5, 0), -26.324171373034403);
320-assertEquals(CUMPRINC(0.12, 12, 100, 1, 5, true), -34.21801015449499);
321-assertEquals(CUMPRINC(0.12, 12, 100, 1, 5, -11), -34.21801015449499);
322-catchAndAssertEquals(function() {
323- CUMPRINC(0.12, 12, 100, 1, 5, []);
324-}, ERRORS.REF_ERROR);
325-catchAndAssertEquals(function() {
326- CUMPRINC(0.12, 12, 100, 0, 5, false);
327-}, ERRORS.NUM_ERROR);
328-catchAndAssertEquals(function() {
329- CUMPRINC(0.12, 12, 100, 3, 1, false);
330-}, ERRORS.NUM_ERROR);
331-catchAndAssertEquals(function() {
332- CUMPRINC();
333-}, ERRORS.NA_ERROR);
334-catchAndAssertEquals(function() {
335- CUMPRINC(0.12, 12, 100, 1, 5, true, 55);
336-}, ERRORS.NA_ERROR);
337-catchAndAssertEquals(function() {
338- CUMPRINC(0.12, 12, 100, 1, 5);
339-}, ERRORS.NA_ERROR);
340-
341-
342-// Test DB
343-assertEquals(DB(100, 50, 10, 2, 12), 6.2482428240683285);
344-assertEquals(DB("100", "50", "10", "2", "12"), 6.2482428240683285);
345-assertEquals(DB(100, 50, 10, 2, 12.9999999), 6.2482428240683285);
346-catchAndAssertEquals(function() {
347- DB(100, 50, 10, 2, 13);
348-}, ERRORS.NUM_ERROR);
349-catchAndAssertEquals(function() {
350- DB(100, 50, 10, 12, 2);
351-}, ERRORS.NUM_ERROR);
352-catchAndAssertEquals(function() {
353- DB(100, -50, 10, 2, 12);
354-}, ERRORS.NUM_ERROR);
355-
356-
357-// Test DDB
358-assertEquals(DDB(100, 50, 10, 2, 2.25), 17.4375);
359-assertEquals(DDB(100, [50], 10, 2, "2.25"), 17.4375);
360-catchAndAssertEquals(function() {
361- DDB(100, 50, 10, 12, 2.25);
362-}, ERRORS.NUM_ERROR);
363-catchAndAssertEquals(function() {
364- DDB(100, -50, 10, 2, 12);
365-}, ERRORS.NUM_ERROR);
366-
367-
368 // Test DEGREES
369 assertEquals(DEGREES(PI()), 180);
370 assertEquals(DEGREES([PI(), "str"]), 180);
371@@ -785,116 +674,10 @@ catchAndAssertEquals(function() {
372 }, ERRORS.REF_ERROR);
373
374
375-// Test DOLLAR
376-assertEquals(DOLLAR(1.2351, 4), 1.2351);
377-assertEquals(DOLLAR(1.2351, 2), 1.23);
378-assertEquals(DOLLAR("$3.141592653589793", "2"), 3.14);
379-assertEquals(DOLLAR("-$3.141592653589793", "2"), -3.14);
380-assertEquals(DOLLAR("$-3.141592653589793", "2"), -3.14);
381-assertEquals(DOLLAR(PI(), 1), 3.1);
382-assertEquals(DOLLAR(PI(), 0), 3);
383-assertEquals(DOLLAR(PI(), false), 3);
384-assertEquals(DOLLAR(PI(), -1), 0);
385-assertEquals(DOLLAR(31.41592653589793, -1), 30);
386-assertEquals(DOLLAR([31.41592653589793], [-1]), 30);
387-assertEquals(DOLLAR(31111.41592653589793, -4), 30000);
388-assertEquals(DOLLAR(31111.41592653589793, -2), 31100);
389-catchAndAssertEquals(function() {
390- DOLLAR();
391-}, ERRORS.NA_ERROR);
392-catchAndAssertEquals(function() {
393- DOLLAR(3.1, 1, 1);
394-}, ERRORS.NA_ERROR);
395-
396-
397-// Test DOLLARDE
398-assertEquals(DOLLARDE(0, 32), 0);
399-assertEquals(DOLLARDE(100.1, 32), 100.3125);
400-assertEquals(DOLLARDE(100.1, 32.9999), 100.3125);
401-assertEquals(DOLLARDE("100.1", [32, "str"]), 100.3125);
402-catchAndAssertEquals(function() {
403- DOLLARDE(100, []);
404-}, ERRORS.REF_ERROR);
405-catchAndAssertEquals(function() {
406- DOLLARDE(100, "str");
407-}, ERRORS.VALUE_ERROR);
408-catchAndAssertEquals(function() {
409- DOLLARDE(100, 0);
410-}, ERRORS.DIV_ZERO_ERROR);
411-catchAndAssertEquals(function() {
412- DOLLARDE(100, 0.99);
413-}, ERRORS.DIV_ZERO_ERROR);
414-catchAndAssertEquals(function() {
415- DOLLARDE();
416-}, ERRORS.NA_ERROR);
417-catchAndAssertEquals(function() {
418- DOLLARDE(3.1);
419-}, ERRORS.NA_ERROR);
420-catchAndAssertEquals(function() {
421- DOLLARDE(3.1, 32, 22);
422-}, ERRORS.NA_ERROR);
423-
424-
425-// Test DOLLARFR
426-assertEquals(DOLLARFR(100.1, 32), 100.032);
427-assertEquals(DOLLARFR(100.1, 32), 100.032);
428-assertEquals(DOLLARFR(100.1, 32.9999), 100.032);
429-assertEquals(DOLLARFR("100.1", [32, "str"]), 100.032);
430-catchAndAssertEquals(function() {
431- DOLLARFR(100, []);
432-}, ERRORS.REF_ERROR);
433-catchAndAssertEquals(function() {
434- DOLLARFR(100, "str");
435-}, ERRORS.VALUE_ERROR);
436-catchAndAssertEquals(function() {
437- DOLLARFR(100, 0);
438-}, ERRORS.DIV_ZERO_ERROR);
439-catchAndAssertEquals(function() {
440- DOLLARFR(100, 0.99);
441-}, ERRORS.DIV_ZERO_ERROR);
442-catchAndAssertEquals(function() {
443- DOLLARFR();
444-}, ERRORS.NA_ERROR);
445-catchAndAssertEquals(function() {
446- DOLLARFR(3.1);
447-}, ERRORS.NA_ERROR);
448-catchAndAssertEquals(function() {
449- DOLLARFR(3.1, 32, 22);
450-}, ERRORS.NA_ERROR);
451-
452-
453+// Test AND
454 assertEquals(AND(10), true);
455
456
457-
458-// Test EFFECT
459-assertEquals(EFFECT(0.99, 12), 1.5890167507927795);
460-assertEquals(EFFECT(0.99, 12.111), 1.5890167507927795);
461-assertEquals(EFFECT(0.99, 12.999), 1.5890167507927795);
462-assertEquals(EFFECT("100000", 12.999), 1.123182670038387e+47);
463-assertEquals(EFFECT([100000], [12.999]), 1.123182670038387e+47);
464-catchAndAssertEquals(function() {
465- EFFECT();
466-}, ERRORS.NA_ERROR);
467-catchAndAssertEquals(function() {
468- EFFECT(0.99);
469-}, ERRORS.NA_ERROR);
470-catchAndAssertEquals(function() {
471- EFFECT(-0.99, 12);
472-}, ERRORS.NUM_ERROR);
473-catchAndAssertEquals(function() {
474- EFFECT(0.99, 0);
475-}, ERRORS.NUM_ERROR);
476-catchAndAssertEquals(function() {
477- EFFECT(0.99, "str");
478-}, ERRORS.VALUE_ERROR);
479-catchAndAssertEquals(function() {
480- EFFECT(0.99, []);
481-}, ERRORS.REF_ERROR);
482-
483-// assertEqualsDates(EOMONTH(DATE(1992, 6, 24), 1), new Date('7/31/1992'));
484-
485-
486 // Test ERF
487 assertEquals(ERF(2), 0.9953222650189527);
488 assertEquals(ERF("2"), 0.9953222650189527);