blob: b27a7f9d8160bf9e187e199589d00964e965a5d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package hacking
import "testing"
// A teleport into a terminal hazard (rogue AI or data trap) must end the
// hacking session: the chained room check's terminal result is propagated
// instead of discarded.
func TestICETeleportTerminalResultIsPropagated(t *testing.T) {
for i := 0; i < 2000; i++ {
w := &WumpusGame{player: 0, wumpus: 19, pits: [2]int{2, 3}, ice: [2]int{1, 4}, probes: 5}
text, done, won := w.HandleInput("move 2")
if w.gameOver {
if !done || won != w.won {
t.Fatalf("terminal state not propagated: done=%v won=%v internal gameOver=%v; output=%s", done, won, w.gameOver, text)
}
return
}
}
t.Fatal("probe never encountered a terminal teleport")
}
|