Minecraft-Console-Client/tools/tests/test_pathing_capabilities.py
BruceChen 418f17b4a1 pathing: add side-wall theory, full-coverage parkour test suite, and live test fixes
Theory simulator:
- Add 2D side-wall jump physics with yaw sweep for worst-case margin
- Generate sidewall theory cases (flat/ascend/descend, wall_offset 0/1)
- Add momentum-capabilities.json with band compression and max_reach
- Extend models, capabilities, canonical, and renderers for sidewall

Full-coverage parkour test suite (tools/test-parkour.py):
- Derive test matrix from momentum-capabilities.json
- Build linear/neo/ceiling courses via RCON with 7-block clear margin
- Use /goto for pathfinding, parse A* and PathMgr log output
- Stop-at-first-failure per (family, subfamily, dy, ceil, wo) group
- Hierarchical --filter (e.g. linear/flat, ceiling/headhitter/ceil2.5)
- Exclude sidewall from default matrix (identical max_reach to linear)

Pathing execution fixes:
- Align parkour contracts and timing budgets with live test results
- Fix jump-entry yaw snapping for grounded handoffs
- Template helper and sprint jump template refinements

Made-with: Cursor
2026-04-15 17:52:47 +00:00

71 lines
2.4 KiB
Python

import subprocess
import unittest
from tools.pathing_theory.capabilities import build_momentum_capability_bands
from tools.pathing_theory.simulator import build_theory_cases
class PathingCapabilityTests(unittest.TestCase):
def test_linear_descend_sprint_dy_minus2_compresses_into_mm_breakpoints(self) -> None:
bands = build_momentum_capability_bands(build_theory_cases())
rows = [
band
for band in bands
if band.family == "linear"
and band.subfamily == "descend"
and band.movement_mode == "sprint"
and band.delta_y == -2.0
]
self.assertEqual(
[(band.min_mm, band.max_mm, band.max_reach) for band in rows],
[(0, 0, 4), (1, 12, 5)],
)
def test_linear_ascend_walk_dy_plus1_compresses_into_mm_breakpoints(self) -> None:
bands = build_momentum_capability_bands(build_theory_cases())
rows = [
band
for band in bands
if band.family == "linear"
and band.subfamily == "ascend"
and band.movement_mode == "walk"
and band.delta_y == 1.0
]
self.assertEqual(
[(band.min_mm, band.max_mm, band.max_reach) for band in rows],
[(0, 0, 1), (1, 12, 2)],
)
def test_ceiling_sprint_height_2p5_has_late_mm_breakpoint(self) -> None:
bands = build_momentum_capability_bands(build_theory_cases())
rows = [
band
for band in bands
if band.family == "ceiling"
and band.subfamily == "headhitter"
and band.movement_mode == "sprint"
and band.ceiling_height == 2.5
]
self.assertEqual(
[(band.min_mm, band.max_mm, band.max_reach) for band in rows],
[(0, 7, 2), (8, 12, 3)],
)
def test_sim_jump_reach_lists_momentum_capabilities(self) -> None:
result = subprocess.run(
["python3", "tools/sim_jump_reach.py", "--list-capabilities"],
check=False,
capture_output=True,
text=True,
)
self.assertEqual(result.returncode, 0, result.stderr)
self.assertIn("linear | descend | sprint | dy=-2.0 | mm=0..0 | max_gap=4", result.stdout)
self.assertIn("linear | ascend | walk | dy=1.0 | mm=1..12 | max_gap=2", result.stdout)
if __name__ == "__main__":
unittest.main()