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.
38 lines
2.1 KiB
GDScript
38 lines
2.1 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 world:=WorldService.new()
|
|
var bounds:={&"min_x":0,&"max_x":5,&"min_y":-2,&"max_y":2}
|
|
world.reset(bounds)
|
|
world.set_walkable(Vector3i(0,0,0),true)
|
|
world.set_support(Vector3i(0,0,0),5,true)
|
|
var original:=world.create_snapshot()
|
|
var copy:=world.create_snapshot()
|
|
copy[&"support"][0][&"capacity"]=99
|
|
copy[&"bounds"][&"max_x"]=99
|
|
copy[&"walkable_cells"].clear()
|
|
expect(world.create_snapshot()==original,"cached snapshots remain caller-owned")
|
|
world.consume_dirty_cells()
|
|
expect(world.create_snapshot()[&"dirty_cells"].is_empty(),"dirty consumption is reflected without geometry revision")
|
|
world.set_walkable(Vector3i(1,0,0),true)
|
|
world.set_excavated(Vector3i(1,-1,0),true)
|
|
expect(world.create_snapshot()[&"walkable_cells"].size()==2 and world.create_snapshot()[&"excavation_overrides"].size()==1,"geometry mutation invalidates cache")
|
|
var replacement:=original.duplicate(true)
|
|
replacement[&"walkable_cells"]=[Vector3i(2,0,0)]
|
|
expect(world.restore_snapshot(replacement),"restore valid alternate world")
|
|
expect(world.create_snapshot()==replacement,"restore invalidates cached geometry even with reused revision")
|
|
replacement[&"walkable_cells"]=[Vector3i(3,0,0)]
|
|
expect(world.restore_snapshot(replacement) and world.create_snapshot()==replacement,"same-revision alternate restore cannot reuse old geometry")
|
|
var invalid:=replacement.duplicate(true);invalid[&"schema_version"]=-1
|
|
expect(not world.restore_snapshot(invalid) and world.create_snapshot()==replacement,"failed restore preserves cached and authoritative state")
|
|
world.reset(bounds)
|
|
expect(world.create_snapshot()[&"support"].is_empty() and world.create_snapshot()[&"walkable_cells"].is_empty(),"reset invalidates same-revision geometry")
|
|
world.expand_bounds({&"min_x":0,&"max_x":8,&"min_y":-2,&"max_y":2})
|
|
expect(world.create_snapshot()[&"bounds"][&"max_x"]==8,"expansion updates cached bounds")
|
|
print("World snapshot cache: %d checks, %d failures"%[checks,failures]);quit(failures)
|