P23-03: 生活の観察

This commit is contained in:
Agent Control Runner
2026-10-15 09:47:27 +09:00
parent 59a1385536
commit baa4f2d563
2 changed files with 22 additions and 1 deletions
@@ -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')