# This PR introduces:
## Parsing arrays:
{1,2,3} and {1;2;3}
Note that array elements can be numbers, booleans and errors (#VALUE!)
## Evaluating arrays in the SUM function
=SUM({1,2,3}) works!
## Evaluating arithmetic operation with arrays
=SUM({1,2,3} * 8) or =SUM({1,2,3}+{2,4,5}) works
This is done with just one function (handle_arithmetic) for most operations
## Some mathematical functions implement arrays
=SUM(SIN({1,2,3})) works
This is done with macros. See fn_single_number
So that implementing new functions that supports array are easy
# Not done in this PR
## Most functions are not supporting arrays
When that happens we either through #N/IMPL! (not implemented error)
or do implicit intersection. Some functions will be rather trivial to "arraify" some will be hard
## The final result in a cell cannot be an array
The formula ={1,2,3} in a cell will result in #N/IMPL!
## Exporting arrays to Excel might not work correctly
Excel uses the cm (cell metadata) for formulas that contain dynamic arrays.
Although the present PR does not introduce dynamic arrays some formulas like =SUM(SIN({1,2,3}))
is considered a dynamic formula
## There are not a lot of tests in this delivery
The bulk of the tests will be added once we start going function by function# This PR introduces:
## Parsing arrays:
{1,2,3} and {1;2;3}
Note that array elements can be numbers, booleans and errors (#VALUE!)
## Evaluating arrays in the SUM function
=SUM({1,2,3}) works!
## Evaluating arithmetic operation with arrays
=SUM({1,2,3} * 8) or =SUM({1,2,3}+{2,4,5}) works
This is done with just one function (handle_arithmetic) for most operations
## Some mathematical functions implement arrays
=SUM(SIN({1,2,3})) works
This is done with macros. See fn_single_number
So that implementing new functions that supports array are easy
# Not done in this PR
## Most functions are not supporting arrays
When that happens we either through #N/IMPL! (not implemented error)
or do implicit intersection. Some functions will be rather trivial to "arraify" some will be hard
## The final result in a cell cannot be an array
The formula ={1,2,3} in a cell will result in #N/IMPL!
## Exporting arrays to Excel might not work correctly
Excel uses the cm (cell metadata) for formulas that contain dynamic arrays.
Although the present PR does not introduce dynamic arrays some formulas like =SUM(SIN({1,2,3}))
is considered a dynamic formula
## There are not a lot of tests in this delivery
The bulk of the tests will be added once we start going function by function
## The array parsing does not respect the locale
Locales that use ',' as a decimal separator need to use something different for arrays
## The might introduce a small performance penalty
We haven't been benchmarking, and having closures for every arithmetic operation and every function
evaluation will introduce a performance hit. Fixing that in he future is not so hard writing tailored
code for the operation
69 lines
1.4 KiB
Rust
69 lines
1.4 KiB
Rust
mod test_actions;
|
|
mod test_binary_search;
|
|
mod test_cell;
|
|
mod test_cell_clear_contents;
|
|
mod test_circular_references;
|
|
mod test_column_width;
|
|
mod test_criteria;
|
|
mod test_currency;
|
|
mod test_date_and_time;
|
|
mod test_error_propagation;
|
|
mod test_fn_average;
|
|
mod test_fn_averageifs;
|
|
mod test_fn_choose;
|
|
mod test_fn_concatenate;
|
|
mod test_fn_count;
|
|
mod test_fn_day;
|
|
mod test_fn_exact;
|
|
mod test_fn_financial;
|
|
mod test_fn_formulatext;
|
|
mod test_fn_if;
|
|
mod test_fn_maxifs;
|
|
mod test_fn_minifs;
|
|
mod test_fn_or_xor;
|
|
mod test_fn_product;
|
|
mod test_fn_rept;
|
|
mod test_fn_sum;
|
|
mod test_fn_sumifs;
|
|
mod test_fn_textbefore;
|
|
mod test_fn_textjoin;
|
|
mod test_fn_unicode;
|
|
mod test_frozen_rows_columns;
|
|
mod test_general;
|
|
mod test_math;
|
|
mod test_metadata;
|
|
mod test_model_cell_clear_all;
|
|
mod test_model_is_empty_cell;
|
|
mod test_move_formula;
|
|
mod test_quote_prefix;
|
|
mod test_row_column_styles;
|
|
mod test_set_user_input;
|
|
mod test_sheet_markup;
|
|
mod test_sheets;
|
|
mod test_styles;
|
|
mod test_trigonometric;
|
|
mod test_true_false;
|
|
mod test_workbook;
|
|
mod test_worksheet;
|
|
pub(crate) mod util;
|
|
|
|
mod engineering;
|
|
mod test_fn_offset;
|
|
mod test_number_format;
|
|
|
|
mod test_arrays;
|
|
mod test_escape_quotes;
|
|
mod test_extend;
|
|
mod test_fn_fv;
|
|
mod test_fn_type;
|
|
mod test_frozen_rows_and_columns;
|
|
mod test_geomean;
|
|
mod test_get_cell_content;
|
|
mod test_implicit_intersection;
|
|
mod test_issue_155;
|
|
mod test_percentage;
|
|
mod test_set_functions_error_handling;
|
|
mod test_today;
|
|
mod test_types;
|
|
mod user_model;
|