use cadrum::Solid;
#[test]
fn test_shell_cube_reduces_volume() {
let cube = Solid::cube(10.0, 10.0, 10.0);
let original_volume = cube.volume();
let open = cube.iter_face().next().unwrap();
let shelled = cube.shell(-0.5, [open]).expect("shell should succeed");
assert!(shelled.volume() > 0.0, "shelled solid must have positive volume");
assert!(shelled.volume() < original_volume, "shelling inward must reduce volume");
}
#[test]
fn test_shell_cube_preserves_solid_structure() {
let cube = Solid::cube(10.0, 10.0, 10.0);
let open = cube.iter_face().next().unwrap();
let shelled = cube.shell(-0.5, [open]).expect("shell should succeed");
assert!(shelled.volume() > 0.0, "shelled cube should produce a valid solid");
}
#[test]
fn test_shell_outward_produces_wall() {
let cube = Solid::cube(10.0, 10.0, 10.0);
let open = cube.iter_face().next().unwrap();
let shell = cube.shell(0.5, [open]).expect("shell outward should succeed");
assert!(shell.volume() > 0.0 && shell.volume() < 1000.0, "outer shell is wall material only, not the original cube");
}
#[test]
fn test_shell_empty_open_faces_inward_seals_cavity() {
let cube = Solid::cube(10.0, 10.0, 10.0);
let sealed = cube.shell(-0.5, std::iter::empty::<&cadrum::Face>()).expect("inward empty-open shell should succeed");
assert!((sealed.volume() - 271.0).abs() < 1e-3, "inward empty shell volume = 10³ − 9³, got {}", sealed.volume());
}
#[test]
fn test_shell_empty_open_faces_outward_seals_cavity() {
let cube = Solid::cube(10.0, 10.0, 10.0);
let sealed = cube.shell(0.5, std::iter::empty::<&cadrum::Face>()).expect("outward empty-open shell should succeed");
let expected = 300.0 + 7.5 * std::f64::consts::PI + std::f64::consts::PI / 6.0;
assert!((sealed.volume() - expected).abs() < 1e-3, "outward empty shell volume ≈ {expected:.3}, got {}", sealed.volume());
}