feat: add structured economic events
This commit is contained in:
@@ -11,6 +11,7 @@ func _run() -> void:
|
||||
_test_legacy_npc_migration()
|
||||
_test_legacy_resource_migration()
|
||||
_test_legacy_world_storage_migration()
|
||||
_test_previous_world_event_migration()
|
||||
_test_schema_rejection()
|
||||
|
||||
if failures.is_empty():
|
||||
@@ -203,6 +204,24 @@ func _test_legacy_world_storage_migration() -> void:
|
||||
)
|
||||
manager.free()
|
||||
|
||||
func _test_previous_world_event_migration() -> void:
|
||||
var manager := _create_manager(56)
|
||||
var previous_data: Dictionary = manager.create_state_record().to_dictionary()
|
||||
previous_data["schema_version"] = (
|
||||
SimulationStateRecord.PREVIOUS_SCHEMA_VERSION
|
||||
)
|
||||
previous_data.erase("economic_events")
|
||||
previous_data["simulation"].erase("next_event_id")
|
||||
var migrated := SimulationStateRecord.from_dictionary(previous_data)
|
||||
_check(migrated != null, "World schema v2 should add an empty event stream")
|
||||
if migrated != null:
|
||||
_check(
|
||||
migrated.economic_events.is_empty()
|
||||
and int(migrated.simulation["next_event_id"]) == 0,
|
||||
"World v2 migration should initialize deterministic event identity"
|
||||
)
|
||||
manager.free()
|
||||
|
||||
func _create_manager(seed_value: int) -> Node:
|
||||
var manager: Node = load("res://simulation/SimulationManager.gd").new()
|
||||
manager.simulation_seed = seed_value
|
||||
|
||||
Reference in New Issue
Block a user