diff options
author | Determinant <[email protected]> | 2020-06-11 16:13:26 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-06-11 16:13:26 -0400 |
commit | 014ad2e58b647d367621a4324503725eee60e71d (patch) | |
tree | 1c152bf86a153df1e15a56823b3ec2fbeee279b5 /tests/rand_fail.rs | |
parent | 3529e120694d3b9deb6eb2122e309efede0e3644 (diff) |
enhance the test
Diffstat (limited to 'tests/rand_fail.rs')
-rw-r--r-- | tests/rand_fail.rs | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/tests/rand_fail.rs b/tests/rand_fail.rs index 07edb39..e32ba23 100644 --- a/tests/rand_fail.rs +++ b/tests/rand_fail.rs @@ -1,12 +1,37 @@ -#[cfg(test)] -mod common; +#[cfg(test)] mod common; + +use std::collections::HashMap; +use std::rc::Rc; fn single_point_failure(sim: &common::PaintingSim) { let nticks = sim.get_nticks(); println!("nticks = {}", nticks); for i in 0..nticks { print!("fail pos = {}, ", i); - assert!(sim.test(common::SingleFailGen::new(i))); + let mut state = common::WALStoreEmulState::new(); + let mut canvas = sim.new_canvas(); + let mut ops: Vec<common::PaintStrokes> = Vec::new(); + let mut ringid_map = HashMap::new(); + let fgen = common::SingleFailGen::new(i); + if sim + .run( + &mut state, + &mut canvas, + sim.get_walloader(), + &mut ops, + &mut ringid_map, + Rc::new(fgen), + ) + .is_err() + { + assert!(sim.check( + &mut state, + &mut canvas, + sim.get_walloader(), + &ops, + &ringid_map, + )) + } } } @@ -18,7 +43,7 @@ fn test_rand_fail() { file_cache: 1000, n: 100, m: 10, - k: 100, + k: 1000, csize: 1000, stroke_max_len: 10, stroke_max_col: 256, |