From 61fb8e950e0b30ef0ee65aa5882545e5292d9112 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 29 Sep 2026 14:35:57 -0400 Subject: fix: roulette table box drawing characters --- internal/game/render_roulette_test.go | 57 ++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 5 deletions(-) (limited to 'internal/game/render_roulette_test.go') diff --git a/internal/game/render_roulette_test.go b/internal/game/render_roulette_test.go index 1dde5ad..c1065e5 100644 --- a/internal/game/render_roulette_test.go +++ b/internal/game/render_roulette_test.go @@ -74,7 +74,7 @@ func TestRouletteArtModes(t *testing.T) { } else if !strings.Contains(string([]rune(rows[4])[:7]), "0") { t.Fatal("zero not left of grid", layout) } - for _, target := range []string{"column1", "column2", "column3", "dozen1", "dozen2", "dozen3", "red", "black", "odd", "even", "low", "high"} { + for _, target := range []string{"1to12", "13to24", "25to36", "row1", "row2", "row3", "red", "black", "odd", "even", "low", "high"} { if !strings.Contains(layout, target) { t.Fatal("missing bet", target) } @@ -86,10 +86,9 @@ func TestRouletteArtModes(t *testing.T) { } } if mode != "none" { - wantGreen := 1 - if double { - wantGreen = 2 - } + // The whole 0/00 lane is green: blank cells above and below + // the zeros fill the rectangle. + wantGreen := 3 if got := strings.Count(layoutArt, color.BgCode(mode, 2)); got != wantGreen { t.Fatalf("green cells on board = %d, want %d", got, wantGreen) } @@ -135,6 +134,54 @@ func TestRouletteArtModes(t *testing.T) { } } +// TestRouletteLayoutConnections guards the box-drawing joints: the dozen-row +// boxes must connect to the numbered grid above and be closed under, the +// row-bet cells must be boxed on the right, and the bottom rule must tee under +// each outside-bet divider. +func TestRouletteLayoutConnections(t *testing.T) { + for _, double := range []bool{false, true} { + art := plainRoulette(renderRouletteLayout(double, "xterm256", true)) + rows := strings.Split(art, "\n") + // rows[7] is the numbered grid's bottom edge, directly above the dozen + // labels. The dozen boundaries and the grid/row-lane joint cross; the + // row-bet lane closes with a bottom-right corner. + gridBottom := []rune(rows[7]) + for _, col := range []int{6, 26, 46, 66} { + if gridBottom[col] != '┼' { + t.Fatalf("double=%v: grid bottom col %d = %q, want ┼:\n%s", double, col, gridBottom[col], art) + } + } + if gridBottom[73] != '┘' { + t.Fatalf("double=%v: grid bottom row-lane corner = %q, want ┘:\n%s", double, gridBottom[73], art) + } + // The row-bet lane is boxed: its separators cross at the grid edge and + // close on the right. + for _, idx := range []int{3, 5} { + sep := []rune(rows[idx]) + if sep[66] != '┼' || sep[73] != '┤' { + t.Fatalf("double=%v: row lane separator %q lacks box joints:\n%s", double, rows[idx], art) + } + } + // rows[9] is the dozen boxes' bottom edge: tees point down where the + // even-money dividers sit and crosses pass the dozen dividers through. + dozenBottom := []rune(rows[9]) + wantDozen := map[int]rune{6: '├', 16: '┬', 26: '┼', 36: '┬', 46: '┼', 56: '┬', 66: '┤'} + for col, want := range wantDozen { + if dozenBottom[col] != want { + t.Fatalf("double=%v: dozen bottom col %d = %q, want %q:\n%s", double, col, dozenBottom[col], want, art) + } + } + // The last line is the table's bottom rule; it tees upward under each + // outside-bet divider. + bottom := []rune(rows[len(rows)-1]) + for _, col := range []int{16, 26, 36, 46, 56} { + if bottom[col] != '┴' { + t.Fatalf("double=%v: table bottom col %d = %q, want ┴:\n%s", double, col, bottom[col], art) + } + } + } +} + func TestRouletteResultSizesAndNeighbors(t *testing.T) { for _, unicode := range []bool{false, true} { for _, size := range []int{1, 5, 7, 9} { -- cgit v1.2.3