diff options
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") + } +} |
