7e1f1483a4
- Document exception handling, zero-value BotResult trap, shared adversary bots - Add offline parsing example using parseServerOutput - Skip tests gracefully when JARs missing (guard before suite blocks) - Fix blocking readLine in runner_process.nim: poll with 50ms sleep + atEnd check (was preventing timeout enforcement, now blocks correctly during battle) - Add test task to QBot.nimble and config.nims setup docs to AGENTS.md - Add debug logging to TestBattleRunner for bot identity tracking Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
1008 B
Nim
31 lines
1008 B
Nim
## Integration test: OscillatorBot vs SittingDuck, 3 rounds.
|
|
## Requires a running TR server (set TR_SERVER_JAR / TR_BATTLE_RUNNER env vars).
|
|
|
|
import std/[os, unittest]
|
|
import test_framework/test_framework
|
|
|
|
const
|
|
oscillatorDir = currentSourcePath().parentDir.parentDir # OscillatorBot_garage/
|
|
sittingDuckDir = currentSourcePath().parentDir.parentDir.parentDir / "common_libs" / "test_framework" / "adversaries" / "SittingDuck"
|
|
|
|
suite "OscillatorBot basic battle":
|
|
test "beats SittingDuck in 3 rounds":
|
|
let r = runBattle(@[oscillatorDir, sittingDuckDir], rounds = 3)
|
|
|
|
check r.rounds.len == 3
|
|
check r.results.len == 2
|
|
|
|
let oscillator = block:
|
|
var found: BotResult
|
|
for b in r.results:
|
|
if b.name == "OscillatorBot": found = b
|
|
found
|
|
let duck = block:
|
|
var found: BotResult
|
|
for b in r.results:
|
|
if b.name == "SittingDuck": found = b
|
|
found
|
|
|
|
check oscillator.totalScore > duck.totalScore
|
|
check "OscillatorBot" in r.winners
|