aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/video_poker_bonus_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-01 04:26:20 -0400
committerhistoria <[not public]>2026-10-01 04:26:20 -0400
commit0ba388bbe229dd1ccfcb0831d21a5542ae0935f1 (patch)
treec5686cf404e3dc5001d2c9b2792749ae7a3c9801 /internal/casino/video_poker_bonus_test.go
parente3ff06fc79682673194c8913f0feb9e90920e7d0 (diff)
downloadthehouseoficarus-0ba388bbe229dd1ccfcb0831d21a5542ae0935f1.tar.gz
feat: video poker machines added to casino
Diffstat (limited to 'internal/casino/video_poker_bonus_test.go')
-rw-r--r--internal/casino/video_poker_bonus_test.go127
1 files changed, 127 insertions, 0 deletions
diff --git a/internal/casino/video_poker_bonus_test.go b/internal/casino/video_poker_bonus_test.go
new file mode 100644
index 0000000..6fd06b2
--- /dev/null
+++ b/internal/casino/video_poker_bonus_test.go
@@ -0,0 +1,127 @@
+package casino
+
+import "testing"
+
+func TestPokerUltimateXPerLineAndMachineBanks(t *testing.T) {
+ table, w, bank := pokerTestCabinet(t, VideoPokerConfig{Cabinet: CabinetUXMulti})
+ save := bank
+ table.action("alice", "hands 3")
+ p := table.players["alice"]
+ key := table.multiplierKey(p)
+ table.banks[key] = []int{2, 3, 4}
+ // A bank at denomination 1 does not carry into denomination 10.
+ table.action("alice", "denom 10")
+ pokerDeal(t, table, w)
+ for _, m := range p.current {
+ if m != 1 {
+ t.Fatal("denomination imported a saved multiplier")
+ }
+ }
+ table.action("alice", "draw")
+ // Restore denomination 1: the saved bank applies again.
+ table.action("alice", "denom 1")
+ pokerDeal(t, table, w)
+ for i, m := range []int{2, 3, 4} {
+ if p.current[i] != m {
+ t.Fatal("same-denomination bank lost")
+ }
+ }
+ p.cards = pokerHand("Ah 3h 6h 9h Jh")
+ table.action("alice", "12345")
+ before := w.paid
+ table.action("alice", "draw")
+ if w.paid-before != 270 {
+ t.Fatalf("expected 5 coins * 6 flush * (2+3+4), got %d", w.paid-before)
+ }
+ for i, line := range p.lines {
+ if line.Multiplier != i+2 || p.next[i] != 11 || table.banks[key][i] != 11 {
+ t.Fatal("current multiplier compounded into the next award")
+ }
+ }
+ if save.writes == 0 {
+ t.Fatal("the engine bank sink was never invoked")
+ }
+ // Feature off: no fee, no new multipliers, saved ones still pay.
+ table.action("alice", "feature off")
+ pokerDeal(t, table, w)
+ if p.wager.Total != 15 {
+ t.Fatal("cashout charged the feature")
+ }
+ p.cards = pokerHand("Ah Kh Qh Jh 10h")
+ table.action("alice", "12345")
+ before = w.paid
+ table.action("alice", "draw")
+ if w.paid-before != 132000 {
+ t.Fatalf("cashout returned %d", w.paid-before)
+ }
+ // A five-coin hand consumes the multipliers it paid with: the new bank
+ // is 1x because the feature is off.
+ for _, m := range table.banks[key] {
+ if m != 1 {
+ t.Fatal("spent bank was not cleared")
+ }
+ }
+ // The next five-coin hand plays at plain rates.
+ pokerDeal(t, table, w)
+ for _, m := range p.current {
+ if m != 1 {
+ t.Fatal("consumed bank applied twice")
+ }
+ }
+ p.cards = pokerHand("Ah Kh Qh Jh 10h")
+ table.action("alice", "12345")
+ before = w.paid
+ table.action("alice", "draw")
+ if w.paid-before != 12000 {
+ t.Fatalf("plain royal returned %d", w.paid-before)
+ }
+}
+func TestPokerRandomFeaturePayoutExcludesFee(t *testing.T) {
+ for _, feature := range []string{PokerSuperTimesPay, PokerHotRoll} {
+ cabinet := CabinetSuperTimesPay
+ if feature == PokerHotRoll {
+ cabinet = CabinetHotRoll
+ }
+ table, w, _ := pokerTestCabinet(t, VideoPokerConfig{Cabinet: cabinet})
+ table.action("alice", "hands 3")
+ table.action("alice", "denom 10")
+ pokerDeal(t, table, w)
+ p := table.players["alice"]
+ p.multiplier = 8 // pin the rolled bonus
+ p.cards = pokerHand("Ah Kh Qh Jh 10h")
+ table.action("alice", "12345")
+ table.action("alice", "draw")
+ if w.paid != 3*4000*8*10 {
+ t.Fatalf("%s multiplied the feature fee into the payout: %d", feature, w.paid)
+ }
+ for _, line := range p.lines {
+ if line.Multiplier != 8 || line.Coins != 32000 {
+ t.Fatal("the bonus was not shared across all lines")
+ }
+ }
+ }
+}
+func TestPokerDisconnectedFailedSettlementRetriesWithoutRedraw(t *testing.T) {
+ table, w, _ := pokerTestCabinet(t, VideoPokerConfig{Cabinet: CabinetClassic})
+ pokerDeal(t, table, w)
+ p := table.players["alice"]
+ w.fail = true
+ table.markDisconnected("alice")
+ if !table.hasParticipant("alice") || !p.drawn || !p.active {
+ t.Fatal("failed disconnected stake was dropped")
+ }
+ final := p.lines[0].Cards
+ table.tick()
+ for i, c := range final {
+ if p.lines[0].Cards[i] != c {
+ t.Fatal("retry redrew cards")
+ }
+ }
+ w.fail = false
+ table.tick()
+ paid := w.paid
+ table.tick()
+ if !table.idle() || len(w.open) != 0 || w.paid != paid {
+ t.Fatal("retry did not settle exactly once")
+ }
+}