diff options
| author | historia <[not public]> | 2026-07-31 17:44:10 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-31 17:44:10 -0400 |
| commit | f51424c90dbce7191a31b6e675818c985f0f4539 (patch) | |
| tree | a7845a2e09bd6e83d2d034f5e702a4940f38126a /internal/game/casino_test.go | |
| parent | 58758d41488a777d2bc0e787be655363bdd9eb60 (diff) | |
| download | thehouseoficarus-f51424c90dbce7191a31b6e675818c985f0f4539.tar.gz | |
feat: casino framework and basic slot machine
Diffstat (limited to 'internal/game/casino_test.go')
| -rw-r--r-- | internal/game/casino_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/game/casino_test.go b/internal/game/casino_test.go new file mode 100644 index 0000000..b2b37c4 --- /dev/null +++ b/internal/game/casino_test.go @@ -0,0 +1,29 @@ +package game + +import ( + "strings" + "testing" + + "thehouseoficarus/internal/casino" + "thehouseoficarus/internal/color" +) + +func TestRenderSlotSnapshotColorsWordSymbols(t *testing.T) { + snapshot := &casino.SlotSnapshot{StoppedReels: 1} + snapshot.Grid[0][0] = "scatter" + if !strings.Contains(renderSlotSnapshot(snapshot, "none", false), "scatter") { + t.Fatal("expected word-based slot symbols") + } + output := renderSlotSnapshot(snapshot, "xterm256", true) + if !strings.Contains(output, "\033[38;5;") { + t.Fatalf("expected colored slot symbols, got %q", output) + } + for _, line := range strings.Split(output, "\n") { + if color.VisibleLen(line) != 51 { + t.Fatalf("line visible width = %d, want 51: %q", color.VisibleLen(line), line) + } + } + if !strings.Contains(output, "┌") || !strings.Contains(output, "└") { + t.Fatalf("slot output lacks the Unicode frame: %q", output) + } +} |
