diff --git a/crates/smlib/src/check.rs b/crates/smlib/src/check.rs index 145bf66f3..8fa247b14 100644 --- a/crates/smlib/src/check.rs +++ b/crates/smlib/src/check.rs @@ -69,6 +69,24 @@ mod tests { } } + #[test] + fn every_primitive_is_valid_at_every_level() { + let o = [1.0, 2.0, 3.0]; + let bodies = [ + ("cylinder", Brep::make_cylinder(o, 15.0, 50.0).unwrap()), + ("sphere", Brep::make_sphere(o, 12.0).unwrap()), + ("frustum", Brep::make_cone(o, 10.0, 4.0, 20.0).unwrap()), + ("cone", Brep::make_cone(o, 10.0, 0.0, 20.0).unwrap()), + ("torus", Brep::make_torus(o, 22.0, 4.0).unwrap()), + ]; + for (name, b) in &bodies { + for level in [CheckLevel::Basic, CheckLevel::Geometry, CheckLevel::All] { + let r = b.check(level).unwrap(); + assert!(r.is_valid(), "{name}, {level:?}: {r}"); + } + } + } + #[test] fn a_copy_and_a_native_file_round_trip_stay_valid() { let b = Brep::make_box([0.0; 3], [2.0, 3.0, 4.0]).unwrap();