aboutsummaryrefslogtreecommitdiff
path: root/internal/game/map_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-22 04:24:11 -0400
committerhistoria <[not public]>2026-06-22 04:24:11 -0400
commit5b9a75a1520a198c9c6b1f1f55e05c9f4aab5629 (patch)
tree18f500ca3492ba206a3f66e2f01146b05a1675b2 /internal/game/map_test.go
parent7f07c7236578e1a7bcef0282ff9d7f5bf8c7c045 (diff)
downloadthehouseoficarus-5b9a75a1520a198c9c6b1f1f55e05c9f4aab5629.tar.gz
feat: map now only reveals with exploration. players can set custom map symbols.
Diffstat (limited to 'internal/game/map_test.go')
-rw-r--r--internal/game/map_test.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/game/map_test.go b/internal/game/map_test.go
index a695c1b..b7d9f01 100644
--- a/internal/game/map_test.go
+++ b/internal/game/map_test.go
@@ -4,6 +4,7 @@ import (
"strings"
"testing"
+ "thehouseoficarus/internal/color"
"thehouseoficarus/internal/world"
)
@@ -51,7 +52,7 @@ func TestBuildTinyMap(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- lines := buildTinyMap(g, tt.roomID, mg)
+ lines := buildTinyMap(g, nil, tt.roomID, mg)
if len(lines) != 7 {
t.Fatalf("expected 7 lines, got %d", len(lines))
}
@@ -65,8 +66,8 @@ func TestBuildTinyMap(t *testing.T) {
if !strings.HasPrefix(lines[i], "║") || !strings.HasSuffix(lines[i], "║") {
t.Errorf("line %d: should have ║ borders, got %s", i, lines[i])
}
- if len([]rune(lines[i])) != 7 {
- t.Errorf("line %d: expected 7 runes, got %d in %q", i, len([]rune(lines[i])), lines[i])
+ if color.VisibleLen(lines[i]) != 7 {
+ t.Errorf("line %d: expected 7 visible runes, got %d in %q", i, color.VisibleLen(lines[i]), lines[i])
}
}
t.Logf("Room %d map:\n%s", tt.roomID, strings.Join(lines, "\n"))
@@ -115,13 +116,13 @@ func TestBuildFullMap(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- lines := buildFullMap(g, tt.roomID, tt.width, tt.height, mg)
+ lines := buildFullMap(g, nil, tt.roomID, tt.width, tt.height, mg)
if len(lines) != tt.height {
t.Errorf("expected %d lines, got %d", tt.height, len(lines))
}
for i, line := range lines {
- if len([]rune(line)) != tt.width {
- t.Errorf("line %d: expected %d runes, got %d in %q", i, tt.width, len([]rune(line)), line)
+ if color.VisibleLen(line) != tt.width {
+ t.Errorf("line %d: expected %d visible runes, got %d in %q", i, tt.width, color.VisibleLen(line), line)
}
}
t.Logf("Room %d %dx%d map:\n%s", tt.roomID, tt.width, tt.height, strings.Join(lines, "\n"))