Mesh memo test: SMLib's booleans mesh neither operand

The test cut three regions from a plate that keeps its meshes and
expected the memo to hold one mesh afterwards: the old kernel's booleans
meshed their operands. On SMLib (ops::boolean -> smlib_boolean, since
42c41464a) a boolean reads the exact record and a tool apart from the
body is found from the exact boxes, so no boolean meshes anything and the
memo is empty after them. The test now asserts that, then that meshing
the kept body twice at one tolerance makes one memo entry, bit-equal to a
fresh mesh, which is the reuse the memo is for.

Fixes kernel body::mesh_memo_tests::regions_cut_from_a_body_keeping_its_meshes_are_unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-29 21:51:09 -04:00
committed by Irakli Kourtis
parent e1b762c4bd
commit b9d0a33080
+5 -3
View File
@@ -14,8 +14,9 @@ fn plate() -> Body {
plate
}
/// Regions cut from a body that keeps its meshes come out as from the body itself, to the bit,
/// and the body is meshed once for all of them.
/// Regions cut from a body that keeps its meshes come out as from the body itself, to the bit.
/// SMLib's booleans read the exact record and mesh neither operand, so they leave the memo
/// empty; the body's own meshing then fills it once per tolerance and reuses it.
#[test]
fn regions_cut_from_a_body_keeping_its_meshes_are_unchanged() {
let plate = plate();
@@ -35,10 +36,11 @@ fn regions_cut_from_a_body_keeping_its_meshes_are_unchanged() {
);
}
let memo = kept.meshes.as_ref().unwrap();
assert_eq!(memo.made.lock().unwrap().len(), 1, "one tolerance, one meshing");
assert_eq!(memo.made.lock().unwrap().len(), 0, "a boolean meshes neither operand");
// A mesh from the memo is the mesh made afresh.
let (a, b) = (kept.mesh(&crate::MeshTolerance::chord(0.05)).unwrap(), plate.mesh(&crate::MeshTolerance::chord(0.05)).unwrap());
let (a2, _) = (kept.mesh(&crate::MeshTolerance::chord(0.05)).unwrap(), ());
assert_eq!(memo.made.lock().unwrap().len(), 1, "one tolerance, one meshing");
for m in [&a, &a2] {
assert_eq!(m.triangles, b.triangles);
assert!(