Compare commits
2 Commits
5fbff13428
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9de22b9680 | |||
| 3f336578f5 |
@@ -762,15 +762,17 @@ fn fn_of_fn() {
|
|||||||
grid.set_cell("B0", 1.);
|
grid.set_cell("B0", 1.);
|
||||||
grid.set_cell("C0", "=A0+B0".to_string());
|
grid.set_cell("C0", "=A0+B0".to_string());
|
||||||
grid.set_cell("D0", "=C0*2".to_string());
|
grid.set_cell("D0", "=C0*2".to_string());
|
||||||
|
|
||||||
|
let cell = grid.get_cell("D0");
|
||||||
|
assert!(cell.is_some());
|
||||||
|
|
||||||
if let Some(cell) = grid.get_cell("D0") {
|
if let Some(cell) = cell {
|
||||||
let res = grid.evaluate(&cell.to_string());
|
let res = grid.evaluate(&cell.to_string());
|
||||||
|
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
assert_eq!(res.unwrap(), (6.).into());
|
assert_eq!(res.unwrap(), (6.).into());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
panic!("Cell not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Two cells that have a circular dependency to solve for a value
|
// Two cells that have a circular dependency to solve for a value
|
||||||
@@ -780,12 +782,14 @@ fn circular_reference_cells() {
|
|||||||
grid.set_cell("A0", "=B0".to_string());
|
grid.set_cell("A0", "=B0".to_string());
|
||||||
grid.set_cell("B0", "=A0".to_string());
|
grid.set_cell("B0", "=A0".to_string());
|
||||||
|
|
||||||
if let Some(cell) = grid.get_cell("A0") {
|
let cell = grid.get_cell("A0");
|
||||||
|
assert!(cell.is_some());
|
||||||
|
|
||||||
|
if let Some(cell) = cell {
|
||||||
let res = grid.evaluate(&cell.to_string());
|
let res = grid.evaluate(&cell.to_string());
|
||||||
assert!(res.is_err());
|
assert!(res.is_err());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
panic!("Cell not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -188,7 +188,14 @@ impl<'a> Context for CallbackContext<'a> {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
e => panic!("> Error {e}\n> Equation: '{eq}'"),
|
e => {
|
||||||
|
let msg = format!("> Error {e}\n> Equation: '{eq}'");
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
panic!("{msg}");
|
||||||
|
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
eprintln!("{msg}");
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ fn fit_cells() {
|
|||||||
app.vars.insert("height".to_string(), 1.to_string());
|
app.vars.insert("height".to_string(), 1.to_string());
|
||||||
|
|
||||||
let (x,y) = app.screen.how_many_cells_fit_in(&prelude::Rect::new(0, 0, 181, 14), &app.vars);
|
let (x,y) = app.screen.how_many_cells_fit_in(&prelude::Rect::new(0, 0, 181, 14), &app.vars);
|
||||||
assert_eq!(x, 18);
|
assert_eq!(x, 19);
|
||||||
assert_eq!(y, 14);
|
assert_eq!(y, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ fn scroll() {
|
|||||||
// We have to check how many cells fit, because screen learns the width
|
// We have to check how many cells fit, because screen learns the width
|
||||||
// of the area by rumour here.
|
// of the area by rumour here.
|
||||||
let (x,y) = app.screen.how_many_cells_fit_in(&prelude::Rect::new(0, 0, 181, 14), &app.vars);
|
let (x,y) = app.screen.how_many_cells_fit_in(&prelude::Rect::new(0, 0, 181, 14), &app.vars);
|
||||||
assert_eq!(x, 18);
|
assert_eq!(x, 19);
|
||||||
assert_eq!(y, 14);
|
assert_eq!(y, 14);
|
||||||
|
|
||||||
// we aren't scrolled at all yet
|
// we aren't scrolled at all yet
|
||||||
|
|||||||
Reference in New Issue
Block a user