aboutsummaryrefslogtreecommitdiff
path: root/internal/game/render_casino_help_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-02 02:16:44 -0400
committerhistoria <[not public]>2026-10-02 02:16:44 -0400
commit62017c86392b046d746fb4fafef6742840477c5f (patch)
treeeab569e29e858ff79b8ce06caa9bacb28bc9ee81 /internal/game/render_casino_help_test.go
parentd3a305d1d7962f82af2397760cf8008758bddd1d (diff)
downloadthehouseoficarus-62017c86392b046d746fb4fafef6742840477c5f.tar.gz
feat: polish 'list' output, drop sitout command
Diffstat (limited to 'internal/game/render_casino_help_test.go')
-rw-r--r--internal/game/render_casino_help_test.go62
1 files changed, 0 insertions, 62 deletions
diff --git a/internal/game/render_casino_help_test.go b/internal/game/render_casino_help_test.go
index 830186c..2b23119 100644
--- a/internal/game/render_casino_help_test.go
+++ b/internal/game/render_casino_help_test.go
@@ -5,72 +5,10 @@ import (
"testing"
"thehouseoficarus/internal/casino"
- "thehouseoficarus/internal/color"
"thehouseoficarus/internal/net"
"thehouseoficarus/internal/player"
)
-func TestRoulettePayoutTables(t *testing.T) {
- for _, mode := range []string{"none", "ansi", "xterm256"} {
- for _, unicode := range []bool{false, true} {
- for _, double := range []bool{false, true} {
- for _, width := range []int{60, 78} {
- g := &Game{}
- p := player.New("alice")
- p.Options = map[string]any{"color": mode, "unicode": unicode, "wrap_width": width}
- sess := &net.Session{Player: p}
- cfg := casino.TableConfig{Game: casino.GameRoulette, Roulette: casino.RouletteConfig{DoubleZero: double, Racetrack: !double}}
- art := g.rouletteReminder(sess, cfg)
- plain := stripANSI(art)
- for _, want := range []string{"Roulette payouts", "Target / example", "Chance", "Profit", "35:1", "17:1", "11:1", "8:1", "5:1", "2:1", "1:1", "help roulette"} {
- if !strings.Contains(plain, want) {
- t.Fatalf("missing %q:\n%s", want, plain)
- }
- }
- if double {
- for _, want := range []string{"1/38", "5/38", "6:1", "0, 00"} {
- if !strings.Contains(plain, want) {
- t.Fatalf("missing %q", want)
- }
- }
- if strings.Contains(plain, "Racetrack payouts") {
- t.Fatal("American wheel has call bets")
- }
- } else {
- for _, want := range []string{"1/37", "2/37", "3/37", "4/37", "6/37", "12/37", "9/37", "14/37", "Racetrack payouts", "5:3", "13:5", "31:5", "7:2", "zero / jeu zero"} {
- if !strings.Contains(plain, want) {
- t.Fatalf("missing %q:\n%s", want, plain)
- }
- }
- }
- if (mode == "none") == strings.Contains(art, "\x1b[") {
- t.Fatalf("wrong color mode %s", mode)
- }
- tableWidth := 0
- for _, line := range strings.Split(art, "\n") {
- plainLine := stripANSI(line)
- if plainLine != "" && strings.ContainsRune("╔╟╚+", []rune(plainLine)[0]) {
- tableWidth = color.VisibleLen(line)
- }
- if plainLine != "" && strings.ContainsRune("╔║╟╚+|", []rune(plainLine)[0]) {
- if got := color.VisibleLen(line); got != tableWidth || got > width {
- t.Errorf("uneven table width %d (want %d, max %d): %q", got, tableWidth, width, plainLine)
- }
- }
- if !unicode {
- for _, r := range plainLine {
- if r > 127 {
- t.Errorf("non-ASCII %q", r)
- }
- }
- }
- }
- }
- }
- }
- }
-}
-
func TestCasinoHelpTopics(t *testing.T) {
g := &Game{Deps: Deps{DataDir: "../../data"}}
conn := &casinoTestConn{}