//! The cost table, swept for totality, and the one rule that lets a Mac's own //! measurement beat it. use std::collections::BTreeSet; use super::*; // ── totality ──────────────────────────────────────────────────────────────── /// `JOB_KINDS` names EVERY variant. /// /// The `match` is the proof: adding a variant to [`JobKind`] without adding it /// here fails to compile, and the assertion below catches the other direction — /// a name left in the list after its variant went. #[test] fn every_job_kind_is_in_the_list() { fn seen(kind: JobKind) -> usize { match kind { JobKind::CodingSession => 0, JobKind::McpServer => 1, JobKind::IosSimulator => 2, JobKind::XcodebuildArchive => 3, JobKind::CargoBuild => 4, JobKind::AndroidEmulator => 5, } } let listed: BTreeSet = JOB_KINDS.iter().copied().map(seen).collect(); assert_eq!( listed.len(), JOB_KINDS.len(), "JOB_KINDS names a kind twice" ); assert_eq!( listed, (0..6).collect::>(), "JOB_KINDS must name every JobKind exactly once — a kind with no entry \ is a job the budget would admit for free" ); } #[test] fn every_job_costs_something_and_says_what_it_is() { for &kind in JOB_KINDS { let cost = cost(kind); assert!( cost.mem_gb > 0.0, "{kind:?} costs no memory — a free job is one the budget cannot hold back" ); assert!(!cost.label.is_empty(), "{kind:?} has no label to put in a sentence"); assert_eq!( cost.label.trim(), cost.label, "{kind:?}'s label is padded, and it is read inside a sentence" ); // It is read as "a