Fix test
This commit is contained in:
+5
-3
@@ -447,12 +447,14 @@ mod tests {
|
|||||||
println!("Population after generate: {:?}", stats);
|
println!("Population after generate: {:?}", stats);
|
||||||
|
|
||||||
// total * proba - 20% < infected < total * proba + 20%
|
// total * proba - 20% < infected < total * proba + 20%
|
||||||
let infected_at_start = width * height * start_infected as i32 / 100;
|
let infected_at_start_proba = width * height * start_infected as i32 / 100;
|
||||||
let infected_tolerance = ((width * height) as f32 * 0.2) as i32;
|
let infected_tolerance = ((width * height) as f32 * 0.2) as i32;
|
||||||
assert!(stats.infected < infected_at_start + infected_tolerance);
|
assert!(stats.infected < infected_at_start_proba + infected_tolerance);
|
||||||
assert!(stats.infected > infected_at_start - infected_tolerance);
|
assert!(stats.infected > infected_at_start_proba - infected_tolerance);
|
||||||
assert_eq!(stats.dead, 0);
|
assert_eq!(stats.dead, 0);
|
||||||
|
|
||||||
|
let infected_at_start = stats.infected;
|
||||||
|
|
||||||
population.propagate();
|
population.propagate();
|
||||||
stats = humans_stats(&population.humans);
|
stats = humans_stats(&population.humans);
|
||||||
println!("Population after propagate: {:?}", stats);
|
println!("Population after propagate: {:?}", stats);
|
||||||
|
|||||||
Reference in New Issue
Block a user