diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-07-03 21:48:58 -0400 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:22 +0200 |
| commit | 98c95cdae3193741fd97c0662e6d3397076b8bdb (patch) | |
| tree | 820c38444e1360ce7c6bda423ec5657869d64c81 /go/game/map_test.go | |
| parent | e34faef774f7dad55cb7f7a5177215b341e5b539 (diff) | |
| download | muhqs-game-98c95cdae3193741fd97c0662e6d3397076b8bdb.tar.gz muhqs-game-98c95cdae3193741fd97c0662e6d3397076b8bdb.zip | |
support king games
Diffstat (limited to 'go/game/map_test.go')
| -rw-r--r-- | go/game/map_test.go | 30 |
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") + } +} |
