f7
f7 is a spreadsheet formula execution library
git clone https://git.vogt.world/f7.git
Log | Files | README.md | LICENSE.md
← All files
name: src/test/js/execution/ExecutorSupportedStatisticalFormulasTest.ts
-rw-r--r--
1728
 1import { runner, describe, it } from "../testutils/TestUtils";
 2
 3describe("Executor.execute - Statistical Formulas", function () {
 4  it("should support AVERAGE", function () {
 5    runner()
 6      .addCell("Alpha", "A1", "=AVERAGE(1, 2, 3, 4, 5, 6)")
 7      .addExpectedValue("Alpha", "A1", 3.5)
 8      .run();
 9  });
10
11  it("should support AVERAGEA", function () {
12    runner()
13      .addCell("Alpha", "A1", `=AVERAGEA({1, 2, 3, 4, 5, 6, "Zero", "Zer"})`)
14      .addExpectedValue("Alpha", "A1", 2.625)
15      .run();
16  });
17
18  it("should support COUNT", function () {
19    runner().addCell("Alpha", "A1", `=COUNT(1, 2, 3, 4)`).addExpectedValue("Alpha", "A1", 4).run();
20  });
21
22  it("should support COUNTA", function () {
23    runner()
24      .addCell("Alpha", "A1", `=COUNTA(1, 2, 3, 4, 1/0)`)
25      .addExpectedValue("Alpha", "A1", 4)
26      .run();
27  });
28
29  it("should support COUNTBLANK", function () {
30    runner()
31      .addCell("Alpha", "A1", `=COUNTBLANK(B1:B10)`)
32      .addCell("Alpha", "C88", `Pushing out grid.`)
33      .addExpectedValue("Alpha", "A1", 10)
34      .run();
35  });
36
37  it("should support MIN", function () {
38    runner().addCell("Alpha", "A1", `=MIN(2, 4, 8)`).addExpectedValue("Alpha", "A1", 2).run();
39  });
40
41  it("should support MINA", function () {
42    runner()
43      .addCell("Alpha", "A1", `=MINA(2, 4, 8, {1, 2, "Nope"})`)
44      .addExpectedValue("Alpha", "A1", 0)
45      .run();
46  });
47
48  it("should support MAX", function () {
49    runner().addCell("Alpha", "A1", `=MAX(2, 4, 8)`).addExpectedValue("Alpha", "A1", 8).run();
50  });
51
52  it("should support MAXA", function () {
53    runner()
54      .addCell("Alpha", "A1", `=MAXA(2, 4, 8, {1, 2, "Nope"})`)
55      .addExpectedValue("Alpha", "A1", 8)
56      .run();
57  });
58});