use super::*;
use crate::adapters::analyzers::iosp::ComplexityMetrics;
#[test]
fn complexity_marker_at_exact_threshold_is_orphan() {
let cases = [
(
"cognitive",
ComplexityMetrics {
cognitive_complexity: 15,
..Default::default()
},
),
(
"cyclomatic",
ComplexityMetrics {
cyclomatic_complexity: 10,
..Default::default()
},
),
(
"nesting",
ComplexityMetrics {
max_nesting: 4,
..Default::default()
},
),
(
"length",
ComplexityMetrics {
function_lines: 60,
..Default::default()
},
),
];
for (label, m) in cases {
let orphans = complexity_sup_orphans(5, 6, m);
assert!(
!orphans.is_empty(),
"case {label}: a marker over an exactly-at-threshold fn suppresses nothing → orphan"
);
}
}
#[test]
fn error_handling_marker_is_not_orphan() {
let cases = [
(
"panic",
ComplexityMetrics {
panic_count: 1,
..Default::default()
},
),
(
"expect",
ComplexityMetrics {
expect_count: 1,
..Default::default()
},
),
];
for (label, m) in cases {
assert!(
complexity_sup_orphans(5, 6, m).is_empty(),
"case {label}: a non-test fn error-handling count is a target the marker suppresses"
);
}
}