extends SceneTree var failures := 0 func _initialize() -> void: var history = load("res://scripts/ui/simulation_history.gd") _assert(history._action_for_state("completed") == "results", "completed simulations should open results") _assert(history._action_for_state("block_active") == "resume", "active blocks should resume") _assert(history._action_for_state("between_blocks") == "resume", "between-block simulations should resume") _assert(history._action_for_state("abandoned") == "none", "abandoned simulations should be read-only") _assert(history.has_active_simulation({"hasActiveSimulation": true}, {}), "readiness should identify an active simulation") _assert(history.has_active_simulation({}, {"state": "block_active"}), "a loaded active block should be resumable") _assert(history.has_active_simulation({}, {"state": "between_blocks"}), "a loaded between-block simulation should be resumable") _assert(not history.has_active_simulation({}, {"state": "completed"}), "completed simulations should not appear active") quit(1 if failures > 0 else 0) func _assert(condition: bool, message: String) -> void: if condition: return failures += 1 push_error(message)