extends SceneTree ## Test runner entry point. Run with: ## godot --headless -s res://tests/run_all.gd ## ## This script discovers and runs all test files in the tests/ directory. ## For a quick start without GUT installed, this manually instantiates ## each test script and calls every test_*() method it defines. ## Assertion failures are emitted via push_error ("ASSERT FAILED ..."). var _failures: int = 0 func _init() -> void: print("=== Raidborne Test Suite ===") var total_passed := 0 # Combat tests total_passed += _run_test_script("res://tests/combat/test_gcd.gd") total_passed += _run_test_script("res://tests/combat/test_combo_positional.gd") total_passed += _run_test_script("res://tests/combat/test_damage_calc.gd") total_passed += _run_test_script("res://tests/combat/test_gimmick_gauges.gd") # Progression tests total_passed += _run_test_script("res://tests/progression/test_xp_system.gd") total_passed += _run_test_script("res://tests/progression/test_drop_table.gd") # Network / fight simulation tests total_passed += _run_test_script("res://tests/network/test_fight_sim.gd") total_passed += _run_test_script("res://tests/network/test_raid_server.gd") print("\n=== Results: %d test methods run, %d assertion failures ===" % [total_passed, _failures]) quit(1 if _failures > 0 else 0) func _run_test_script(path: String) -> int: var script: Script = load(path) if script == null: push_error("Cannot load: " + path) return 0 var instance: RefCounted = script.new() if instance == null: _failures += 1 print(" FAIL (could not instantiate): " + path) return 0 var passed := 0 for method_info in instance.get_method_list(): var name: String = method_info["name"] if name.begins_with("test_"): instance.call(name) passed += 1 var file_failures := int(instance.get("_test_failures")) if file_failures > 0: _failures += file_failures print(" FAIL (%d assertion failures): " % file_failures + path.get_file()) else: print(" PASS: " + path.get_file() + " (%d tests)" % passed) return passed