diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-09-08 15:38:07 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-09-08 15:41:45 +0200 |
| commit | a3ca136cd776ff0089dc33e401d1fc474dc17138 (patch) | |
| tree | 1968a8ff318c7f021e2cc94df5a057eeee39b099 /go/game/winCondition_test.go | |
| parent | ee605fa7fa48803756b0c3216afc4bd692ec144a (diff) | |
| download | muhqs-game-a3ca136cd776ff0089dc33e401d1fc474dc17138.tar.gz muhqs-game-a3ca136cd776ff0089dc33e401d1fc474dc17138.zip | |
support explicitly winning and implement Approach Supremacy!
Diffstat (limited to 'go/game/winCondition_test.go')
| -rw-r--r-- | go/game/winCondition_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/go/game/winCondition_test.go b/go/game/winCondition_test.go index 0f380e92..8ed06dff 100644 --- a/go/game/winCondition_test.go +++ b/go/game/winCondition_test.go @@ -80,3 +80,42 @@ func TestKrakenGame(t *testing.T) { t.Fatal("p is not the winner", w) } } + +func TestExplicitWinning(t *testing.T) { + s, _, p, o := newMockState() + s.addNewUnit(NewCard("misc/king"), Position{0, 0}, p) + s.addNewUnit(NewCard("misc/king"), Position{1, 1}, o) + + p.win() + s._map.WinCondition = KingGame + w := s._map.WinCondition.check(s) + if len(w) != 1 { + t.Fatal("winner not declared", w) + } + if w[0] != p { + t.Fatal("p is not the winner", w) + } + + s._map.WinCondition = DeathMatch + w = s._map.WinCondition.check(s) + if len(w) != 1 { + t.Fatal("winner not declared", w) + } + if w[0] != p { + t.Fatal("p is not the winner", w) + } + + s, _, p, o = newMockState() + o.Name = KRAKEN_NAME + s.addNewUnit(NewCard("kraken/the_kraken"), Position{1, 1}, o) + p.win() + + s._map.WinCondition = BossGame(KRAKEN_NAME) + w = s._map.WinCondition.check(s) + if len(w) != 1 { + t.Fatal("winner not declared", w) + } + if w[0] != p { + t.Fatal("p is not the winner", w) + } +} |
