1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package game
import (
"fmt"
"strings"
"testing"
"thehouseoficarus/internal/casino"
)
func TestPokerMultiHandCardRowsAlignWithLabels(t *testing.T) {
cards := []casino.CardView{{Rank: "A", Suit: "hearts"}, {Rank: "K", Suit: "spades"}, {Rank: "Q", Suit: "diamonds"}, {Rank: "J", Suit: "clubs"}, {Rank: "10", Suit: "hearts"}}
for _, size := range []int{1, 3, 5} {
t.Run(fmt.Sprint(size), func(t *testing.T) {
hand := casino.PokerLine{Cards: cards, Category: "Straight", Coins: 20, Multiplier: 1}
snap := &casino.VideoPokerSnapshot{Config: (casino.VideoPokerConfig{Cabinet: casino.CabinetClassic}).Normalize(), Hands: 3, Lines: []casino.PokerLine{hand, hand, hand}}
out := renderVideoPoker(snap, "none", true, size, "", nil)
art := renderPokerCards(cards, nil, "none", true, min(5, cardRenderSize(true, size)), "", nil)
for n := 1; n <= 3; n++ {
rows := append([]string(nil), art...)
for i := range rows {
prefix := " "
if i == 0 {
prefix = fmt.Sprintf("%3d: ", n)
}
rows[i] = prefix + rows[i]
}
want := strings.Join(rows, "\n") + "\n Straight"
if !strings.Contains(out, want) {
t.Fatalf("hand %d is misaligned:\n%s", n, out)
}
}
})
}
}
|