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.
51 lines
2.8 KiB
GDScript
51 lines
2.8 KiB
GDScript
extends SceneTree
|
|
var checks := 0
|
|
var failures := 0
|
|
func _initialize() -> void:
|
|
call_deferred("_run")
|
|
func expect(ok: bool, message: String) -> void:
|
|
checks += 1
|
|
if not ok:
|
|
failures += 1
|
|
push_error(message)
|
|
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()
|
|
expect(runtime.initialize(clock, state, 424242)[&"valid"], "initialize")
|
|
clock.set_paused(true)
|
|
expect(runtime.enable_production_operations()[&"ok"], "enable production operations")
|
|
var definition: FacilityDefinition = runtime.definition_registry.get_facility(&"guest_corridor")
|
|
var old_rate := definition.maintenance_gold
|
|
definition.maintenance_gold = 1440
|
|
expect(runtime.submit_command(&"build_facility", {&"definition_id": &"guest_corridor", &"origin": Vector3i(4, 1, 0)}).is_success(), "normal construction")
|
|
clock.advance_minutes(10)
|
|
expect(runtime.construction_service.get_facilities().size() == 1, "owned infrastructure completed")
|
|
for day in range(1, 3):
|
|
clock.advance_minutes(day * 1440 - clock.absolute_minute)
|
|
var summary: Dictionary = runtime.operations_coordinator.get_day_summary(day)
|
|
expect(not summary.is_empty(), "calendar day %d closes" % day)
|
|
if not summary.is_empty():
|
|
var expense := 1070 if day == 1 else 1440
|
|
expect(summary[&"category_totals"][&"maintenance"] == expense and summary[&"net_profit"] == -expense, "only ownership upkeep causes day %d loss" % day)
|
|
expect(summary[&"arrears_total"] == 0 and runtime.operations_coordinator.get_consecutive_insolvency_count() == day, "fully paid loss still advances consecutive losses")
|
|
print("UPKEEP_LOSS_PROGRESS day=", day)
|
|
clock.advance_minutes(1439)
|
|
var before: Dictionary = runtime.create_snapshot()
|
|
expect(runtime.restore_snapshot(before), "restore one minute before third maintenance loss")
|
|
clock.advance_minutes(1)
|
|
expect(clock.absolute_minute == 4320 and clock.paused and runtime.operations_coordinator.is_terminal(), "third paid maintenance loss ends game at midnight")
|
|
expect(runtime.economy_service.get_balance(&"PLAYER_CASH") == 1030, "cash reconciles construction and three prorated bills")
|
|
var final: Dictionary = runtime.create_snapshot()
|
|
expect(runtime.restore_snapshot(final) and runtime.create_snapshot() == final, "terminal save preserves expenses and outcome exactly")
|
|
clock.advance_minutes(60)
|
|
expect(runtime.economy_service.get_balance(FacilityUpkeepSettlement.EXPENSE) == 3950 and runtime.upkeep_settlement.get_settled_period_count() == 3, "terminal clock never collects a fourth bill")
|
|
definition.maintenance_gold = old_rate
|
|
runtime.free()
|
|
clock.free()
|
|
state.free()
|
|
print("%s: %d checks" % ["PASS" if failures == 0 else "FAIL", checks])
|
|
quit(failures)
|