From e0c7867b9b62d04f81c2e610a62cd46a1945fae0 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Tue, 27 Oct 2026 21:52:46 -0400 Subject: [PATCH] run_strict: the box's volume to 1e-9, as SMLib integrates it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit allow_errors_writes_anyway_and_a_saved_design_keeps_failing compared the box's volume with 4000.0 to the bit, which the old kernel's closed-form planar volume gave. SMLib integrates mass properties numerically (relative accuracy 1e-4 asked for) and gives the 20 x 20 x 10 box within a unit or two in the last place (3999.999999999999), the correct answer to the precision the measure has. The test now checks 4000 mm³ to a relative 1e-9. Co-Authored-By: Claude Opus 5.5 --- apps/solidcraft-cli/tests/run_strict.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/solidcraft-cli/tests/run_strict.rs b/apps/solidcraft-cli/tests/run_strict.rs index f76299463..590ae6cb6 100644 --- a/apps/solidcraft-cli/tests/run_strict.rs +++ b/apps/solidcraft-cli/tests/run_strict.rs @@ -65,7 +65,10 @@ fn allow_errors_writes_anyway_and_a_saved_design_keeps_failing() { let output = cli().arg("run").arg(dir.broken_script()).arg("--allow-errors").arg("--out").arg(&step).arg("--save").arg(&saved).output().unwrap(); assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr)); let measured: Value = serde_json::from_slice(&output.stdout).unwrap(); - assert_eq!(measured["total"]["volume_mm3"], json!(4000.0), "the box without its fillet"); + // SMLib integrates the volume (a relative accuracy of 1e-4 asked for; a box comes out within + // a few units in the last place), so the box's 4000 mm³ is checked to 1e-9, not to the bit. + let volume = measured["total"]["volume_mm3"].as_f64().unwrap(); + assert!((volume - 4000.0).abs() < 4000.0 * 1e-9, "the box without its fillet: {volume}"); assert!(std::fs::metadata(&step).unwrap().len() > 0); // The saved design still holds the failing feature: running it fails too, `eval` reports it. let again = dir.0.join("again.step");