aboutsummaryrefslogtreecommitdiff
path: root/internal/game/map_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-09 05:27:10 -0400
committerhistoria <[not public]>2026-07-09 05:27:10 -0400
commitc705ae942573984784ef501bf8198f61f5206ddd (patch)
treec964066f3a244002bf75cb50a877630f46496f81 /internal/game/map_test.go
parent74153c7814fc4cef988066ef04e38731a943bc12 (diff)
downloadthehouseoficarus-c705ae942573984784ef501bf8198f61f5206ddd.tar.gz
refactor: simplify yaml, remove support for old scalar fields
Diffstat (limited to 'internal/game/map_test.go')
-rw-r--r--internal/game/map_test.go48
1 files changed, 24 insertions, 24 deletions
diff --git a/internal/game/map_test.go b/internal/game/map_test.go
index 2975551..d13cbdc 100644
--- a/internal/game/map_test.go
+++ b/internal/game/map_test.go
@@ -46,14 +46,14 @@ func TestMapConnectorGlyphs(t *testing.T) {
}{
{
name: "bidirectional bar",
- room1: "name: One\nexits:\n east: 2\n",
- room2: "name: Two\nexits:\n west: 1\n",
+ room1: "name: One\nexits:\n east: {room: 2}\n",
+ room2: "name: Two\nexits:\n west: {room: 1}\n",
wantPresent: "-",
wantAbsent: []string{"X", "<", ">"},
},
{
name: "one-way east arrow",
- room1: "name: One\nexits:\n east: 2\n",
+ room1: "name: One\nexits:\n east: {room: 2}\n",
room2: "name: Two\n",
wantPresent: ">",
wantAbsent: []string{"X", "-", "<"},
@@ -61,7 +61,7 @@ func TestMapConnectorGlyphs(t *testing.T) {
{
name: "forward blocked, reverse open -> X (shortest path is blocked)",
room1: condEast,
- room2: "name: Two\nexits:\n west: 1\n",
+ room2: "name: Two\nexits:\n west: {room: 1}\n",
flagOpen: false,
wantPresent: "X",
wantAbsent: []string{"-", "<", ">"},
@@ -77,15 +77,15 @@ func TestMapConnectorGlyphs(t *testing.T) {
{
name: "conditional unblocked -> bar",
room1: condEast,
- room2: "name: Two\nexits:\n west: 1\n",
+ room2: "name: Two\nexits:\n west: {room: 1}\n",
flagOpen: true,
wantPresent: "-",
wantAbsent: []string{"X", "<", ">"},
},
{
name: "outward open, inward blocked -> outward arrow (dist rules)",
- room1: "name: One\nexits:\n east: 2\n",
- room2: "name: Two\nexits:\n west: 1\n north: 3\n",
+ room1: "name: One\nexits:\n east: {room: 2}\n",
+ room2: "name: Two\nexits:\n west: {room: 1}\n north: {room: 3}\n",
room3: condSouth,
flagOpen: false,
// dist[room1]=0, dist[room2]=1, dist[room3]=2.
@@ -96,21 +96,21 @@ func TestMapConnectorGlyphs(t *testing.T) {
},
{
name: "bidirectional diagonal NE-SW",
- room1: "name: One\nexits:\n northeast: 2\n",
- room2: "name: Two\nexits:\n southwest: 1\n",
+ room1: "name: One\nexits:\n northeast: {room: 2}\n",
+ room2: "name: Two\nexits:\n southwest: {room: 1}\n",
wantPresent: "/",
wantAbsent: []string{"X", "\\"},
},
{
name: "bidirectional diagonal NW-SE",
- room1: "name: One\nexits:\n northwest: 2\n",
- room2: "name: Two\nexits:\n southeast: 1\n",
+ room1: "name: One\nexits:\n northwest: {room: 2}\n",
+ room2: "name: Two\nexits:\n southeast: {room: 1}\n",
wantPresent: "\\",
wantAbsent: []string{"X", "/"},
},
{
name: "one-way NE arrow",
- room1: "name: One\nexits:\n northeast: 2\n",
+ room1: "name: One\nexits:\n northeast: {room: 2}\n",
room2: "name: Two\n",
wantPresent: "/",
wantAbsent: []string{"X", "\\"},
@@ -134,15 +134,15 @@ func TestMapConnectorGlyphs(t *testing.T) {
{
name: "diagonal conditional unblocked -> bar",
room1: condNE,
- room2: "name: Two\nexits:\n southwest: 1\n",
+ room2: "name: Two\nexits:\n southwest: {room: 1}\n",
flagOpen: true,
wantPresent: "/",
wantAbsent: []string{"X", "\\"},
},
{
name: "criss-crossed diagonal paths show X",
- room1: "name: One\nexits:\n east: 2\n south: 3\n southeast: 4\n",
- room2: "name: Two\nexits:\n southwest: 3\n",
+ room1: "name: One\nexits:\n east: {room: 2}\n south: {room: 3}\n southeast: {room: 4}\n",
+ room2: "name: Two\nexits:\n southwest: {room: 3}\n",
room3: "name: Three\n",
room4: "name: Four\n",
wantPresent: "X",
@@ -187,10 +187,10 @@ func TestMapConnectorGlyphs(t *testing.T) {
// both bar glyphs and arrow glyphs.
func TestMapDiagonalOneWayCrossing(t *testing.T) {
dir := t.TempDir()
- writeTempRoom(t, dir, 1, "name: One\nexits:\n north: 3\n northeast: 2\n")
+ writeTempRoom(t, dir, 1, "name: One\nexits:\n north: {room: 3}\n northeast: {room: 2}\n")
writeTempRoom(t, dir, 2, "name: Two\n")
- writeTempRoom(t, dir, 3, "name: Three\nexits:\n southeast: 4\n")
- writeTempRoom(t, dir, 4, "name: Four\nexits:\n northwest: 3\n")
+ writeTempRoom(t, dir, 3, "name: Three\nexits:\n southeast: {room: 4}\n")
+ writeTempRoom(t, dir, 4, "name: Four\nexits:\n northwest: {room: 3}\n")
g := &Game{Deps: Deps{World: world.New(dir)}}
sess := &net.Session{Player: &player.Player{Options: map[string]any{"unicode": true}}}
@@ -396,10 +396,10 @@ func TestMap3DDisconnectedComponent(t *testing.T) {
// tower2base→up→tower2 (1,0,0). Tower 2 is at the same z=0 as tower 1 but
// unreachable via horizontal exits. The 3D map should still show it.
dir := t.TempDir()
- writeTempRoom(t, dir, 1, "name: Tower One\nexits:\n down: 2\n")
- writeTempRoom(t, dir, 2, "name: Bridge\nexits:\n east: 3\n up: 1\n")
- writeTempRoom(t, dir, 3, "name: Tower Two Base\nexits:\n up: 4\n west: 2\n")
- writeTempRoom(t, dir, 4, "name: Tower Two\nexits:\n down: 3\n")
+ writeTempRoom(t, dir, 1, "name: Tower One\nexits:\n down: {room: 2}\n")
+ writeTempRoom(t, dir, 2, "name: Bridge\nexits:\n east: {room: 3}\n up: {room: 1}\n")
+ writeTempRoom(t, dir, 3, "name: Tower Two Base\nexits:\n up: {room: 4}\n west: {room: 2}\n")
+ writeTempRoom(t, dir, 4, "name: Tower Two\nexits:\n down: {room: 3}\n")
g := &Game{Deps: Deps{World: world.New(dir)}, GlobalFlags: NewGlobalFlagStore()}
mg := mapGlyphsForPlayer(false)
@@ -423,8 +423,8 @@ func TestMap3DDifferentZExcluded(t *testing.T) {
// Room 1 at (0,0,0) with up to room 2 at (0,0,1). Room 2 is at z=1,
// different from the player's z=0 level — should NOT show on the map.
dir := t.TempDir()
- writeTempRoom(t, dir, 1, "name: Ground\nexits:\n up: 2\n")
- writeTempRoom(t, dir, 2, "name: Upper\nexits:\n down: 1\n")
+ writeTempRoom(t, dir, 1, "name: Ground\nexits:\n up: {room: 2}\n")
+ writeTempRoom(t, dir, 2, "name: Upper\nexits:\n down: {room: 1}\n")
g := &Game{Deps: Deps{World: world.New(dir)}, GlobalFlags: NewGlobalFlagStore()}
mg := mapGlyphsForPlayer(false)