aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/held.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/federation/held.rs')
-rw-r--r--src/federation/held.rs67
1 files changed, 15 insertions, 52 deletions
diff --git a/src/federation/held.rs b/src/federation/held.rs
index 6e075aa..ba7837b 100644
--- a/src/federation/held.rs
+++ b/src/federation/held.rs
@@ -1246,59 +1246,22 @@ mod tests {
assert_eq!(holding.passed(), Vec::<Vec<u8>>::new());
}
- /// Rows the next stages test.
- const LATER: &[u32] = &[21, 22];
+ /// Rows whose tests wait: remakes (stage 5), and flooding.
+ const LATER: &[u32] = &[11, 12, 13, 15, 16, 21, 22, 28, 29, 30, 31];
#[test]
- fn every_row_marked_unit_has_its_test() {
- let doc = include_str!("../../docs/store.md");
- let attacks = doc.split("\n## Attacks").nth(1).expect("its attacks");
- let attacks = attacks.split("\n## ").next().unwrap_or(attacks);
- let sources = [
- include_str!("held.rs"),
- include_str!("store/memory.rs"),
- include_str!("../access/holding.rs"),
- include_str!("../access/token.rs"),
- ];
- let rows: BTreeMap<u32, String> = attacks
- .lines()
- .filter_map(|line| {
- let cells: Vec<&str> = line.split('|').map(str::trim).collect();
- let n = cells.get(1)?.parse().ok()?;
- Some((n, cells.get(4)?.to_string()))
- })
- .collect();
- let tested: Vec<u32> = sources
- .iter()
- .flat_map(|source| source.lines())
- .filter_map(|line| {
- line.trim()
- .strip_prefix("fn store_attack_")?
- .split('(')
- .next()?
- .parse()
- .ok()
- })
- .collect();
- let missing: Vec<&u32> = rows
- .iter()
- .filter(|(n, kind)| {
- kind.starts_with("unit") && !tested.contains(n) && !LATER.contains(n)
- })
- .map(|(n, _)| n)
- .collect();
- assert!(missing.is_empty(), "rows without their test: {missing:?}");
- for n in &tested {
- assert!(rows.contains_key(n), "a test of row {n}, which isn't there");
- assert_eq!(
- tested.iter().filter(|m| *m == n).count(),
- 1,
- "row {n} tested twice"
- );
- }
- for n in LATER {
- assert!(!tested.contains(n), "row {n} has its test now");
- assert!(rows[n].starts_with("unit"), "row {n} isn't marked unit");
- }
+ fn every_row_has_its_test() {
+ harness::every_row_has_its_test(
+ include_str!("../../docs/store.md"),
+ "store_attack_",
+ &[
+ include_str!("held.rs"),
+ include_str!("store/memory.rs"),
+ include_str!("../access/holding.rs"),
+ include_str!("../access/token.rs"),
+ ],
+ &[include_str!("../simtest/holding.rs")],
+ LATER,
+ );
}
}