"""Fast regression checks for gameplay control-flow blockers. These tests intentionally inspect the small C++ functions at issue. The Unreal editor build remains the integration gate for syntax, types, and engine APIs. """ from pathlib import Path import unittest ROOT = Path(__file__).resolve().parents[2] def source(relative_path: str) -> str: return (ROOT / relative_path).read_text(encoding="utf-8") def function_body(relative_path: str, signature: str) -> str: text = source(relative_path) start = text.index(signature) open_brace = text.index("{", start) depth = 0 for index in range(open_brace, len(text)): if text[index] == "{": depth += 1 elif text[index] == "}": depth -= 1 if depth == 0: return text[open_brace + 1:index] raise AssertionError(f"Unclosed function body for {signature}") class GameplayBlockerTests(unittest.TestCase): def test_dash_commits_state_only_after_montage_starts(self): body = function_body( "Source/pogo/Variant_Platforming/PlatformingCharacter.cpp", "void APlatformingCharacter::DoDash()", ) self.assertIn("if (!AnimInstance || !DashMontage)", body) self.assertIn("MontageLength <= 0.0f", body) play = body.index("Montage_Play") success_guard = body.index("MontageLength <= 0.0f") state_commit = body.index("bIsDashing = true;") self.assertLess(play, success_guard) self.assertLess(success_guard, state_commit) if __name__ == "__main__": unittest.main()