From baa4f2d5632127038c18d1843fc55e8aed587382 Mon Sep 17 00:00:00 2001 From: Agent Control Runner Date: Thu, 15 Oct 2026 09:47:27 +0900 Subject: [PATCH] =?UTF-8?q?P23-03:=20=E7=94=9F=E6=B4=BB=E3=81=AE=E8=A6=B3?= =?UTF-8?q?=E5=AF=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/fixtures/p23-03/layout_comparison.gd | 2 +- tools/test_p23_life_observation_evidence.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/fixtures/p23-03/layout_comparison.gd b/tests/fixtures/p23-03/layout_comparison.gd index 4158841..8c42e50 100644 --- a/tests/fixtures/p23-03/layout_comparison.gd +++ b/tests/fixtures/p23-03/layout_comparison.gd @@ -83,7 +83,7 @@ func run(tree: SceneTree, directory: String, layout: String) -> bool: &"guests": guest_records, &"path": runtime.path_service.create_snapshot(), &"elevators": runtime.elevators.create_snapshot(), &"facilities": runtime.facility_service.create_snapshot()}) and ok for guest: Dictionary in guest_records[&"guests"]: - if guest[&"current_cell"] != GOAL or finished.has(guest[&"guest_id"]): continue + if guest[&"current_cell"] != [GOAL.x, GOAL.y, GOAL.z] or finished.has(guest[&"guest_id"]): continue finished[guest[&"guest_id"]] = offset if offset % 30 == 0: view.queue_redraw() diff --git a/tools/test_p23_life_observation_evidence.py b/tools/test_p23_life_observation_evidence.py index 4c149b4..d7eecb1 100644 --- a/tools/test_p23_life_observation_evidence.py +++ b/tools/test_p23_life_observation_evidence.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 """Local semantic-checker tests; synthetic examples are never game evidence.""" import copy +import ast import unittest import sys import contextlib @@ -17,6 +18,26 @@ sys.dont_write_bytecode = True import check_p23_life_observation_evidence as check +class SnapshotCellTests(unittest.TestCase): + def test_layout_arrival_compares_serialized_cell_arrays(self): + source = (check.ROOT / 'tests/fixtures/p23-03/layout_comparison.gd').read_text() + serializer = (check.ROOT / 'scripts/guest/guest_runtime.gd').read_text() + self.assertIn('&"current_cell": _cell_to_array(current_cell)', serializer) + goal = check.re.search(r'const GOAL := Vector3i\(([^)]+)\)', source) + self.assertIsNotNone(goal) + coordinates = ast.literal_eval('[' + goal.group(1) + ']') + comparison = check.re.search(r'if guest\[&"current_cell"\] != (.+?) or finished\.has', source) + self.assertIsNotNone(comparison) + expression = comparison.group(1) + self.assertEqual(expression, '[GOAL.x, GOAL.y, GOAL.z]') + for axis, value in zip('xyz', coordinates): + expression = expression.replace('GOAL.' + axis, str(value)) + target = ast.literal_eval(expression) + self.assertEqual(json.loads('[2, 1, 0]'), target) + for cell in ([2, 0, 0], [3, 1, 0], [2, 1, 1]): + self.assertNotEqual(cell, target) + + class ImageTests(unittest.TestCase): def test_collector_conversion_is_bound_to_each_cua_screenshot(self): runner = check.module('p23_unit_collector', check.ROOT/'tools/run_p23_life_observation.py')