From e0d5ee496393550444dafa2d50e549ac15a05b3f Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 00:56:57 -0400 Subject: [PATCH] Tests: thicken and raised-band histories checked as SMLib reports them, Meet edges and seams included check_kept panicked on any edge origin that was not an operand's edge, but a new edge where two faces meet has a Meet origin by the history's contract (EdgeOrigin::Meet), and SMLib's history gives them: the raised band's and the thickened sheet's new edges. It now checks the edges an operand still owns and passes over the meetings. The thickened sheet is the whole cylinder side (SMLib's one face, truck's half): a wall stands along each of its free edges, the two rims, and none along its seam, which the face meets itself along (2 + 2 faces, not 2 + its 3 edges). Co-Authored-By: Claude Opus 5.5 --- crates/kernel/src/record_tests.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/kernel/src/record_tests.rs b/crates/kernel/src/record_tests.rs index 3590a7dca..31075a9a8 100644 --- a/crates/kernel/src/record_tests.rs +++ b/crates/kernel/src/record_tests.rs @@ -468,7 +468,8 @@ fn sweeps_along_paths() { check_sweep(&b, &side, &ring, Some(1)); } -/// Kept faces are their origins, unchanged; each edge an operand still owns is that edge. +/// Kept faces are their origins, unchanged; each edge an operand still owns is that edge (a new +/// edge, where two faces meet, has a Meet origin instead). fn check_kept(result: &Body, input: &Body) { let h = result.history().unwrap(); h.check(result, &[input]).unwrap(); @@ -482,7 +483,11 @@ fn check_kept(result: &Body, input: &Body) { let mut owned = 0; for (e, p) in re.iter().zip(&h.edges) { for o in &p.origins { - let crate::history::EdgeOrigin::Edge { operand: 0, edge } = o else { panic!("{o:?}") }; + let edge = match o { + crate::history::EdgeOrigin::Edge { operand: 0, edge } => edge, + crate::history::EdgeOrigin::Meet { .. } => continue, + _ => panic!("{o:?}"), + }; assert!(e.mid.dist(ie[*edge].mid) < 1e-6, "edge {}", e.index); owned += 1; } @@ -506,12 +511,14 @@ fn thicken_reports_copies_offsets_and_walls() { let h = t.history().unwrap(); assert_eq!(h.faces[0].origins, [FaceOrigin::Face { operand: 0, face: 0 }]); assert_eq!(h.faces[1].origins, [FaceOrigin::Offset { operand: 0, face: 0 }]); - let free: Vec = (0..half.edge_count()).collect(); + // A wall along each free edge of the sheet: the side's two rims, not its seam (an edge the + // one face meets itself along, no boundary). + let free: Vec = (0..half.edge_count()).filter(|e| half.record().edges[*e].uses.len() == 1).collect(); for (i, f) in h.faces.iter().enumerate().skip(2) { let [FaceOrigin::Edge { operand: 0, edge }] = f.origins.as_slice() else { panic!("{f:?}") }; assert_eq!(*edge, nearest_edge(&t, i, &half, &free)); } - assert_eq!(h.faces.len(), 2 + half.edge_count()); + assert_eq!(h.faces.len(), 2 + free.len()); } #[test]