From d4e6d843dc71b68a34f1aa2eed84e5fe20af3589 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 3 Jul 2025 21:48:58 -0400 Subject: support king games --- go/game/map_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'go/game/map_test.go') 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") + } +} -- cgit v1.2.3