From a3e42e54863d98e22f7da611b82e5fa81c508762 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 01:18:32 -0400 Subject: [PATCH] Tests: the cap whose loops prism_measure compares is found by its plane, not as the last face cap_support_origin_is_not_a_trimmed_face_height read the drilled block's last face as a cap. The record's face order is SMLib's: its last face can be the hole's wall, which has no cap loop, and the test unwrapped None. The cap is now the first face on a plane square to z. Co-Authored-By: Claude Opus 5.5 --- crates/kernel/src/prism_measure.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/kernel/src/prism_measure.rs b/crates/kernel/src/prism_measure.rs index eee0405a2..346a6fb0f 100644 --- a/crates/kernel/src/prism_measure.rs +++ b/crates/kernel/src/prism_measure.rs @@ -927,9 +927,15 @@ mod tests { } } assert_eq!(equivalent(&original, source.size(), &same, source.size()), Some(true)); - let last = original.faces.len() - 1; - let outward = preflight(&original).unwrap()[last]; - let runs = loop_runs(&original, last, 0, outward).unwrap(); + // A cap: a face whose plane is square to z (the record's face order is SMLib's, its last + // face may be the hole's wall). + let cap = original + .faces + .iter() + .position(|f| plane_of(&f.surface).is_some_and(|(_, u, v)| u.cross(v).normalized().is_some_and(|n| n.z.abs() > 0.9))) + .unwrap(); + let outward = preflight(&original).unwrap()[cap]; + let runs = loop_runs(&original, cap, 0, outward).unwrap(); assert!( loops_same( &cap_loop(&runs, &Plane::XY, 3e-9, &mut 2_000_000).unwrap(),