Files
TheTree_mock/tests/environment/test_cleaning_access.gd
T
Takeshi 5dde0c5ec2 Record original-alignment implementation and traceability checkpoint
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.
2026-09-30 23:52:24 +09:00

33 lines
2.3 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)
class Fixture extends RefCounted:
var facility_service:=FacilityService.new()
var path_service:=PathService.new()
func _initialize()->void:call_deferred("run")
func run()->void:
var fixture:=Fixture.new()
var bridge=preload("res://scripts/environment/facility_cleaning_bridge.gd").new()
bridge.configure(fixture)
fixture.facility_service.create_instance({&"instance_id":&"target",&"definition_id":&"reception",&"origin":Vector3i(3,0,0),&"occupied_cells":[Vector3i(3,0,0),Vector3i(4,0,0)]})
var worker:=StaffRuntime.new();worker.current_cell=Vector3i(6,0,0)
var task:=StaffTask.new().configure(&"clean",&"facility_clean",50,0,{&"target_entity_id":&"target",&"target_cell":Vector3i(2,0,0),&"estimated_minutes":8})
var cells: Array[Vector3i]=[Vector3i(2,0,0),Vector3i(4,0,0),Vector3i(5,0,0),Vector3i(6,0,0)]
fixture.path_service.rebuild_graph(cells)
expect(bridge.prepare_route(task,worker) and task.target_cell==Vector3i(5,0,0),"isolated first access is replaced by reachable closest access")
var destination:=task.target_cell
expect(bridge.prepare_route(task,worker) and task.target_cell==destination,"reachable destination remains stable")
cells=[Vector3i(2,0,0),Vector3i(4,0,0),Vector3i(6,0,0)]
fixture.path_service.rebuild_graph(cells)
expect(destination in bridge.access_cells(fixture.facility_service.get_instance(&"target"),fixture.path_service,false) and destination not in bridge.access_cells(fixture.facility_service.get_instance(&"target"),fixture.path_service),"blocked saved destination remains geometrically valid while not walkable")
expect(not bridge.prepare_route(task,worker) and worker.current_cell==Vector3i(6,0,0) and task.target_cell==destination,"total isolation neither moves worker nor invents destination")
cells=[Vector3i(2,0,0),Vector3i(3,0,0),Vector3i(4,0,0),Vector3i(5,0,0),Vector3i(6,0,0)]
fixture.path_service.rebuild_graph(cells)
expect(bridge.prepare_route(task,worker),"route resumes after reconnection")
fixture.facility_service.unregister_instance(&"target")
expect(not bridge.prepare_route(task,worker),"removed facility has no work destination")
print("Cleaning access: %d checks, %d failures"%[checks,failures]);quit(failures)