Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49d6956ee1 |
3 changed files with 39 additions and 0 deletions
|
|
@ -172,6 +172,9 @@ impl Checkpoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod mutants;
|
||||||
|
|
||||||
/// Item builders for the unit tests that live in `src`: the twins of
|
/// Item builders for the unit tests that live in `src`: the twins of
|
||||||
/// `tests/common`'s `group_in_bucket`, `item_in`, `cast` and `model`.
|
/// `tests/common`'s `group_in_bucket`, `item_in`, `cast` and `model`.
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
||||||
11
crates/weksa/src/split/mutants.rs
Normal file
11
crates/weksa/src/split/mutants.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
//! Pins of private items of `split` found unpinned by mutation testing.
|
||||||
|
|
||||||
|
use super::Checkpoint;
|
||||||
|
|
||||||
|
/// A checkpoint reports the round it was declared at, whatever the round.
|
||||||
|
#[test]
|
||||||
|
fn a_checkpoint_reports_its_round() {
|
||||||
|
assert_eq!(Checkpoint::for_test(7).round(), 7);
|
||||||
|
assert_eq!(Checkpoint::for_test(0).round(), 0);
|
||||||
|
assert_eq!(Checkpoint::for_test(1).round(), 1);
|
||||||
|
}
|
||||||
25
crates/weksa/tests/mutants_a.rs
Normal file
25
crates/weksa/tests/mutants_a.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
//! Pins for behaviour of the small and middle weksa files that mutation testing
|
||||||
|
//! found unpinned. Each test states the behaviour in domain terms.
|
||||||
|
|
||||||
|
use weksa::form::is_calendar_date;
|
||||||
|
|
||||||
|
/// A calendar date is exactly `YYYY-MM-DD`: both hyphens sit where the format
|
||||||
|
/// puts them, so a ten-byte string with a digit in the second hyphen's place is
|
||||||
|
/// no date.
|
||||||
|
#[test]
|
||||||
|
fn a_calendar_date_needs_both_hyphens_in_place() {
|
||||||
|
assert!(is_calendar_date("2026-01-01"));
|
||||||
|
assert!(!is_calendar_date("2026-01201"));
|
||||||
|
assert!(!is_calendar_date("2026101-01"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// February has 29 days in a Gregorian leap year and 28 otherwise.
|
||||||
|
#[test]
|
||||||
|
fn february_has_29_days_only_in_gregorian_leap_years() {
|
||||||
|
assert!(is_calendar_date("2024-02-29"));
|
||||||
|
assert!(is_calendar_date("2000-02-29"));
|
||||||
|
assert!(!is_calendar_date("1900-02-29"));
|
||||||
|
assert!(!is_calendar_date("2023-02-29"));
|
||||||
|
assert!(is_calendar_date("2023-02-28"));
|
||||||
|
assert!(!is_calendar_date("2024-02-30"));
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue