P23-03: 生活の観察
This commit is contained in:
+1
-1
@@ -83,7 +83,7 @@ func run(tree: SceneTree, directory: String, layout: String) -> bool:
|
|||||||
&"guests": guest_records, &"path": runtime.path_service.create_snapshot(),
|
&"guests": guest_records, &"path": runtime.path_service.create_snapshot(),
|
||||||
&"elevators": runtime.elevators.create_snapshot(), &"facilities": runtime.facility_service.create_snapshot()}) and ok
|
&"elevators": runtime.elevators.create_snapshot(), &"facilities": runtime.facility_service.create_snapshot()}) and ok
|
||||||
for guest: Dictionary in guest_records[&"guests"]:
|
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
|
finished[guest[&"guest_id"]] = offset
|
||||||
if offset % 30 == 0:
|
if offset % 30 == 0:
|
||||||
view.queue_redraw()
|
view.queue_redraw()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Local semantic-checker tests; synthetic examples are never game evidence."""
|
"""Local semantic-checker tests; synthetic examples are never game evidence."""
|
||||||
import copy
|
import copy
|
||||||
|
import ast
|
||||||
import unittest
|
import unittest
|
||||||
import sys
|
import sys
|
||||||
import contextlib
|
import contextlib
|
||||||
@@ -17,6 +18,26 @@ sys.dont_write_bytecode = True
|
|||||||
import check_p23_life_observation_evidence as check
|
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):
|
class ImageTests(unittest.TestCase):
|
||||||
def test_collector_conversion_is_bound_to_each_cua_screenshot(self):
|
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')
|
runner = check.module('p23_unit_collector', check.ROOT/'tools/run_p23_life_observation.py')
|
||||||
|
|||||||
Reference in New Issue
Block a user