use dsfb_database::non_claims;
use std::fs;
use std::path::PathBuf;
#[test]
fn non_claim_block_is_verbatim() {
let expected = [
"DSFB-Database does not optimise queries, replace the query optimiser, or modify execution plans.",
"DSFB-Database does not claim causal correctness; motifs represent structural consistency given observed signals, not root causes.",
"DSFB-Database does not provide a forecasting or predictive guarantee; precursor structure is structural, not probabilistic.",
"DSFB-Database does not provide ground-truth-validated detection on real workloads; we evaluate via injected perturbations, plan-hash concordance, and replay determinism.",
"DSFB-Database does not claim a universal SQL grammar; motifs are engine-aware, telemetry-aware, and workload-aware.",
"DSFB-Database does not validate that an operator-supplied grammar is appropriate for a non-SQL residual stream; the generic CSV adapter is a worked example, not a universality claim.",
"DSFB-Database's live adapters (PostgreSQL via pg_stat_statements; MySQL via performance_schema) emit residuals at a cadence bounded by their polling interval, the engine's response latency, and the operator-configured CPU budget; they do not provide hard-real-time guarantees. Determinism holds only given a persisted tape — two live invocations against the same engine workload will produce different tapes.",
];
assert_eq!(
non_claims::NON_CLAIMS.len(),
expected.len(),
"non-claim count drifted; update both the crate and the paper"
);
for (i, (actual, want)) in non_claims::NON_CLAIMS
.iter()
.zip(expected.iter())
.enumerate()
{
assert_eq!(
actual,
want,
"non-claim #{} drifted from paper-locked text",
i + 1
);
}
}
#[test]
fn non_claim_block_is_printable() {
let block = non_claims::as_block();
for n in 1..=7 {
assert!(
block.contains(&format!(" {}.", n)),
"non-claim numbering #{} missing",
n
);
}
}
#[test]
fn paper_non_claims_section_matches_crate_strings() {
let tex_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("paper")
.join("dsfb-database.tex");
let tex = match fs::read_to_string(&tex_path) {
Ok(s) => s,
Err(_) => {
eprintln!(
"skipping paper<->crate non-claim lock: {} not present",
tex_path.display()
);
return;
}
};
let label_anchor = "\\label{sec:non-claims}";
let section_start = tex.find(label_anchor).unwrap_or_else(|| {
panic!(
"{} does not contain {:?}; non-claim section may have been removed or relabelled",
tex_path.display(),
label_anchor
)
});
let section_tail = &tex[section_start..];
let env_start_rel = section_tail.find("\\begin{enumerate}").expect(
"non-claims section is missing its \\begin{enumerate}; the lock cannot match items",
);
let env_end_rel = section_tail
.find("\\end{enumerate}")
.expect("non-claims section is missing its \\end{enumerate}");
let block = §ion_tail[env_start_rel..env_end_rel];
let items: Vec<String> = block
.lines()
.filter_map(|line| {
let trimmed = line.trim();
trimmed.strip_prefix("\\item ").map(|s| s.trim().to_owned())
})
.collect();
assert_eq!(
items.len(),
non_claims::NON_CLAIMS.len(),
"paper §10 enumerate item count ({}) does not match crate non-claim count ({})",
items.len(),
non_claims::NON_CLAIMS.len()
);
for (i, (paper, crate_str)) in items.iter().zip(non_claims::NON_CLAIMS.iter()).enumerate() {
assert_eq!(
paper.as_str(),
*crate_str,
"non-claim #{} in paper §10 does not match crate string verbatim",
i + 1
);
}
}