mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-08 13:01:52 +00:00
difftest: geom.grid — expand of an opaque surface label emits the shim sentinel (nightly fuzz00105)
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
//! `observe_cached` ops, which opt into real, explicitly defined surface caches
|
||||
//! (`SurfaceGridElement::init`, `Grid::expand_hierarchy` and `Grid::add_surface_node`
|
||||
//! run on the node of the actual cache). They do not resolve the opaque object labels
|
||||
//! of `add_hier { surface: true }`, which can be dumped but not expanded (the shim
|
||||
//! would dereference the fake pointer, so `expand` of one is an invalid program).
|
||||
//! of `add_hier { surface: true }`, which can be dumped but not expanded. For those
|
||||
//! labels, `expand` emits the shim's -2 skip sentinel without changing the grid.
|
||||
//! The observer records cache leaf order, surface identities, pool order, voxel
|
||||
//! memberships and all surface-leaf fields, in addition to the original dumps.
|
||||
|
||||
@@ -403,10 +403,11 @@ fn run_rust_controlled(
|
||||
Op::Dump => dump(&g, &mut oi, &mut of)?,
|
||||
Op::Expand { h } => {
|
||||
let id = HierarchyId(*h as usize);
|
||||
// The shim would dereference the fake surface of `add_hier { surface }`;
|
||||
// Match shim operation 9: skip opaque surface labels;
|
||||
// real surfaces are expanded with `expand_cached`.
|
||||
if g.hierarchy_element(id).is_ok_and(|e| e.surface().is_some()) {
|
||||
return Err(native::invalid("expand of an opaque surface label"));
|
||||
oi.push(-2);
|
||||
continue;
|
||||
}
|
||||
// A base-class element fails before it reads the cache.
|
||||
let kernel = Kernel::default();
|
||||
|
||||
@@ -92,7 +92,8 @@ fn the_formerly_deferred_fixtures_run_real_surface_caches() {
|
||||
}
|
||||
|
||||
/// An opaque surface label (`add_hier { surface: true }`) can be dumped but not
|
||||
/// expanded, even next to an explicit surface of the same numeric label.
|
||||
/// expanded: operation 9 emits the skip sentinel, even next to an explicit
|
||||
/// surface of the same numeric label.
|
||||
#[test]
|
||||
fn explicit_definition_does_not_resolve_an_opaque_label() {
|
||||
let explicit: Inputs = fixture(NEW_FIXTURES, "native_affine_hierarchy_single")
|
||||
@@ -109,10 +110,12 @@ fn explicit_definition_does_not_resolve_an_opaque_label() {
|
||||
},
|
||||
Op::Expand { h: 0 },
|
||||
];
|
||||
assert!(matches!(
|
||||
run_rust(&i, &mut Stats::default()),
|
||||
Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. })
|
||||
));
|
||||
let cpp = ffi::run(&prog(&i)).unwrap();
|
||||
assert_eq!(cpp.0, vec![0, 0, -2]);
|
||||
let rust = run_rust(&i, &mut Stats::default()).unwrap();
|
||||
assert_eq!(rust.0, cpp.0);
|
||||
let r = compare(&output(cpp), &output(rust), &[]);
|
||||
assert!(r.pass(), "{r:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user