extends SceneTree const E = preload("res://world/owniverse/math/exact.gd") const Report = preload("res://ui/report/report.gd") class Ledger extends RefCounted: func physical_amounts(_source: Dictionary) -> Dictionary: return {"RD": 3, "HG": 1} class Catalog extends RefCounted: var entities: Dictionary = {} func is_group(_id: String) -> bool: return false class World extends RefCounted: var catalog = Catalog.new() var ledger = Ledger.new() var state = {"amount": {}, "stats": {"total_amount": {"H": 1234}}, "world_parameters": {"Federation": 1, "Enlightenment": 1, "Order": 1}} func _initialize() -> void: call_deferred("run") func run() -> void: var global: Node = root.get_node("Global") var world = World.new() world.state.stats.total_amount.H = E.of("1234567890123456789012345") var before: Dictionary = E.encode(world.state) global.Locale = "en" var text: String = Report.build(world, global) assert(text.contains("75.00%") and text.contains("25.00%"), text) assert(text.contains("1 234 567 890 123 456 789 012 345"), text) assert(text.contains("Total resources obtained") and not text.contains("Total entities emerged"), text) world.state.world_parameters.Federation = E.of("1.3") text = Report.build(world, global) assert(text.contains("Federation:") and text.contains("0.30"), text) world.state.world_parameters.Federation = 1 global.Locale = "ru" text = Report.build(world, global) assert(text.contains("Всего получено ресурсов") and text.contains("Красные карлики"), text) assert(E.encode(world.state) == before, "Report mutated simulation") assert(load("res://stage/stage.gd") != null) print("Universe report checks: PASS") quit()