Skip to content

Commit

Permalink
explicit error messages in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiragKumar9 committed Nov 27, 2024
1 parent 7445e17 commit ba2ebb9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ mod test {
use crate::parameters::ParametersValues;

#[test]
#[should_panic(expected = "r_0 must be a non-negative number.")]
fn test_validate_r_0() {
let parameters = ParametersValues {
max_time: 100.0,
Expand All @@ -49,10 +50,11 @@ mod test {
report_period: 1.0,
synth_population_file: PathBuf::from("."),
};
assert!(validate_inputs(&parameters).is_err());
validate_inputs(&parameters).unwrap();
}

#[test]
#[should_panic(expected = "The generation interval must be positive.")]
fn test_validate_gi() {
let parameters = ParametersValues {
max_time: 100.0,
Expand All @@ -63,6 +65,6 @@ mod test {
report_period: 1.0,
synth_population_file: PathBuf::from("."),
};
assert!(validate_inputs(&parameters).is_err());
validate_inputs(&parameters).unwrap();
}
}

0 comments on commit ba2ebb9

Please sign in to comment.