use super::{ALL, find};
use std::collections::HashSet;
#[allow(clippy::missing_const_for_fn)]
fn is_planned(check: &str) -> bool {
#[cfg(feature = "draft-2026-07-28")]
let planned = PLANNED.contains(&check);
#[cfg(not(feature = "draft-2026-07-28"))]
let planned = {
let _ = check;
false
};
planned
}
#[cfg(feature = "draft-2026-07-28")]
const PLANNED: &[&str] = &[];
#[test]
#[allow(clippy::unwrap_used)]
fn builtin_registry_and_check_inventory_cover_each_other_exactly() {
use mcp_conformance_core::requirement::Verification;
let set = mcp_conformance_core::requirement::RegistrySet::builtin().unwrap();
let mut referenced = HashSet::new();
for requirement in set.requirements() {
if let Verification::Checks { checks } = &requirement.verification {
for check in checks {
assert!(
find(check).is_some() || is_planned(check),
"{}: references check {check}, which is neither implemented nor \
listed in PLANNED — a typo in a check id would otherwise be \
invisible, reported as `unsupported` rather than as a defect",
requirement.id
);
referenced.insert(check.clone());
}
}
}
for check in ALL {
assert!(
referenced.contains(check.id),
"check {} is implemented but referenced by no requirement",
check.id
);
}
#[cfg(feature = "draft-2026-07-28")]
for planned in PLANNED {
assert!(
find(planned).is_none(),
"check {planned} is implemented — remove it from PLANNED"
);
assert!(
referenced.contains(*planned),
"check {planned} is planned but no requirement references it"
);
}
}