From 8bcd81244bddcdf21212893cc04ae77c1c333e9b Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:27:53 -0400 Subject: [PATCH] Tests: a blend refused as too large is SMLib's NO_ROOM, in its own words Since bcbb99005 a blend larger than its faces is SMLib's refusal (KernelError::TooLarge, "the fillet is larger than the faces beside its edges allow"); truck's room check, whose words these tests still matched, went with blend_fit. The refusals themselves stand: - fillet_consuming_a_side_face_makes_a_full_round: R3.001 and R3.5 on the 14 x 6 x 10 box's four vertical edges, past the full round, are refused as too large (no longer "larger than the neighbouring faces"); the body unchanged is its own volume before (SMLib's measure of the box is 839.9999999999998, not 840 bit for bit). - a_chamfer_that_would_grow_the_part_on_a_convex_edge_is_refused: refused as too large; the word "convex" was the old check's. Co-Authored-By: Claude Opus 5.5 --- crates/kernel/src/blend_wrong_way_tests.rs | 5 +++-- crates/kernel/src/tests.rs | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/kernel/src/blend_wrong_way_tests.rs b/crates/kernel/src/blend_wrong_way_tests.rs index 9d927c16c..6b80bf0f9 100644 --- a/crates/kernel/src/blend_wrong_way_tests.rs +++ b/crates/kernel/src/blend_wrong_way_tests.rs @@ -27,13 +27,14 @@ fn block_with_ball_cut() -> Body { /// The ball's rim on the back face dips to 0.04 mm above the bottom: a 0.5 mm chamfer of it /// would run off the back face, and what was built grew the part (by 0.65 mm³, more with other -/// edge orders). On a convex edge a chamfer takes material away, so it is refused. +/// edge orders). On a convex edge a chamfer takes material away, so it is refused, as too large +/// (SMLib's NO_ROOM). #[test] fn a_chamfer_that_would_grow_the_part_on_a_convex_edge_is_refused() { let body = block_with_ball_cut(); let rim = Vec3::new(3.1526309873924174, 22.5, 0.04277569594852188); let e = chamfer(&body, &[rim], 0.5).expect_err("refused"); - assert!(matches!(e, KernelError::TooLarge(_)) && e.to_string().contains("convex"), "{e}"); + assert!(matches!(e, KernelError::TooLarge(_)), "{e}"); } /// Curved convex edges that a chamfer does take material from still build: a hole's rim in a diff --git a/crates/kernel/src/tests.rs b/crates/kernel/src/tests.rs index cf1718e34..6ce711e29 100644 --- a/crates/kernel/src/tests.rs +++ b/crates/kernel/src/tests.rs @@ -322,6 +322,7 @@ fn loop_fillet_as_tall_as_its_wall_consumes_it() { fn fillet_consuming_a_side_face_makes_a_full_round() { // 14 x 6 x 10: r = 3 on the four vertical edges uses up both 6 mm end faces (#199). let b = box_solid(Vec3::new(14.0, 0.0, 0.0), Vec3::new(28.0, 6.0, 10.0)).unwrap(); + let before = measure(&b).unwrap().volume; let mids = [Vec3::new(14.0, 0.0, 5.0), Vec3::new(28.0, 0.0, 5.0), Vec3::new(14.0, 6.0, 5.0), Vec3::new(28.0, 6.0, 5.0)]; let full = 840.0 - (4.0 - PI) * 9.0 * 10.0; for order in [mids.to_vec(), mids.iter().rev().copied().collect()] { @@ -343,12 +344,13 @@ fn fillet_consuming_a_side_face_makes_a_full_round() { let c = fillet(&post, &corners, 3.0).unwrap(); assert!(rel(measure(&c).unwrap().volume, PI * 9.0 * 10.0) < 2e-4, "{}", measure(&c).unwrap().volume); assert!(c.validity().is_empty()); - // Past the limit there is no face left to consume: still refused, the body unchanged. + // Past the limit the two rounds on each 6 mm end would cross: still refused as too large + // (SMLib's NO_ROOM), the body unchanged. for r in [3.0 + 1e-3, 3.5] { let e = fillet(&b, &mids, r).unwrap_err(); - assert!(e.to_string().contains("larger than the neighbouring faces"), "{r}: {e}"); + assert!(matches!(e, KernelError::TooLarge(_)), "{r}: {e}"); } - assert_eq!(measure(&b).unwrap().volume, 840.0); + assert_eq!(measure(&b).unwrap().volume, before); } #[test]