From 8f914ddd2cf91d428d552eac542871e4504e3386 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:55:46 -0400 Subject: [PATCH] Tests: the saw cut's halves named after their faces, listed in the kernel's order cut_keeps_posts_joined_while_apart_in_one_body expected the reply's `bodies` as ["Case", "Case (1)"]. That list is the state's order, which is SMLib's lump order (the -x half first); the names follow the pieces' faces (lineage::order_lumps, 08cf526fe): the piece whose least face name sorts first keeps "Case". That is the +x half, whose least is `F1:+x`, before the -x half's least, its piece of `F1:+y`. The test now checks the names as a set, that the +x half (from x = 1) is "Case" and the -x half (from x = -30) "Case (1)", and each half's volume as before. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/boolean_regression_tests.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/boolean_regression_tests.rs b/crates/engine/src/boolean_regression_tests.rs index 76910333cc..69cb1f5c3a 100644 --- a/crates/engine/src/boolean_regression_tests.rs +++ b/crates/engine/src/boolean_regression_tests.rs @@ -1060,8 +1060,15 @@ fn cut_keeps_posts_joined_while_apart_in_one_body() { // A cut through the middle of the case still leaves two bodies, and says it made the second. s.execute("solid.box", &json!({"length": 2, "width": 80, "height": 80, "center": [0, 0, 20], "operation": "new", "body_name": "Saw"})).unwrap(); let saw = s.execute("solid.combine", &json!({"target": "Case", "tools": ["Saw"], "operation": "cut"})).unwrap(); - assert_eq!(saw["bodies"], json!(["Case", "Case (1)"]), "{saw}"); + // `bodies` lists them in the kernel's order. The piece whose least face name sorts first keeps + // the name (`lineage::order_lumps`): the +x half, whose `F1:+x` sorts before the -x half's + // least, its piece of the case's `F1:+y`. + let mut bodies: Vec<&str> = saw["bodies"].as_array().unwrap().iter().filter_map(Value::as_str).collect(); + bodies.sort_unstable(); + assert_eq!(bodies, ["Case", "Case (1)"], "{saw}"); assert_eq!(saw["created_bodies"], json!(["Case (1)"]), "{saw}"); + let low_x = |name: &str| s.model.state().body(name).unwrap().mesh().bounds().min.x; + assert!((low_x("Case") - 1.0).abs() < 1e-9 && (low_x("Case (1)") + 30.0).abs() < 1e-9); let half = (60.0 - 2.0) / 2.0 * 40.0 * 10.0 + posts / 2.0; for name in ["Case", "Case (1)"] { assert!((volume(&s, name) - half).abs() < 1e-6 * half, "{name}: {} vs {half}", volume(&s, name));