UPDATE: Dump of initial files

This commit is contained in:
Nicolás Hatcher
2023-11-18 21:26:18 +01:00
commit c5b8efd83d
279 changed files with 42654 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
#![allow(clippy::unwrap_used)]
use crate::test::util::new_empty_model;
use crate::types::Cell;
#[test]
fn test_simple_error_propagation() {
let mut model = new_empty_model();
model._set("A1", "=1/0");
model._set("A2", "=2+A1");
model._set("A3", "=C2+A2");
model.evaluate();
match model._get_cell("Sheet1!A3") {
Cell::CellFormulaError { o, .. } => {
assert_eq!(o, "Sheet1!A1");
}
_ => panic!("Unreachable"),
}
}
#[test]
fn test_simple_errors() {
let mut model = new_empty_model();
model._set("A1", "#CALC!");
model._set("A2", "#SPILL!");
model._set("A3", "#OTHER!");
model._set("B1", "=ISERROR(A1)");
model._set("B2", "=ISERROR(A2)");
model._set("B3", "=ISERROR(A3)");
model.evaluate();
assert_eq!(model._get_text("A1"), "#CALC!");
assert_eq!(model._get_text("A2"), "#SPILL!");
assert_eq!(model._get_text("A3"), "#OTHER!");
assert_eq!(model._get_text("B1"), "TRUE");
assert_eq!(model._get_text("B2"), "TRUE");
assert_eq!(model._get_text("B3"), "FALSE");
}