Share GDSII reader logic and simplify review output
Share record framing, name decoding, payload validation, array reference decoding, and Arrow cell-header parsing. Accept trailing NUL padding in names and retain located diagnostics for malformed records. Summarize text diffs by cell, layer, and reference target. Show comparison and omission counts before detail. Compact canonical dumps while preserving exact fields and duplicate counts for Git textconv. Simplify hierarchy output and retain per-object evidence in JSON.
This commit is contained in:
parent
d95c378690
commit
15e8a3b7b5
1 changed files with 1717 additions and 828 deletions
|
|
@ -75,7 +75,7 @@ fn comparison_reports_survive_dropped_documents_and_overwritten_inputs() {
|
|||
assert_eq!(limited["hierarchy"], actual["hierarchy"]);
|
||||
assert_eq!(limited["summary"], actual["summary"]);
|
||||
assert_eq!(limited["exit_code"], 1);
|
||||
assert!(comparison.text(0).contains("0 of 2 object changes shown"));
|
||||
assert!(comparison.text(0).contains("Showing 0 of 2 object changes"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -118,9 +118,10 @@ fn comparison_diagnostics_capture_both_sides_and_scope_mismatch_once() {
|
|||
assert_eq!(report["diagnostics"][1]["side"], "new");
|
||||
assert_eq!(report["diagnostics"][2]["code"], "scope_mismatch");
|
||||
let text = comparison.text(0);
|
||||
let scope = text.find("INCOMPLETE: comparison scopes differ").unwrap();
|
||||
let old = text.find("INCOMPLETE: old:").unwrap();
|
||||
let new = text.find("INCOMPLETE: new:").unwrap();
|
||||
assert!(text.starts_with("Incomplete\nScope cell=\"CHIP\"\nDiagnostics\n"));
|
||||
let scope = text.find("\n comparison scopes differ").unwrap();
|
||||
let old = text.find("\n old:").unwrap();
|
||||
let new = text.find("\n new:").unwrap();
|
||||
assert!(scope < old && old < new);
|
||||
}
|
||||
|
||||
|
|
@ -259,7 +260,7 @@ fn future_layer_metadata_remains_incomplete_under_geometry_scopes() {
|
|||
let diff = Comparison::between(&doc, &doc);
|
||||
assert_eq!(diff.outcome().exit_code(), 2);
|
||||
assert!(!diff.outcome().is_equal());
|
||||
assert!(diff.text(0).contains("INCOMPLETE"));
|
||||
assert!(diff.text(0).starts_with("Incomplete\n"));
|
||||
let json = diff.json_report(&inputs(), &ReportOptions::default());
|
||||
assert_eq!(json["status"], "incomplete");
|
||||
assert_eq!(json["result"], "unknown");
|
||||
|
|
@ -348,6 +349,21 @@ fn typed_evidence_preserves_defaults_properties_bytes_and_real_encodings() {
|
|||
b[within..within + 8].copy_from_slice(&0x4201000000000000_u64.to_be_bytes());
|
||||
let a = layout(&[("CHIP", vec![a]), ("leaf", vec![])]);
|
||||
let b = layout(&[("CHIP", vec![b]), ("leaf", vec![])]);
|
||||
let before = Document::parse(&a).unwrap();
|
||||
let after = Document::parse(&b).unwrap();
|
||||
assert!(before.canonical_dump().contains("mag=1.0 property"));
|
||||
assert!(
|
||||
after
|
||||
.canonical_dump()
|
||||
.contains("mag=1.0 raw=0x4201000000000000")
|
||||
);
|
||||
let text = Comparison::between(&before, &after).text(100);
|
||||
assert!(text.contains("mag 1.0 raw=0x4110000000000000 -> 1.0 raw=0x4201000000000000"));
|
||||
let omitted = layout(&[("CHIP", vec![reference("leaf", 0, 1)]), ("leaf", vec![])]);
|
||||
let omitted = Document::parse(&omitted).unwrap();
|
||||
let text = Comparison::between(&before, &omitted).text(100);
|
||||
assert!(text.contains("mag 1.0 -> absent"));
|
||||
assert!(!text.contains("raw="));
|
||||
let r = report(&a, &b, &ReportOptions::default());
|
||||
let replacement = &r["cell_changes"][0]["replacements"][0];
|
||||
assert_eq!(replacement["match_rule"], "unique_kind_target");
|
||||
|
|
@ -587,11 +603,7 @@ fn cli_preserves_non_utf8_path_bytes_and_literal_option_names() {
|
|||
.output()
|
||||
.unwrap();
|
||||
assert_eq!(output.status.code(), Some(0));
|
||||
assert!(
|
||||
String::from_utf8(output.stdout)
|
||||
.unwrap()
|
||||
.starts_with("profile ")
|
||||
);
|
||||
assert_eq!(output.stdout, b"Equal\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue