feat(simulation): sprint 9 gauntlet — test infrastructure and first 3 rooms
Add Gauntlet test world with 3 rooms (Inventory Warehouse, Occlusion Corridor, Pause Chamber) + Central Hub, room constants module, room reset trigger mechanism, Layer 3 subprocess integration test, golden file comparison engine and test suite, and content runtime validation. Tickets: #482, #484, #485, #487, #488, #489, #490 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,19 @@ impl EntityRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
/// Advance the next StableId counter to `target`.
|
||||
/// Used to reserve StableId ranges for entities not yet spawned
|
||||
/// (e.g., Gauntlet rooms built in later sprints).
|
||||
/// Panics if `target` is less than the current next_id.
|
||||
pub fn reserve_up_to(&mut self, target: u64) {
|
||||
assert!(
|
||||
target >= self.next_id,
|
||||
"cannot reserve backwards: next_id={}, target={}",
|
||||
self.next_id, target
|
||||
);
|
||||
self.next_id = target;
|
||||
}
|
||||
|
||||
/// Number of registered entities.
|
||||
pub fn len(&self) -> usize {
|
||||
self.by_entity.len()
|
||||
@@ -229,6 +242,30 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reserve_up_to_advances_counter() {
|
||||
let mut world = World::new();
|
||||
let mut registry = EntityRegistry::new(0);
|
||||
|
||||
let e1 = world.spawn_empty().id();
|
||||
let id1 = registry.register(e1);
|
||||
assert_eq!(id1, StableId(0));
|
||||
|
||||
// Reserve through 5 (skip IDs 1-4)
|
||||
registry.reserve_up_to(5);
|
||||
|
||||
let e2 = world.spawn_empty().id();
|
||||
let id2 = registry.register(e2);
|
||||
assert_eq!(id2, StableId(5), "next ID after reserve should be 5");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "cannot reserve backwards")]
|
||||
fn reserve_up_to_panics_on_backwards() {
|
||||
let mut registry = EntityRegistry::new(10);
|
||||
registry.reserve_up_to(5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unregister_unknown_entity_is_noop() {
|
||||
// #469: Unregistering an entity that was never registered must not panic.
|
||||
|
||||
Reference in New Issue
Block a user