From 4f12087539d7baf0b1da79663242bdc1b9ad9937 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Mon, 21 Sep 2026 22:49:31 +0300 Subject: [PATCH] test(constraints): a negative distance value validates by its magnitude #1415 made a dimensional Distance keep a negative value's sign in the parameter while the geometry uses its magnitude (and a zero fold the points together), but left the value-domain test asserting the old refusal. Assert the new reading, and keep the radius refusal covered. Co-Authored-By: Claude Fable 5.1 --- src/scene/parametric_solve.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/scene/parametric_solve.rs b/src/scene/parametric_solve.rs index 00ae2ae85..f1daeb8a1 100644 --- a/src/scene/parametric_solve.rs +++ b/src/scene/parametric_solve.rs @@ -4140,12 +4140,25 @@ mod tests { Vector3::new(1.0, 0.0, 0.0), ))); let refs = [ParametricRef::point(line, 0), ParametricRef::point(line, 1)]; + // A distance keeps a negative value's sign in the parameter and + // measures its magnitude (`d1=-50`); a radius has no such reading. assert!(scene .validate_parametric_constraint( ConstraintKind::Distance, &refs, Some(&DrivingValue::Literal(-1.0)), ) + .is_ok()); + let circle = scene.add_entity(EntityType::Circle(acadrust::entities::Circle::from_center_radius( + Vector3::new(0.0, 0.0, 0.0), + 1.0, + ))); + assert!(scene + .validate_parametric_constraint( + ConstraintKind::Radius, + &[ParametricRef::whole(circle)], + Some(&DrivingValue::Literal(-1.0)), + ) .is_err()); assert!(scene .validate_parametric_constraint(