test: failing regression test for #268: Panic from truck-topology lib.rs:186 when joining struts that end on a bore wall (#283)
* test: reproduce #268 (Panic from truck-topology lib.rs:186 when joining struts that end on a bore wall) * Sew refuses edges whose ends weld to one vertex (#268) The sewer welds vertices on a 1e-6 grid but only rejected edges shorter than 1e-9, so a sliver edge between the two welded its ends into one vertex and truck-topology panicked ("Two same vertices cannot construct an edge") inside the guard. Such an edge is now a degenerate-edge error before any truck call, and the boolean takes its usual fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: bherbruck <brennen.herbruck@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
3 files changed
+36
-1
No files matched your search
@@ -64,3 +64,27 @@ fn oblique_cut_through_a_small_arc_matches_a_split() {
|
||||
assert!((got - above).abs() < 1e-6 * above, "{got} vs {above}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Joining struts that end on a bore wall reached a truck-topology panic (#268). The guard caught it,
|
||||
/// but no kernel call should panic at all (wasm aborts on a panic).
|
||||
#[test]
|
||||
fn struts_ending_on_a_bore_wall_join_without_a_panic() {
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
let me = std::thread::current().id();
|
||||
let count = Arc::new(AtomicUsize::new(0));
|
||||
let c2 = count.clone();
|
||||
let prev = std::panic::take_hook();
|
||||
std::panic::set_hook(Box::new(move |_| {
|
||||
if std::thread::current().id() == me {
|
||||
c2.fetch_add(1, Ordering::SeqCst);
|
||||
}
|
||||
}));
|
||||
let mut s = Session::default();
|
||||
let script: Value = serde_json::from_str(include_str!("../../../examples/regressions/join_struts_on_bore_wall.json")).unwrap();
|
||||
let result = s.run_script(&script);
|
||||
std::panic::set_hook(prev);
|
||||
assert_eq!(count.load(Ordering::SeqCst), 0, "kernel panics during the join");
|
||||
result.unwrap();
|
||||
assert_eq!(s.model.state().bodies.len(), 1);
|
||||
}
|
||||
Reference in new issue
Block a user