c671e0b0e3
Adds TR_SAMPLE_BOTS env var support to point to external sample bots (Walls, Fire, SpinBot, etc). Updates test_bullet_economy.nim to use Walls from the sample-bots directory instead of custom WallsBot, removing the hardcoded path dependency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
34 lines
1.2 KiB
Nim
34 lines
1.2 KiB
Nim
## Public API for the TR integration test framework.
|
|
## Import this module only; it re-exports all types you need.
|
|
|
|
import ./server_manager
|
|
import ./bot_compiler
|
|
import ./battle_result
|
|
import ./runner_process
|
|
|
|
export battle_result.BattleResult
|
|
export battle_result.BotResult
|
|
export battle_result.RoundResult
|
|
export battle_result.BotRoundResult
|
|
|
|
proc runBattle*(botDirs: seq[string], rounds: int = 10,
|
|
timeout: int = 120000, maxSpeed: bool = true): BattleResult =
|
|
ensureServer()
|
|
discard compileBots(botDirs)
|
|
let stdout = runBattleRunner(getServerUrl(), botDirs, rounds, timeout, maxSpeed)
|
|
result = parseServerOutput(stdout)
|
|
|
|
when isMainModule:
|
|
echo "test_framework.nim — public API, not a standalone binary."
|
|
echo "Requires a TR server JAR. Usage from your test file:"
|
|
echo ""
|
|
echo " import common_libs/test_framework/test_framework"
|
|
echo " let r = runBattle(@[\"path/to/BotA\", \"path/to/BotB\"])"
|
|
echo " echo r.winners"
|
|
echo ""
|
|
echo "Env vars:"
|
|
echo " TR_SERVER_JAR TR server JAR path"
|
|
echo " TR_BATTLE_RUNNER BattleRunner JAR path"
|
|
echo " TR_BATTLE_RUNNER_DIR BattleRunner class dir"
|
|
echo " TR_SAMPLE_BOTS Directory containing sample bots (e.g. Walls, Fire, SpinBot)"
|