UPDATE: Dump of initial files
This commit is contained in:
55
base/src/test/test_model_is_empty_cell.rs
Normal file
55
base/src/test/test_model_is_empty_cell.rs
Normal file
@@ -0,0 +1,55 @@
|
||||
#![allow(clippy::unwrap_used)]
|
||||
use crate::test::util::new_empty_model;
|
||||
|
||||
#[test]
|
||||
fn test_is_empty_cell_non_existing_sheet() {
|
||||
let model = new_empty_model();
|
||||
assert_eq!(
|
||||
model.is_empty_cell(13, 1, 1),
|
||||
Err("Invalid sheet index".to_string())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_empty_cell() {
|
||||
let mut model = new_empty_model();
|
||||
assert!(model.is_empty_cell(0, 3, 1).unwrap());
|
||||
model.set_user_input(0, 3, 1, "Hello World".to_string());
|
||||
assert!(!model.is_empty_cell(0, 3, 1).unwrap());
|
||||
model.set_cell_empty(0, 3, 1).unwrap();
|
||||
assert!(model.is_empty_cell(0, 3, 1).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_empty_cell_unset_cell() {
|
||||
let model = new_empty_model();
|
||||
assert_eq!(model.is_empty_cell(0, 1, 1), Ok(true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_empty_cell_with_value() {
|
||||
let mut model = new_empty_model();
|
||||
model._set("A1", "hello");
|
||||
assert_eq!(model.is_empty_cell(0, 1, 1), Ok(false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_empty_cell_empty_string_not_empty() {
|
||||
let mut model = new_empty_model();
|
||||
model._set("A1", "");
|
||||
assert_eq!(model.is_empty_cell(0, 1, 1), Ok(false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_empty_cell_formula_that_evaluates_to_empty_string() {
|
||||
let mut model = new_empty_model();
|
||||
model._set("A1", "=A2");
|
||||
assert_eq!(model.is_empty_cell(0, 1, 1), Ok(false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_empty_cell_formula_that_evaluates_to_zero() {
|
||||
let mut model = new_empty_model();
|
||||
model._set("A1", "=2*A2");
|
||||
assert_eq!(model.is_empty_cell(0, 1, 1), Ok(false));
|
||||
}
|
||||
Reference in New Issue
Block a user