pub fn pairs(
decl: &Declarations,
suite: &EconomicsSuite,
runs: &[EconomicsRun],
) -> Vec<EconomicsPair>Expand description
Form every pair a live suite declares (each task, each repetition) from the runs
recorded for it, and judge each. A declared pair nobody ran is missing, not absent.
Runs recorded under another methodology version or for another suite are ignored, and a suite that does not name both a control and a treatment arm forms no pair at all.
use majordomus_cli::economics::{load, pairs};
use majordomus_cli::economics::model::EconomicsPairStatus;
let dir = tempfile::tempdir().unwrap();
// a methodology and one live suite `pilot` with a control and a treatment arm
let decl = load(dir.path()).unwrap().unwrap();
let mut suite = decl.suites["pilot"].clone();
suite.tasks = vec!["vat-rounding".into()];
suite.repetitions = Some(2);
let declared = pairs(&decl, &suite, &[]);
assert_eq!(declared.len(), 2, "each task times each repetition, run or not");
assert!(declared.iter().all(|p| p.status == EconomicsPairStatus::Missing));
suite.control = None;
assert!(pairs(&decl, &suite, &[]).is_empty(), "without both arms nothing is paired");