Skip to main content

outcome_counts

Function outcome_counts 

Source
pub fn outcome_counts(executions: &[Execution]) -> BTreeMap<String, usize>
Expand description

How many of these executions there are of each outcome, keyed by the outcome’s serde word; an outcome nothing recorded is absent rather than 0. The one count Ledger::by_outcome and a run record’s totals both use.

use majordomus_cli::evidence::ledger::{outcome_counts, Ledger};

assert!(outcome_counts(&[]).is_empty());
let ledger = Ledger::parse(r#"{"version": 1, "executions": []}"#).unwrap();
assert_eq!(outcome_counts(&ledger.executions), ledger.by_outcome());