aboutsummaryrefslogtreecommitdiff
path: root/go/game/map_test.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-07-03 21:48:58 -0400
committerFlorian Fischer <florian.fischer@muhq.space>2025-07-06 11:49:19 -0400
commitd4e6d843dc71b68a34f1aa2eed84e5fe20af3589 (patch)
treeee25b7ef22ee4408325642c65d26784646f5ff37 /go/game/map_test.go
parentfa5c66a13d7c182f44c9fa52c216e4d0f455ea29 (diff)
downloadmuhqs-game-d4e6d843dc71b68a34f1aa2eed84e5fe20af3589.tar.gz
muhqs-game-d4e6d843dc71b68a34f1aa2eed84e5fe20af3589.zip
support king games
Diffstat (limited to 'go/game/map_test.go')
-rw-r--r--go/game/map_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/go/game/map_test.go b/go/game/map_test.go
index 6972f867..e950747b 100644
--- a/go/game/map_test.go
+++ b/go/game/map_test.go
@@ -1,6 +1,7 @@
package game
import (
+ "reflect"
"strings"
"testing"
)
@@ -71,6 +72,10 @@ kings:
if m.ResourceGain != DEFAULT_RESOURCE_GAIN {
t.Fatalf("resource gain is not the default one")
}
+
+ if reflect.ValueOf(m.WinCondition).Pointer() != reflect.ValueOf(KingGame).Pointer() {
+ t.Fatalf("win conditions is not KingGame")
+ }
}
func TestLoadingAllMaps(t *testing.T) {
@@ -83,3 +88,28 @@ func TestLoadingAllMaps(t *testing.T) {
}
}
}
+
+func TestTileAt(t *testing.T) {
+ mapDef := `map: |1-
+ HS
+ HS
+
+symbols:
+ H: house
+ S: street
+`
+
+ m := parseMapString(t, mapDef)
+ if m.TileAt(INVALID_POSITION()) != nil {
+ t.Fatal("INVALID_POSITION returned valid rile")
+ }
+ if m.TileAt(Position{3, 0}) != nil {
+ t.Fatal("INVALID_POSITION returned valid rile")
+ }
+ if m.TileAt(Position{0, 3}) != nil {
+ t.Fatal("INVALID_POSITION returned valid rile")
+ }
+ if m.TileAt(Position{0, 0}).Type != TileTypes.House {
+ t.Fatal("Tile at (0,0) is not a house")
+ }
+}