Add GEOMEAN Tests

This commit is contained in:
Andrew Fillmore
2024-12-10 13:53:29 -08:00
committed by Nicolás Hatcher Andrés
parent 4c3374c0de
commit e5aff48e36
2 changed files with 28 additions and 0 deletions

View File

@@ -59,3 +59,4 @@ mod test_set_functions_error_handling;
mod test_today;
mod test_types;
mod user_model;
mod test_geomean;

View File

@@ -0,0 +1,27 @@
#![allow(clippy::unwrap_used)]
use crate::test::util::new_empty_model;
#[test]
fn test_fn_geomean_arguments() {
let mut model = new_empty_model();
model._set("A1", "=GEOMEAN()");
model.evaluate();
assert_eq!(model._get_text("A1"), *"#ERROR!");
}
#[test]
fn test_fn_geomean_minimal() {
let mut model = new_empty_model();
model._set("B1", "1");
model._set("B2", "2");
model._set("B3", "3");
model._set("B4", "'2");
// B5 is empty
model._set("B6", "true");
model._set("A1", "=GEOMEAN(B1:B6)");
model.evaluate();
assert_eq!(model._get_text("A1"), *"1.817120593");
}