Skip to content

Commit dbf051b

Browse files
Harden CH-006 event-priority evidence
1 parent c3d2c3f commit dbf051b

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

compat-test/compat_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,13 @@ def summarize_worker_result(out_file, returncode, output, timed_out, elapsed, en
493493
def ensure_tr_lib(opts, staging):
494494
lib_dir = staging / "lib"
495495
lib_dir.mkdir(parents=True, exist_ok=True)
496+
# A previous run may have staged a different Bot API version. The generated boot scripts
497+
# use a wildcard classpath, so retaining both versions silently selects the wrong one.
498+
for entry in list(lib_dir.iterdir()):
499+
if entry.is_dir():
500+
shutil.rmtree(entry, ignore_errors=True)
501+
else:
502+
entry.unlink(missing_ok=True)
496503
for jar in (opts.bridge_api_jar, opts.bot_api_jar, opts.wrapper_jar):
497504
src = Path(jar)
498505
dst = lib_dir / src.name

compat-test/conformance-robots/conformance/probes/EventPriorityProbe.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ public class EventPriorityProbe extends AdvancedRobot {
1111

1212
@Override
1313
public void run() {
14+
// Establish a scan control before the wall-handler window; the full sweep reaches the
15+
// stationary sample.Target regardless of the engines' unseeded starting positions.
16+
turnRadarRight(360);
1417
while (true) {
1518
ahead(10);
1619
}
@@ -28,6 +31,7 @@ public void onHitWall(HitWallEvent event) {
2831

2932
@Override
3033
public void onScannedRobot(ScannedRobotEvent event) {
34+
out.println("ScanObserved!!!");
3135
if (wallHandlerActive) {
3236
out.println("ScannedDuringWallHandler!!!");
3337
}

conformance-test/src/test/java/dev/robocode/tankroyale/bridge/conformance/EventPriorityConformanceTest.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.junit.jupiter.api.Test;
55

66
import static org.junit.jupiter.api.Assertions.assertFalse;
7+
import static org.junit.jupiter.api.Assertions.assertTrue;
78

89
/**
910
* Acceptance evidence for EVT-015 — the classic event-priority filter expectation.
@@ -17,17 +18,22 @@ class EventPriorityConformanceTest extends ConformanceTestBase {
1718

1819
private static final String ROBOT = "conformance.probes.EventPriorityProbe";
1920
private static final String ENEMY = "sample.Target";
21+
private static final String SCAN_OBSERVED = "ScanObserved!!!";
2022
private static final String SCANNED = "ScannedDuringWallHandler!!!";
2123
private static final java.nio.file.Path SOURCE = ConformanceHarness.repoRoot()
2224
.resolve("compat-test/conformance-robots/conformance/probes/EventPriorityProbe.java");
2325

2426
@Test
2527
@DisplayName("EVT-015: a lower-priority scan is suppressed on both engines")
2628
void testEVT015_IntegrationPositive_LowerPriorityScanIsSuppressedOnBothEngines() {
27-
assertOnBothEngines(ROBOT, SOURCE, ENEMY, (outcome, engine) ->
29+
assertOnBothEngines(ROBOT, SOURCE, ENEMY, (outcome, engine) -> {
30+
assertTrue(outcome.anyConsoleContains(SCAN_OBSERVED),
31+
() -> "the priority probe observed no scan on " + engine
32+
+ " (" + outcome.summary() + ")");
2833
assertFalse(outcome.anyConsoleContains(SCANNED),
2934
() -> "the lower-priority scan handler ran on " + engine
30-
+ " (" + outcome.summary() + ")"));
35+
+ " (" + outcome.summary() + ")");
36+
});
3137
}
3238

3339
@Test
@@ -36,6 +42,14 @@ void testEVT015_IntegrationNegative_BridgeDoesNotReportAScanClassicDidNotSee() {
3642
BattleOutcome classic = outcomeFor(Engine.CLASSIC, ROBOT, SOURCE, ENEMY);
3743
BattleOutcome bridge = outcomeFor(Engine.BRIDGE, ROBOT, SOURCE, ENEMY);
3844

45+
assertTrue(classic.completed(), () -> "the classic priority-probe battle did not complete ("
46+
+ classic.summary() + ")");
47+
assertTrue(bridge.completed(), () -> "the bridge priority-probe battle did not complete ("
48+
+ bridge.summary() + ")");
49+
assertTrue(classic.anyConsoleContains(SCAN_OBSERVED),
50+
() -> "the classic priority probe observed no scan (" + classic.summary() + ")");
51+
assertTrue(bridge.anyConsoleContains(SCAN_OBSERVED),
52+
() -> "the bridge priority probe observed no scan (" + bridge.summary() + ")");
3953
assertFalse(classic.anyConsoleContains(SCANNED),
4054
() -> "the classic priority-probe baseline reported a scan ("
4155
+ classic.summary() + ")");

0 commit comments

Comments
 (0)