Capture current source, content data, tests, asset licenses, and original-specification traceability. Original implementation remains incomplete. The accepted matching UI generation passed 154 suites and 12,253 checks, with eight rendered staff-contract screens reviewed. Latest native Windows and full-original acceptance remain outstanding.
32 lines
2.0 KiB
GDScript
32 lines
2.0 KiB
GDScript
extends SceneTree
|
|
var checks := 0
|
|
var failures := 0
|
|
func expect(ok: bool, label: String) -> void:
|
|
checks += 1
|
|
if not ok: failures += 1; push_error(label)
|
|
func _initialize() -> void: call_deferred("run")
|
|
func run() -> void:
|
|
var runtime: Variant=load("res://autoload/simulation_runtime.gd").new()
|
|
var clock: Variant=load("res://autoload/game_clock.gd").new()
|
|
var state: Variant=load("res://autoload/game_state.gd").new()
|
|
clock.reset(1,6,0);state.reset();runtime.initialize(clock,state,42640);clock.set_paused(true)
|
|
expect(runtime.submit_command(&"register_staff",{&"staff_id":&"worker", &"role_id":&"porter", &"options":{&"current_cell":Vector3i(-8,0,0), &"state":StaffRuntime.State.AVAILABLE}}).is_success(), "register worker")
|
|
expect(runtime.submit_command(&"create_staff_task",{&"task_id":&"timed_work", &"task_type":&"inspection", &"priority":50, &"options":{&"target_cell":Vector3i(-8,0,0), &"estimated_minutes":8}}).is_success(), "create eight-minute task")
|
|
var task: StaffTask=runtime.staff_service.get_task(&"timed_work")
|
|
for minute in 10:
|
|
clock.advance_one_minute()
|
|
if task.state==StaffTask.State.WORKING: break
|
|
expect(task.state==StaffTask.State.WORKING and task.progress_minutes==0, "arrival begins work without consuming a minute")
|
|
var start: Dictionary=runtime.create_snapshot()
|
|
for elapsed in range(1,8):
|
|
clock.advance_one_minute()
|
|
expect(task.state==StaffTask.State.WORKING and task.progress_minutes==elapsed, "one tick advances exactly one work minute: %d" % elapsed)
|
|
clock.advance_one_minute()
|
|
expect(task.state==StaffTask.State.COMPLETED and task.progress_minutes==8, "completes at exactly eight elapsed work minutes")
|
|
var finished: Dictionary=runtime.create_snapshot()
|
|
expect(runtime.restore_snapshot(start), "restore active work")
|
|
clock.advance_minutes(8)
|
|
expect(runtime.create_snapshot()==finished, "restored work reproduces exact completion state")
|
|
runtime.free();clock.free();state.free()
|
|
print("Staff task clock: %d checks, %d failures" % [checks,failures]);quit(failures)
|