Стабилизировать проходы пилы уровня 10

This commit is contained in:
2026-08-18 17:32:01 +03:00
parent 650bfb3533
commit da3777b4cc
3 changed files with 79 additions and 9 deletions
@@ -3,6 +3,7 @@ package com.projectsacrifice.game;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
@@ -127,6 +128,40 @@ public final class LevelPlaytestBotTest {
assertFalse(snapshot.playerOnMovingPlatform());
}
@Test
public void groundedApproachWaitsForAliveGroundedPlayerAtCheckpoint() {
LevelPlaytestBot.SnapshotCondition checkpoint =
LevelPlaytestBot.groundedAliveAtOrBeyond(280f);
assertFalse(checkpoint.reached(snapshot(true, true, 279f, 1)));
assertFalse(checkpoint.reached(snapshot(false, true, 280f, 1)));
assertFalse(checkpoint.reached(snapshot(true, false, 280f, 1)));
assertTrue(checkpoint.reached(snapshot(true, true, 280f, 1)));
}
@Test
public void expectedDeathGuardFailsBeforeAnAccidentalRetry() {
LevelPlaytestBot.SnapshotCondition guarded = LevelPlaytestBot.whileDeathsAtMost(
1, snapshot -> snapshot.playerX() >= 280f);
assertTrue(guarded.reached(snapshot(true, false, 320f, 1)));
try {
guarded.reached(snapshot(false, false, 470f, 2));
fail("An accidental second death must fail the route immediately");
} catch (AssertionError expected) {
assertTrue(expected.getMessage(), expected.getMessage().contains("expected at most 1"));
assertTrue(expected.getMessage(), expected.getMessage().contains("observed 2"));
}
}
private static GameView.AutomationSnapshot snapshot(
boolean alive, boolean onGround, float x, int deaths) {
return new GameView.AutomationSnapshot(
false, alive, false, false, false,
10, 0L, x, 760f, deaths, deaths,
Float.NaN, Float.NaN, false, false, Float.NaN, onGround);
}
private static final class ScriptedDriver implements LevelPlaytestBot.Driver {
private int startedLevel;
private long nowMillis;