@odoo/o-spreadsheet 14.0.1 → 14.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/dist/o_spreadsheet.cjs.js +17836 -0
  2. package/dist/o_spreadsheet.d.ts +4102 -0
  3. package/dist/o_spreadsheet.esm.js +17801 -0
  4. package/dist/o_spreadsheet.iife.js +17838 -0
  5. package/dist/o_spreadsheet.iife.min.js +1440 -0
  6. package/package.json +27 -7
  7. package/readme.md +10 -0
  8. package/.eslintrc.json +0 -20
  9. package/.husky/post-checkout +0 -9
  10. package/.husky/pre-commit +0 -39
  11. package/.prettierignore +0 -1
  12. package/astToFormula.patch +0 -0
  13. package/demo/data.js +0 -255
  14. package/demo/index.html +0 -9
  15. package/demo/libs/Chart.bundle.js +0 -20755
  16. package/demo/main.js +0 -101
  17. package/doc/readme.md +0 -46
  18. package/rollup.config.js +0 -23
  19. package/src/base_plugin.ts +0 -102
  20. package/src/components/autofill.ts +0 -146
  21. package/src/components/bottom_bar.ts +0 -199
  22. package/src/components/color_picker.ts +0 -150
  23. package/src/components/composer/autocomplete_dropdown.ts +0 -135
  24. package/src/components/composer/composer.ts +0 -487
  25. package/src/components/composer/content_editable_helper.ts +0 -146
  26. package/src/components/figures/chart.ts +0 -70
  27. package/src/components/figures/container.ts +0 -268
  28. package/src/components/figures/text_figure.ts +0 -36
  29. package/src/components/grid.ts +0 -635
  30. package/src/components/helpers/dom_helpers.ts +0 -7
  31. package/src/components/helpers/drag_and_drop.ts +0 -17
  32. package/src/components/icons.ts +0 -36
  33. package/src/components/index.ts +0 -1
  34. package/src/components/menu.ts +0 -288
  35. package/src/components/overlay.ts +0 -457
  36. package/src/components/scrollbar.ts +0 -22
  37. package/src/components/selection_input.ts +0 -168
  38. package/src/components/side_panel/cell_is_rule_editor.ts +0 -169
  39. package/src/components/side_panel/chart_panel.ts +0 -104
  40. package/src/components/side_panel/color_scale_rule_editor.ts +0 -145
  41. package/src/components/side_panel/conditional_formatting.ts +0 -396
  42. package/src/components/side_panel/side_panel.ts +0 -127
  43. package/src/components/side_panel/translations_terms.ts +0 -45
  44. package/src/components/spreadsheet.ts +0 -198
  45. package/src/components/top_bar.ts +0 -535
  46. package/src/constants.ts +0 -26
  47. package/src/data.ts +0 -149
  48. package/src/fonts.ts +0 -41
  49. package/src/formulas/compiler.ts +0 -258
  50. package/src/formulas/composer_tokenizer.ts +0 -70
  51. package/src/formulas/index.ts +0 -15
  52. package/src/formulas/normalize.ts +0 -52
  53. package/src/formulas/parser.ts +0 -280
  54. package/src/formulas/range_tokenizer.ts +0 -97
  55. package/src/formulas/tokenizer.ts +0 -242
  56. package/src/functions/arguments.ts +0 -114
  57. package/src/functions/dates.ts +0 -302
  58. package/src/functions/helpers.ts +0 -592
  59. package/src/functions/index.ts +0 -52
  60. package/src/functions/module_database.ts +0 -282
  61. package/src/functions/module_date.ts +0 -743
  62. package/src/functions/module_info.ts +0 -69
  63. package/src/functions/module_logical.ts +0 -208
  64. package/src/functions/module_lookup.ts +0 -185
  65. package/src/functions/module_math.ts +0 -1252
  66. package/src/functions/module_operators.ts +0 -291
  67. package/src/functions/module_statistical.ts +0 -882
  68. package/src/functions/module_text.ts +0 -370
  69. package/src/helpers/color.ts +0 -30
  70. package/src/helpers/coordinates.ts +0 -71
  71. package/src/helpers/grid_manipulation.ts +0 -68
  72. package/src/helpers/index.ts +0 -7
  73. package/src/helpers/misc.ts +0 -76
  74. package/src/helpers/numbers.ts +0 -117
  75. package/src/helpers/uuid.ts +0 -19
  76. package/src/helpers/zones.ts +0 -263
  77. package/src/history.ts +0 -186
  78. package/src/index.ts +0 -84
  79. package/src/model.ts +0 -261
  80. package/src/plugins/autofill.ts +0 -412
  81. package/src/plugins/chart.ts +0 -404
  82. package/src/plugins/clipboard.ts +0 -461
  83. package/src/plugins/conditional_format.ts +0 -445
  84. package/src/plugins/core.ts +0 -1502
  85. package/src/plugins/edition.ts +0 -157
  86. package/src/plugins/evaluation.ts +0 -428
  87. package/src/plugins/figures.ts +0 -123
  88. package/src/plugins/formatting.ts +0 -630
  89. package/src/plugins/highlight.ts +0 -187
  90. package/src/plugins/index.ts +0 -32
  91. package/src/plugins/merge.ts +0 -524
  92. package/src/plugins/renderer.ts +0 -571
  93. package/src/plugins/selection.ts +0 -562
  94. package/src/plugins/selection_inputs.ts +0 -326
  95. package/src/registries/autofill_modifiers.ts +0 -76
  96. package/src/registries/autofill_rules.ts +0 -98
  97. package/src/registries/figure_registry.ts +0 -30
  98. package/src/registries/index.ts +0 -7
  99. package/src/registries/menu_items_registry.ts +0 -110
  100. package/src/registries/menus/cell_menu_registry.ts +0 -79
  101. package/src/registries/menus/col_menu_registry.ts +0 -63
  102. package/src/registries/menus/index.ts +0 -6
  103. package/src/registries/menus/menu_items_actions.ts +0 -425
  104. package/src/registries/menus/row_menu_registry.ts +0 -63
  105. package/src/registries/menus/sheet_menu_registry.ts +0 -75
  106. package/src/registries/menus/topbar_menu_registry.ts +0 -204
  107. package/src/registries/side_panel_registry.ts +0 -26
  108. package/src/registries/topbar_component_registry.ts +0 -12
  109. package/src/registry.ts +0 -51
  110. package/src/translation.ts +0 -44
  111. package/src/types/autofill.ts +0 -48
  112. package/src/types/chart.ts +0 -26
  113. package/src/types/commands.ts +0 -716
  114. package/src/types/conditional_formatting.ts +0 -124
  115. package/src/types/env.ts +0 -13
  116. package/src/types/functions.ts +0 -35
  117. package/src/types/getters.ts +0 -103
  118. package/src/types/index.ts +0 -20
  119. package/src/types/misc.ts +0 -143
  120. package/src/types/rendering.ts +0 -41
  121. package/src/types/workbook_data.ts +0 -62
  122. package/tests/__mocks__/uuid.ts +0 -7
  123. package/tests/canvas.mock.ts +0 -34
  124. package/tests/components/__mocks__/content_editable_helper.ts +0 -79
  125. package/tests/components/__mocks__/scrollbar.ts +0 -18
  126. package/tests/components/__snapshots__/autocomplete_dropdown_test.ts.snap +0 -29
  127. package/tests/components/__snapshots__/bottom_bar_test.ts.snap +0 -75
  128. package/tests/components/__snapshots__/context_menu_test.ts.snap +0 -88
  129. package/tests/components/__snapshots__/grid_test.ts.snap +0 -60
  130. package/tests/components/__snapshots__/spreadsheet_test.ts.snap +0 -455
  131. package/tests/components/__snapshots__/top_bar_test.ts.snap +0 -705
  132. package/tests/components/autocomplete_dropdown_test.ts +0 -315
  133. package/tests/components/autofill_test.ts +0 -167
  134. package/tests/components/bottom_bar_test.ts +0 -262
  135. package/tests/components/chart_side_panel_test.ts +0 -123
  136. package/tests/components/composer_test.ts +0 -400
  137. package/tests/components/context_menu_test.ts +0 -825
  138. package/tests/components/grid_manipulation_test.ts +0 -163
  139. package/tests/components/grid_test.ts +0 -581
  140. package/tests/components/overlay_test.ts +0 -541
  141. package/tests/components/selection_input_test.ts +0 -259
  142. package/tests/components/side_panel_test.ts +0 -148
  143. package/tests/components/spreadsheet_test.ts +0 -194
  144. package/tests/components/top_bar_test.ts +0 -427
  145. package/tests/data_test.ts +0 -175
  146. package/tests/dom_helper.ts +0 -42
  147. package/tests/formulas/__snapshots__/compiler_test.ts.snap +0 -302
  148. package/tests/formulas/compiler_test.ts +0 -266
  149. package/tests/formulas/composer_tokenizer_test.ts +0 -137
  150. package/tests/formulas/expressions_test.ts +0 -57
  151. package/tests/formulas/formulas_test.ts +0 -80
  152. package/tests/formulas/normalize_test.ts +0 -82
  153. package/tests/formulas/parser_test.ts +0 -224
  154. package/tests/formulas/range_tokenizer_test.ts +0 -187
  155. package/tests/formulas/tokenizer_test.ts +0 -164
  156. package/tests/functions/arguments_test.ts +0 -141
  157. package/tests/functions/dates_test.ts +0 -1081
  158. package/tests/functions/functions_test.ts +0 -53
  159. package/tests/functions/helper_test.ts +0 -98
  160. package/tests/functions/module_database_test.ts +0 -311
  161. package/tests/functions/module_date_test.ts +0 -941
  162. package/tests/functions/module_info_test.ts +0 -139
  163. package/tests/functions/module_logical_test.ts +0 -369
  164. package/tests/functions/module_lookup_test.ts +0 -541
  165. package/tests/functions/module_math_test.ts +0 -2482
  166. package/tests/functions/module_operators_test.ts +0 -955
  167. package/tests/functions/module_statistical_test.ts +0 -2014
  168. package/tests/functions/module_text_test.ts +0 -667
  169. package/tests/helpers/coordinates_test.ts +0 -25
  170. package/tests/helpers/misc_test.ts +0 -95
  171. package/tests/helpers/numbers_test.ts +0 -196
  172. package/tests/helpers/zones_test.ts +0 -97
  173. package/tests/helpers.ts +0 -384
  174. package/tests/menu_items_registry_test.ts +0 -540
  175. package/tests/model/plugins/__snapshots__/chart_test.ts.snap +0 -90
  176. package/tests/model/plugins/chart_test.ts +0 -562
  177. package/tests/model_test.ts +0 -82
  178. package/tests/plugins/__snapshots__/conditional_formatting_test.ts.snap +0 -131
  179. package/tests/plugins/__snapshots__/renderer_test.ts.snap +0 -371
  180. package/tests/plugins/autofill_test.ts +0 -457
  181. package/tests/plugins/borders_test.ts +0 -295
  182. package/tests/plugins/clipboard_test.ts +0 -1180
  183. package/tests/plugins/conditional_formatting_test.ts +0 -1253
  184. package/tests/plugins/core_test.ts +0 -614
  185. package/tests/plugins/edition_test.ts +0 -100
  186. package/tests/plugins/evaluation_async_test.ts +0 -332
  187. package/tests/plugins/evaluation_dates_test.ts +0 -79
  188. package/tests/plugins/evaluation_test.ts +0 -901
  189. package/tests/plugins/figures_test.ts +0 -327
  190. package/tests/plugins/formatting_test.ts +0 -391
  191. package/tests/plugins/grid_manipulation_test.ts +0 -1366
  192. package/tests/plugins/highlight_test.ts +0 -413
  193. package/tests/plugins/history_test.ts +0 -142
  194. package/tests/plugins/import_export_test.ts +0 -276
  195. package/tests/plugins/merges_test.ts +0 -490
  196. package/tests/plugins/navigation_test.ts +0 -181
  197. package/tests/plugins/plugins/evaluation_test.ts +0 -111
  198. package/tests/plugins/renderer_test.ts +0 -598
  199. package/tests/plugins/resizing_test.ts +0 -152
  200. package/tests/plugins/selection_input_test.ts +0 -409
  201. package/tests/plugins/selection_test.ts +0 -442
  202. package/tests/plugins/sheets_test.ts +0 -643
  203. package/tests/plugins/style_test.ts +0 -90
  204. package/tsconfig.json +0 -22
@@ -1,139 +0,0 @@
1
- import { evaluateCell } from "../helpers";
2
-
3
- describe("info", () => {
4
- //----------------------------------------------------------------------------
5
- // ISERROR
6
- //----------------------------------------------------------------------------
7
-
8
- test("ISERROR: functional tests on simple arguments", () => {
9
- expect(evaluateCell("A1", { A1: "=ISERROR()" })).toBe("#BAD_EXPR");
10
- expect(evaluateCell("A1", { A1: '=ISERROR("")' })).toBe(false);
11
- expect(evaluateCell("A1", { A1: '=ISERROR("test")' })).toBe(false);
12
- expect(evaluateCell("A1", { A1: "=ISERROR(TRUE)" })).toBe(false);
13
- expect(evaluateCell("A1", { A1: "=ISERROR(FALSE)" })).toBe(false);
14
- expect(evaluateCell("A1", { A1: "=ISERROR(1)" })).toBe(false);
15
- expect(evaluateCell("A1", { A1: "=ISERROR(3%)" })).toBe(false);
16
-
17
- expect(evaluateCell("A1", { A1: "=ISERROR(1/0)" })).toBe(true); // corespond to #ERROR error
18
-
19
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)" })).toBe(false);
20
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: "TEST" })).toBe(false);
21
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: "TRUE" })).toBe(false);
22
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: "1" })).toBe(false);
23
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: '"test"' })).toBe(false);
24
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: '"123"' })).toBe(false);
25
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: '="TRUE"' })).toBe(false);
26
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: "=true" })).toBe(false);
27
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: "=false" })).toBe(false);
28
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: "=123" })).toBe(false);
29
-
30
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: "=A2" })).toBe(true); // corespond to #CYCLE error
31
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: "=(+" })).toBe(true); // corespond to #BAD_EXPR error
32
- expect(evaluateCell("A1", { A1: "=ISERROR(A2)", A2: "=SQRT(-1)" })).toBe(true); // corespond to #ERROR error
33
- });
34
-
35
- //----------------------------------------------------------------------------
36
- // ISLOGICAL
37
- //----------------------------------------------------------------------------
38
-
39
- test("ISLOGICAL: functional tests on simple arguments", () => {
40
- expect(evaluateCell("A1", { A1: "=ISLOGICAL()" })).toBe("#BAD_EXPR"); // @compatibility: on google sheets, return #N/A
41
- expect(evaluateCell("A1", { A1: '=ISLOGICAL("")' })).toBe(false);
42
- expect(evaluateCell("A1", { A1: '=ISLOGICAL("test")' })).toBe(false);
43
- expect(evaluateCell("A1", { A1: '=ISLOGICAL("TRUE")' })).toBe(false);
44
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(TRUE)" })).toBe(true);
45
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(FALSE)" })).toBe(true);
46
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(1)" })).toBe(false);
47
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(1.2)" })).toBe(false);
48
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(3%)" })).toBe(false);
49
-
50
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)" })).toBe(false);
51
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)", A2: "TEST" })).toBe(false);
52
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)", A2: "TRUE" })).toBe(true);
53
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)", A2: "FALSE" })).toBe(true);
54
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)", A2: "1" })).toBe(false);
55
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)", A2: '"test"' })).toBe(false);
56
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)", A2: '"TRUE"' })).toBe(false);
57
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)", A2: '"123"' })).toBe(false);
58
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)", A2: '="TRUE"' })).toBe(false);
59
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)", A2: "=true" })).toBe(true);
60
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)", A2: "=false" })).toBe(true);
61
- expect(evaluateCell("A1", { A1: "=ISLOGICAL(A2)", A2: "=123" })).toBe(false);
62
- });
63
-
64
- //----------------------------------------------------------------------------
65
- // ISNONTEXT
66
- //----------------------------------------------------------------------------
67
-
68
- test("ISNONTEXT: functional tests on simple arguments", () => {
69
- expect(evaluateCell("A1", { A1: "=ISNONTEXT()" })).toBe("#BAD_EXPR"); // @compatibility: on google sheets, return #N/A
70
- expect(evaluateCell("A1", { A1: '=ISNONTEXT("")' })).toBe(false);
71
- expect(evaluateCell("A1", { A1: '=ISNONTEXT("test")' })).toBe(false);
72
- expect(evaluateCell("A1", { A1: '=ISNONTEXT("TRUE")' })).toBe(false);
73
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(TRUE)" })).toBe(true);
74
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(123)" })).toBe(true);
75
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(3%)" })).toBe(true);
76
-
77
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(A2)" })).toBe(true);
78
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(A2)", A2: "TEST" })).toBe(false);
79
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(A2)", A2: "TRUE" })).toBe(true);
80
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(A2)", A2: "123" })).toBe(true);
81
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(A2)", A2: '"test"' })).toBe(false);
82
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(A2)", A2: '"TRUE"' })).toBe(false);
83
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(A2)", A2: '"123"' })).toBe(false);
84
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(A2)", A2: '="TRUE"' })).toBe(false);
85
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(A2)", A2: "=true" })).toBe(true);
86
- expect(evaluateCell("A1", { A1: "=ISNONTEXT(A2)", A2: "=123" })).toBe(true);
87
- });
88
-
89
- //----------------------------------------------------------------------------
90
- // ISNUMBER
91
- //----------------------------------------------------------------------------
92
-
93
- test("ISNUMBER: functional tests on simple arguments", () => {
94
- expect(evaluateCell("A1", { A1: "=ISNUMBER()" })).toBe("#BAD_EXPR"); // @compatibility: on google sheets, return #N/A
95
- expect(evaluateCell("A1", { A1: '=ISNUMBER("")' })).toBe(false);
96
- expect(evaluateCell("A1", { A1: '=ISNUMBER("test")' })).toBe(false);
97
- expect(evaluateCell("A1", { A1: '=ISNUMBER("TRUE")' })).toBe(false);
98
- expect(evaluateCell("A1", { A1: "=ISNUMBER(TRUE)" })).toBe(false);
99
- expect(evaluateCell("A1", { A1: "=ISNUMBER(123)" })).toBe(true);
100
- expect(evaluateCell("A1", { A1: "=ISNUMBER(1.2)" })).toBe(true);
101
- expect(evaluateCell("A1", { A1: "=ISNUMBER(3%)" })).toBe(true);
102
-
103
- expect(evaluateCell("A1", { A1: "=ISNUMBER(A2)" })).toBe(false);
104
- expect(evaluateCell("A1", { A1: "=ISNUMBER(A2)", A2: "TEST" })).toBe(false);
105
- expect(evaluateCell("A1", { A1: "=ISNUMBER(A2)", A2: "TRUE" })).toBe(false);
106
- expect(evaluateCell("A1", { A1: "=ISNUMBER(A2)", A2: "123" })).toBe(true);
107
- expect(evaluateCell("A1", { A1: "=ISNUMBER(A2)", A2: '"test"' })).toBe(false);
108
- expect(evaluateCell("A1", { A1: "=ISNUMBER(A2)", A2: '"TRUE"' })).toBe(false);
109
- expect(evaluateCell("A1", { A1: "=ISNUMBER(A2)", A2: '"123"' })).toBe(false);
110
- expect(evaluateCell("A1", { A1: "=ISNUMBER(A2)", A2: '="TRUE"' })).toBe(false);
111
- expect(evaluateCell("A1", { A1: "=ISNUMBER(A2)", A2: "=true" })).toBe(false);
112
- expect(evaluateCell("A1", { A1: "=ISNUMBER(A2)", A2: "=123" })).toBe(true);
113
- });
114
-
115
- //----------------------------------------------------------------------------
116
- // ISTEXT
117
- //----------------------------------------------------------------------------
118
-
119
- test("ISTEXT: functional tests on simple arguments", () => {
120
- expect(evaluateCell("A1", { A1: "=ISTEXT()" })).toBe("#BAD_EXPR"); // @compatibility: on google sheets, return #N/A
121
- expect(evaluateCell("A1", { A1: '=ISTEXT("")' })).toBe(true);
122
- expect(evaluateCell("A1", { A1: '=ISTEXT("test")' })).toBe(true);
123
- expect(evaluateCell("A1", { A1: '=ISTEXT("TRUE")' })).toBe(true);
124
- expect(evaluateCell("A1", { A1: "=ISTEXT(TRUE)" })).toBe(false);
125
- expect(evaluateCell("A1", { A1: "=ISTEXT(123)" })).toBe(false);
126
- expect(evaluateCell("A1", { A1: "=ISTEXT(3%)" })).toBe(false);
127
-
128
- expect(evaluateCell("A1", { A1: "=ISTEXT(A2)" })).toBe(false);
129
- expect(evaluateCell("A1", { A1: "=ISTEXT(A2)", A2: "TEST" })).toBe(true);
130
- expect(evaluateCell("A1", { A1: "=ISTEXT(A2)", A2: "TRUE" })).toBe(false);
131
- expect(evaluateCell("A1", { A1: "=ISTEXT(A2)", A2: "123" })).toBe(false);
132
- expect(evaluateCell("A1", { A1: "=ISTEXT(A2)", A2: '"test"' })).toBe(true);
133
- expect(evaluateCell("A1", { A1: "=ISTEXT(A2)", A2: '"TRUE"' })).toBe(true);
134
- expect(evaluateCell("A1", { A1: "=ISTEXT(A2)", A2: '"123"' })).toBe(true);
135
- expect(evaluateCell("A1", { A1: "=ISTEXT(A2)", A2: '="TRUE"' })).toBe(true);
136
- expect(evaluateCell("A1", { A1: "=ISTEXT(A2)", A2: "=true" })).toBe(false);
137
- expect(evaluateCell("A1", { A1: "=ISTEXT(A2)", A2: "=123" })).toBe(false);
138
- });
139
- });
@@ -1,369 +0,0 @@
1
- import { evaluateCell } from "../helpers";
2
-
3
- describe("bool", () => {
4
- //----------------------------------------------------------------------------
5
- // AND
6
- //----------------------------------------------------------------------------
7
-
8
- test("AND: functional tests on simple arguments", () => {
9
- expect(evaluateCell("A1", { A1: "=AND( , )" })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
10
- expect(evaluateCell("A1", { A1: "=AND(TRUE, TRUE)" })).toBe(true);
11
- expect(evaluateCell("A1", { A1: "=AND(FALSE, FALSE)" })).toBe(false);
12
- expect(evaluateCell("A1", { A1: "=AND(FALSE, TRUE)" })).toBe(false);
13
- });
14
-
15
- test("AND: casting tests on simple arguments", () => {
16
- expect(evaluateCell("A1", { A1: '=AND("" , TRUE)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
17
- expect(evaluateCell("A1", { A1: '=AND("true" , TRUE)' })).toBe(true);
18
- expect(evaluateCell("A1", { A1: '=AND("false" , TRUE)' })).toBe(false);
19
- expect(evaluateCell("A1", { A1: '=AND("test" , TRUE)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
20
- expect(evaluateCell("A1", { A1: '=AND("test" , FALSE)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
21
- expect(evaluateCell("A1", { A1: '=AND(TRUE , "test")' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
22
- expect(evaluateCell("A1", { A1: '=AND(FALSE , "test")' })).toBe(false);
23
- expect(evaluateCell("A1", { A1: '=AND(TRUE , "1")' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
24
- expect(evaluateCell("A1", { A1: "=AND(0 , TRUE)" })).toBe(false);
25
- expect(evaluateCell("A1", { A1: "=AND(42 , TRUE)" })).toBe(true);
26
- expect(evaluateCell("A1", { A1: "=AND(-42 , TRUE)" })).toBe(true);
27
- });
28
-
29
- test("AND: functional tests on cell arguments", () => {
30
- expect(evaluateCell("A1", { A1: "=AND(A2:A5)", A2: "test", A3: "TRUE", A4: "FALSE" })).toBe(
31
- false
32
- );
33
- expect(evaluateCell("A1", { A1: "=AND(A2:A5)", A2: "test", A3: "TRUE", A4: "TRUE" })).toBe(
34
- true
35
- );
36
- });
37
-
38
- test("AND: casting tests on cell arguments", () => {
39
- expect(evaluateCell("A1", { A1: "=AND(A2:A5)", A2: "test", A3: "TRUE", A4: "1" })).toBe(true);
40
- expect(evaluateCell("A1", { A1: "=AND(A2:A5)", A2: "test", A3: "TRUE", A4: "0" })).toBe(false);
41
- expect(evaluateCell("A1", { A1: "=AND(A2:A5)" })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
42
- expect(evaluateCell("A1", { A1: "=AND(A2:A5)", A3: '="TRUE"' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
43
- expect(evaluateCell("A1", { A1: "=AND(A2:A5)", A3: "42" })).toBe(true);
44
- expect(evaluateCell("A1", { A1: "=AND(A2:A5)", A3: '="42"' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
45
- });
46
-
47
- //----------------------------------------------------------------------------
48
- // IF
49
- //----------------------------------------------------------------------------
50
-
51
- test("IF: functional tests on simple arguments", () => {
52
- expect(evaluateCell("A1", { A1: "=IF( , , )" })).toBe("");
53
- expect(evaluateCell("A1", { A1: "=IF( , 1, 2)" })).toBe(2);
54
- expect(evaluateCell("A1", { A1: "=IF(FALSE , 1, 2)" })).toBe(2);
55
- expect(evaluateCell("A1", { A1: "=IF(TRUE , 1, 2)" })).toBe(1);
56
- expect(evaluateCell("A1", { A1: '=IF(TRUE , "1", 2)' })).toBe("1");
57
- expect(evaluateCell("A1", { A1: "=IF(TRUE , FALSE, 2)" })).toBe(false);
58
- });
59
-
60
- test("IF: functional tests on simple arguments with errors", () => {
61
- expect(evaluateCell("A1", { A1: "=IF(TRUE,42,1/0)" })).toBe(42);
62
- expect(evaluateCell("A1", { A1: "=IF(TRUE,1/0,42)" })).toBe("#ERROR"); // @compatibility: on google sheets, return #DIV/0!
63
- });
64
-
65
- test("IF: casting tests on simple arguments", () => {
66
- expect(evaluateCell("A1", { A1: "=IF(42, 1, 2)" })).toBe(1);
67
- expect(evaluateCell("A1", { A1: "=IF(0, 1, 2)" })).toBe(2);
68
- expect(evaluateCell("A1", { A1: '=IF("test", 1, 2)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
69
- });
70
-
71
- test("IF: functional tests on cell arguments", () => {
72
- expect(evaluateCell("A1", { A1: "=IF(A2, A3, A4)" })).toBe("");
73
- expect(evaluateCell("A1", { A1: "=IF(A2, A3, A4)" })).toBe("");
74
- expect(evaluateCell("A1", { A1: "=IF(A2, A3, A4)", A2: "TRUE", A3: "1", A4: "2" })).toBe(1);
75
- expect(evaluateCell("A1", { A1: "=IF(A2, A3, A4)", A2: "FALSE", A3: "1", A4: "2" })).toBe(2);
76
- expect(evaluateCell("A1", { A1: "=IF(A2, A3, A4)", A2: " ", A3: "1", A4: "2" })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
77
- });
78
-
79
- test("IF: functional tests on cell arguments with errors", () => {
80
- expect(evaluateCell("A1", { A1: "=IF(A2, A3, A4)", A2: "TRUE", A3: "42", A4: "=1/0" })).toBe(
81
- 42
82
- );
83
- expect(evaluateCell("A1", { A1: "=IF(A2, A3, A4)", A2: "TRUE", A3: "=1/0", A4: "42" })).toBe(
84
- "#ERROR"
85
- ); // @compatibility: on google sheets, return #DIV/0!
86
- });
87
-
88
- test("IF: casting tests on cell arguments", () => {
89
- expect(evaluateCell("A1", { A1: "=IF(A2, A3, A4)", A2: "0", A3: "1", A4: "2" })).toBe(2);
90
- expect(evaluateCell("A1", { A1: "=IF(A2, A3, A4)", A3: "1", A4: "2" })).toBe(2);
91
- });
92
-
93
- //----------------------------------------------------------------------------
94
- // IFERROR
95
- //----------------------------------------------------------------------------
96
-
97
- test("IFERROR: functional tests on simple arguments", () => {
98
- expect(evaluateCell("A1", { A1: "=IFERROR( )" })).toBe("#BAD_EXPR"); // @compatibility: on google sheets, return #VALUE!
99
- expect(evaluateCell("A1", { A1: "=IFERROR( , )" })).toBe("");
100
- expect(evaluateCell("A1", { A1: "=IFERROR(FALSE , 42)" })).toBe(false);
101
- expect(evaluateCell("A1", { A1: "=IFERROR(TRUE , 42)" })).toBe(true);
102
- expect(evaluateCell("A1", { A1: '=IFERROR("" , 42)' })).toBe("");
103
- expect(evaluateCell("A1", { A1: "=IFERROR(3% , 42)" })).toBe(0.03);
104
- });
105
-
106
- test("IFERROR: functional tests on simple arguments with errors", () => {
107
- expect(evaluateCell("A1", { A1: "=IFERROR(FALSE, 42/0)" })).toBe(false);
108
- expect(evaluateCell("A1", { A1: "=IFERROR(42/0, FALSE)" })).toBe(false);
109
- });
110
-
111
- test("IFERROR: functional tests on cell arguments", () => {
112
- expect(evaluateCell("A1", { A1: "=IFERROR(A2, 42)", A2: "=A2" })).toBe(42); // corespond to #CYCLE error
113
- expect(evaluateCell("A1", { A1: "=IFERROR(A2, 42)", A2: "=(+" })).toBe(42); // corespond to #BAD_EXPR error
114
- expect(evaluateCell("A1", { A1: "=IFERROR(A2, 42)", A2: "=SQRT(-1)" })).toBe(42); // corespond to #ERROR error
115
-
116
- expect(evaluateCell("A1", { A1: "=IFERROR(A2, 42)" })).toBe("");
117
- expect(evaluateCell("A1", { A1: "=IFERROR(A2, 42)", A2: "FALSE" })).toBe(false);
118
- expect(evaluateCell("A1", { A1: "=IFERROR(A2, 42)", A2: "TRUE" })).toBe(true);
119
- expect(evaluateCell("A1", { A1: "=IFERROR(A2, 42)", A2: "3" })).toBe(3);
120
- expect(evaluateCell("A1", { A1: "=IFERROR(A2, 42)", A2: "test" })).toBe("test");
121
- });
122
-
123
- test("IFERROR: functional tests on cell arguments with errors", () => {
124
- expect(evaluateCell("A1", { A1: "=IFERROR(A2, A3)", A2: "TRUE", A3: "=1/0" })).toBe(true);
125
- expect(evaluateCell("A1", { A1: "=IFERROR(A2, A3)", A2: "=1/0", A3: "=1/0" })).toBe("#ERROR"); // @compatibility: on google sheets, return #DIV/0!
126
- });
127
-
128
- //----------------------------------------------------------------------------
129
- // IFS
130
- //----------------------------------------------------------------------------
131
-
132
- test("IFS: functional tests on simple arguments", () => {
133
- expect(evaluateCell("A1", { A1: "=IFS( , )" })).toBe("#ERROR"); // @compatibility: on google sheets, return #N/A
134
- expect(evaluateCell("A1", { A1: "=IFS( , 1)" })).toBe("#ERROR"); // @compatibility: on google sheets, return #N/A
135
- expect(evaluateCell("A1", { A1: "=IFS(FALSE, 1)" })).toBe("#ERROR"); // @compatibility: on google sheets, return #N/A
136
- expect(evaluateCell("A1", { A1: "=IFS(TRUE, 1)" })).toBe(1);
137
- expect(evaluateCell("A1", { A1: '=IFS(TRUE, "1")' })).toBe("1");
138
- expect(evaluateCell("A1", { A1: "=IFS(TRUE, FALSE)" })).toBe(false);
139
- });
140
-
141
- test("IFS: functional tests on simple arguments with errors", () => {
142
- expect(evaluateCell("A1", { A1: '=IFS(TRUE, "ok1", 1/0, 1/0)' })).toBe("ok1");
143
- expect(evaluateCell("A1", { A1: '=IFS(1/0, "ok1", TRUE, 42)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #DIV/0!
144
- expect(evaluateCell("A1", { A1: "=IFS(TRUE, 1/0, TRUE, 42)" })).toBe("#ERROR"); // @compatibility: on google sheets, return #DIV/0!
145
- });
146
-
147
- test("IFS: casting tests on simple arguments", () => {
148
- expect(evaluateCell("A1", { A1: "=IFS(42, 1)" })).toBe(1);
149
- expect(evaluateCell("A1", { A1: "=IFS(0, 1)" })).toBe("#ERROR"); // @compatibility: on google sheets, return #N/A
150
- expect(evaluateCell("A1", { A1: '=IFS("test", 1)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
151
- });
152
-
153
- test("IFS: functional tests on cell arguments", () => {
154
- expect(evaluateCell("A1", { A1: "=IFS(A2, A3)", A3: "1" })).toBe("#ERROR"); // @compatibility: on google sheets, return #N/A
155
- expect(evaluateCell("A1", { A1: "=IFS(A2, A3)", A2: "TRUE", A3: "1" })).toBe(1);
156
- expect(evaluateCell("A1", { A1: "=IFS(A2, A3)", A2: "FALSE", A3: "1" })).toBe("#ERROR"); // @compatibility: on google sheets, return #N/A
157
- expect(evaluateCell("A1", { A1: "=IFS(A2, A3)", A2: "test", A3: "1" })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
158
- expect(
159
- evaluateCell("A1", {
160
- A1: "=IFS(A2, A3, A4, A5)",
161
- A2: "False",
162
- A3: "ok1",
163
- A4: "TRUE",
164
- A5: "ok2",
165
- })
166
- ).toBe("ok2");
167
- expect(
168
- evaluateCell("A1", {
169
- A1: "=IFS(A2, A3, A4, A5)",
170
- A2: "TRUE",
171
- A3: "ok1",
172
- A4: "TRUE",
173
- A5: "ok2",
174
- })
175
- ).toBe("ok1");
176
- });
177
-
178
- test("IFS: functional tests on cell arguments with errors", () => {
179
- expect(
180
- evaluateCell("A1", {
181
- A1: "=IFS(A2, A3, A4, A5)",
182
- A2: "TRUE",
183
- A3: "ok1",
184
- A4: "=1/0",
185
- A5: "=1/0",
186
- })
187
- ).toBe("ok1");
188
- expect(
189
- evaluateCell("A1", {
190
- A1: "=IFS(A2, A3, A4, A5)",
191
- A2: "=1/0",
192
- A3: "ok1",
193
- A4: "TRUE",
194
- A5: "42",
195
- })
196
- ).toBe("#ERROR"); // @compatibility: on google sheets, return #DIV/0!
197
- expect(
198
- evaluateCell("A1", {
199
- A1: "=IFS(A2, A3, A4, A5)",
200
- A2: "TRUE",
201
- A3: "=1/0",
202
- A4: "TRUE",
203
- A5: "42",
204
- })
205
- ).toBe("#ERROR"); // @compatibility: on google sheets, return #DIV/0!
206
- });
207
-
208
- test("IFS: casting tests on cell arguments", () => {
209
- expect(evaluateCell("A1", { A1: "=IFS(A2, A3)", A2: "test", A3: "1" })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
210
- expect(evaluateCell("A1", { A1: "=IFS(A2, A3)", A2: "1", A3: "2" })).toBe(2);
211
- expect(
212
- evaluateCell("A1", { A1: "=IFS(A2, A3, A4, A5)", A2: "42", A3: "ok1", A4: "TRUE", A5: "ok2" })
213
- ).toBe("ok1");
214
- expect(
215
- evaluateCell("A1", { A1: "=IFS(A2, A3, A4, A5)", A2: "0", A3: "ok1", A4: "TRUE", A5: "ok2" })
216
- ).toBe("ok2");
217
- expect(
218
- evaluateCell("A1", {
219
- A1: "=IFS(A2, A3, A4, A5)",
220
- A2: "test",
221
- A3: "ok1",
222
- A4: "TRUE",
223
- A5: "ok2",
224
- })
225
- ).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
226
- });
227
-
228
- //----------------------------------------------------------------------------
229
- // NOT
230
- //----------------------------------------------------------------------------
231
-
232
- test("NOT: functional tests on simple arguments", () => {
233
- expect(evaluateCell("A1", { A1: "=NOT()" })).toBe("#BAD_EXPR"); // @compatibility: on google sheets, return #N/A// @compatibility: on google sheets, return #N/A
234
- expect(evaluateCell("A1", { A1: "=NOT(TRUE)" })).toBe(false);
235
- expect(evaluateCell("A1", { A1: "=NOT(FALSE)" })).toBe(true);
236
- });
237
-
238
- test("NOT: casting tests on simple arguments", () => {
239
- expect(evaluateCell("A1", { A1: "=NOT(0)" })).toBe(true);
240
- expect(evaluateCell("A1", { A1: "=NOT(1)" })).toBe(false);
241
- expect(evaluateCell("A1", { A1: "=NOT(42)" })).toBe(false);
242
- expect(evaluateCell("A1", { A1: '=NOT("test")' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
243
- expect(evaluateCell("A1", { A1: '=NOT("true")' })).toBe(false);
244
- expect(evaluateCell("A1", { A1: '=NOT("false")' })).toBe(true);
245
- expect(evaluateCell("A1", { A1: '=NOT("1")' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
246
- });
247
-
248
- test("NOT: functional tests on cell arguments", () => {
249
- expect(evaluateCell("A1", { A1: "=NOT(A2)" })).toBe(true);
250
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: "TRUE" })).toBe(false);
251
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: "FALSE" })).toBe(true);
252
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: "=TRUE" })).toBe(false);
253
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: "=FALSE" })).toBe(true);
254
- });
255
-
256
- test("NOT: casting tests on cell arguments", () => {
257
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: "0" })).toBe(true);
258
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: "1" })).toBe(false);
259
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: "42" })).toBe(false);
260
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: "test" })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
261
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: '"true"' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
262
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: '"false"' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
263
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: '="true"' })).toBe(false);
264
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: '="false"' })).toBe(true);
265
- expect(evaluateCell("A1", { A1: "=NOT(A2)", A2: '"0"' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
266
- });
267
-
268
- //----------------------------------------------------------------------------
269
- // OR
270
- //----------------------------------------------------------------------------
271
-
272
- test("OR: functional tests on simple arguments", () => {
273
- expect(evaluateCell("A1", { A1: "=OR( , )" })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
274
- expect(evaluateCell("A1", { A1: "=OR(TRUE, TRUE)" })).toBe(true);
275
- expect(evaluateCell("A1", { A1: "=OR(FALSE, FALSE)" })).toBe(false);
276
- expect(evaluateCell("A1", { A1: "=OR(FALSE, TRUE)" })).toBe(true);
277
- });
278
-
279
- test("OR: casting tests on simple arguments", () => {
280
- expect(evaluateCell("A1", { A1: '=OR("" , TRUE)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
281
- expect(evaluateCell("A1", { A1: '=OR("true" , TRUE)' })).toBe(true);
282
- expect(evaluateCell("A1", { A1: '=OR("false" , TRUE)' })).toBe(true);
283
- expect(evaluateCell("A1", { A1: '=OR("false" , FALSE)' })).toBe(false);
284
- expect(evaluateCell("A1", { A1: '=OR("test" , TRUE)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
285
- expect(evaluateCell("A1", { A1: '=OR("test" , FALSE)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
286
- expect(evaluateCell("A1", { A1: '=OR(FALSE , "test")' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
287
- expect(evaluateCell("A1", { A1: '=OR(TRUE , "test")' })).toBe(true);
288
- expect(evaluateCell("A1", { A1: '=OR(TRUE , "1")' })).toBe(true);
289
- expect(evaluateCell("A1", { A1: '=OR("1", TRUE)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
290
- expect(evaluateCell("A1", { A1: "=OR(0 , TRUE)" })).toBe(true);
291
- expect(evaluateCell("A1", { A1: "=OR(42 , FALSE)" })).toBe(true);
292
- expect(evaluateCell("A1", { A1: "=OR(-42 , FALSE)" })).toBe(true);
293
- });
294
-
295
- test("OR: functional tests on cell arguments", () => {
296
- expect(evaluateCell("A1", { A1: "=OR(A2:A5)", A2: "test", A3: "TRUE", A4: "FALSE" })).toBe(
297
- true
298
- );
299
- expect(evaluateCell("A1", { A1: "=OR(A2:A5)", A2: "test", A3: "TRUE", A4: "TRUE" })).toBe(true);
300
- expect(evaluateCell("A1", { A1: "=OR(A2:A5)", A2: "test", A3: "FALSE", A4: "FALSE" })).toBe(
301
- false
302
- );
303
- });
304
-
305
- test("OR: casting tests on cell arguments", () => {
306
- expect(evaluateCell("A1", { A1: "=OR(A2:A5)", A2: "test", A3: "TRUE", A4: "0" })).toBe(true);
307
- expect(evaluateCell("A1", { A1: "=OR(A2:A5)", A2: "test", A3: "FALSE", A4: "0" })).toBe(false);
308
- expect(evaluateCell("A1", { A1: "=OR(A2:A5)" })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
309
- expect(evaluateCell("A1", { A1: "=OR(A2:A5)", A3: '="TRUE"' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
310
- expect(evaluateCell("A1", { A1: "=OR(A2:A5)", A3: "42" })).toBe(true);
311
- expect(evaluateCell("A1", { A1: "=OR(A2:A5)", A3: '="42"' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
312
- });
313
-
314
- //----------------------------------------------------------------------------
315
- // XOR
316
- //----------------------------------------------------------------------------
317
-
318
- test("XOR: functional tests on simple arguments", () => {
319
- expect(evaluateCell("A1", { A1: "=XOR( , )" })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
320
- expect(evaluateCell("A1", { A1: "=XOR(TRUE, TRUE)" })).toBe(false);
321
- expect(evaluateCell("A1", { A1: "=XOR(FALSE, FALSE)" })).toBe(false);
322
- expect(evaluateCell("A1", { A1: "=XOR(FALSE, TRUE)" })).toBe(true);
323
- });
324
-
325
- test("XOR: casting tests on simple arguments", () => {
326
- expect(evaluateCell("A1", { A1: '=XOR("" , TRUE)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
327
- expect(evaluateCell("A1", { A1: '=XOR("true" , TRUE)' })).toBe(false);
328
- expect(evaluateCell("A1", { A1: '=XOR("false" , TRUE)' })).toBe(true);
329
- expect(evaluateCell("A1", { A1: '=XOR("false" , FALSE)' })).toBe(false);
330
- expect(evaluateCell("A1", { A1: '=XOR("test" , TRUE)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
331
- expect(evaluateCell("A1", { A1: '=XOR("test" , FALSE)' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
332
- expect(evaluateCell("A1", { A1: '=XOR(TRUE , "test" )' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
333
- expect(evaluateCell("A1", { A1: '=XOR(FALSE , "test" )' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
334
- expect(evaluateCell("A1", { A1: '=XOR(TRUE , "1")' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
335
- expect(evaluateCell("A1", { A1: "=XOR(0 , TRUE)" })).toBe(true);
336
- expect(evaluateCell("A1", { A1: "=XOR(42 , FALSE)" })).toBe(true);
337
- expect(evaluateCell("A1", { A1: "=XOR(-42 , FALSE)" })).toBe(true);
338
- });
339
-
340
- test("XOR: functional tests on cell arguments", () => {
341
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)", A2: "test", A3: "TRUE", A4: "FALSE" })).toBe(
342
- true
343
- );
344
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)", A2: "test", A3: "TRUE", A4: "TRUE" })).toBe(
345
- false
346
- );
347
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)", A2: "TRUE", A3: "TRUE", A4: "TRUE" })).toBe(
348
- true
349
- );
350
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)", A2: "FALSE", A3: "FALSE", A4: "FALSE" })).toBe(
351
- false
352
- );
353
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)", A2: "FALSE", A3: "TRUE", A4: "TRUE" })).toBe(
354
- false
355
- );
356
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)", A2: "test", A3: "FALSE", A4: "FALSE" })).toBe(
357
- false
358
- );
359
- });
360
-
361
- test("XOR: casting tests on cell arguments", () => {
362
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)", A2: "test", A3: "TRUE", A4: "0" })).toBe(true);
363
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)", A2: "test", A3: "FALSE", A4: "0" })).toBe(false);
364
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)" })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
365
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)", A3: '="TRUE"' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
366
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)", A3: "42" })).toBe(true);
367
- expect(evaluateCell("A1", { A1: "=XOR(A2:A5)", A3: '="42"' })).toBe("#ERROR"); // @compatibility: on google sheets, return #VALUE!
368
- });
369
- });