use std::path::Path;
const EXECUTION_RS: &str = "src/codegen/builder/disassembler/constructor/execution.rs";
const SILENT_FALLBACK_BUDGET: usize = 5;
#[test]
fn codegen_silent_fallback_count_within_budget() {
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join(EXECUTION_RS);
let src =
std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("read {}: {}", path.display(), e));
let count = src
.lines()
.filter(|line| {
line.contains("quote! { 0u64 }")
|| line.contains("quote! { 0i128 }")
|| line.contains("=> 0u64")
|| line.contains("=> 0i128")
})
.count();
assert_eq!(
count, SILENT_FALLBACK_BUDGET,
"silent-fallback budget violated: counted {} occurrences in {}, \
expected exactly {}. Either remove the new fallback or update \
SILENT_FALLBACK_BUDGET + the MOTIVATIONS list in this test.",
count, EXECUTION_RS, SILENT_FALLBACK_BUDGET
);
}