use wasm4pm_compat::law::QualityMetricKind;
use wasm4pm_compat::multiperspective::ProcessPerspective;
#[test]
fn the_four_process_perspectives_are_constructed() {
let all = [
ProcessPerspective::ControlFlow,
ProcessPerspective::Data,
ProcessPerspective::Resource,
ProcessPerspective::Time,
];
fn label(p: ProcessPerspective) -> &'static str {
match p {
ProcessPerspective::ControlFlow => "control-flow",
ProcessPerspective::Data => "data",
ProcessPerspective::Resource => "resource",
ProcessPerspective::Time => "time",
}
}
let labels: std::collections::BTreeSet<&str> = all.iter().copied().map(label).collect();
assert_eq!(
labels.len(),
4,
"all four perspectives are distinct constructions"
);
}
#[test]
fn the_quality_metric_vocabulary_is_constructed() {
let all = [
QualityMetricKind::Fitness,
QualityMetricKind::Precision,
QualityMetricKind::F1,
QualityMetricKind::Generalization,
QualityMetricKind::Simplicity,
];
fn label(k: QualityMetricKind) -> &'static str {
match k {
QualityMetricKind::Fitness => "fitness",
QualityMetricKind::Precision => "precision",
QualityMetricKind::F1 => "f1",
QualityMetricKind::Generalization => "generalization",
QualityMetricKind::Simplicity => "simplicity",
}
}
let labels: std::collections::BTreeSet<&str> = all.iter().copied().map(label).collect();
assert_eq!(
labels.len(),
5,
"all five quality-metric kinds are distinct constructions"
);
}