Conformance: a failing row prints the native notes its own run announced
The suite declares the device's native notes (`replay::NATIVE_NOTES`) for every case and they loosen no value, so a value the device's native answer moves is a `known-gaps.tsv` row whose words name the note that records it. Nothing in the report said whether that note fired: a declared native note never reads as a difference, so a row could cite a note the case never announced on its venue and nothing would tell. Under the suite's device options a note fires at each occurrence, so the case's own transcript holds what its run announced. Each failing row of the report now ends with "the device's native notes this case announced: ...", where it announced any. It is a line below the row's verdict, outside the ledger's identity fields (the site and the answer) and outside the ready-to-paste rows, so no row moves. Test: `tests::a_failing_row_names_the_native_notes_its_run_announced` (a divergent row whose run announced `device-texel-conversion` prints it; one that announced nothing prints no such line). (cherry picked from commit 2776dd8f061b31033949586950cb15419ef701ba)
This commit is contained in:
1 parent
b8838d9fde
commit
192f60a0d8
2 files changed
+59
No files matched your search
@@ -405,6 +405,13 @@ impl Report {
|
||||
"\n{} on {}: {}\n",
|
||||
row.case, row.venue, row.verdict
|
||||
));
|
||||
let native = native_notes_announced(row);
|
||||
if !native.is_empty() {
|
||||
out.push_str(&format!(
|
||||
" the device's native notes this case announced: {}\n",
|
||||
native.join(", ")
|
||||
));
|
||||
}
|
||||
}
|
||||
out.push_str(&self.render_cost());
|
||||
out
|
||||
@@ -621,3 +628,24 @@ pub fn must_hold(verdict: &Verdict) -> Result<(), String> {
|
||||
}
|
||||
Err(verdict.to_string())
|
||||
}
|
||||
|
||||
/// The device's native notes ([`crate::replay::NATIVE_NOTES`]) `row`'s own run announced, by code.
|
||||
///
|
||||
/// The suite declares them for every case and they loosen no value, so a value the device's
|
||||
/// native answer moves is a `known-gaps.tsv` row whose words name the note that records it. That
|
||||
/// row's claim is only as good as the note having fired, and nothing else in the report says so:
|
||||
/// a declared note never reads as a difference. Printed under each failing row, it is the
|
||||
/// evidence a row needs that the note fired in the case it describes, on the venue it is scoped
|
||||
/// to; a note fires at each occurrence under the suite's device options, so the case's own run
|
||||
/// is the one that announced it.
|
||||
fn native_notes_announced(row: &Replayed) -> Vec<String> {
|
||||
row.ours
|
||||
.announced_notices()
|
||||
.into_keys()
|
||||
.filter(|code| {
|
||||
crate::replay::NATIVE_NOTES
|
||||
.iter()
|
||||
.any(|kind| kind.code() == code)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -1241,6 +1241,37 @@ fn no_case_names_a_native_note() {
|
||||
assert!(named.is_empty(), "{}:\n{}", named.len(), named.join("\n"));
|
||||
}
|
||||
|
||||
/// A failing row says which of the device's native notes its own run announced, and names no
|
||||
/// other notice there: a value the device's native answer moves is a ledger row that names the
|
||||
/// note recording it, and that note never reads as a difference, so this line is the report's one
|
||||
/// evidence that it fired in the case the row describes.
|
||||
#[test]
|
||||
fn a_failing_row_names_the_native_notes_its_run_announced() {
|
||||
let native = Degradation::DeviceTexelConversion;
|
||||
assert!(crate::replay::NATIVE_NOTES.contains(&native));
|
||||
let case = WordsCase::new("words", 2);
|
||||
let recording = recording_of(&case, case.transcript(words(&[1, 2]), "Completed", &[]), 3);
|
||||
let render = |side: &mut StubSide| {
|
||||
let replayed = replay_against(&case, side, &recording).unwrap();
|
||||
assert!(
|
||||
matches!(replayed.verdict, Verdict::Divergent { .. }),
|
||||
"{}",
|
||||
replayed.verdict
|
||||
);
|
||||
let mut report = Report::new();
|
||||
report.add(replayed);
|
||||
report.render()
|
||||
};
|
||||
let line = "the device's native notes this case announced:";
|
||||
let noted = render(&mut StubSide::new(words(&[1, 7])).announcing(&[native]));
|
||||
assert!(
|
||||
noted.contains(&format!("{line} {}", native.code())),
|
||||
"{noted}"
|
||||
);
|
||||
let silent = render(&mut StubSide::new(words(&[1, 7])));
|
||||
assert!(!silent.contains(line), "{silent}");
|
||||
}
|
||||
|
||||
/// Every accepted difference a case names is an entry of `docs/API.md` section 10, a venue's
|
||||
/// answer (`Justification::WithoutCompression`) included. A slug that names no entry justifies
|
||||
/// nothing on any venue, and a replay says so only where the site it loosens differs: the
|
||||
|
||||
Reference in new issue
Block a user