aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/hardening_casino_locking_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-01 19:30:38 -0400
committerhistoria <[not public]>2026-10-01 19:30:38 -0400
commit6d9908b29c8187196d23b126b1165c7e0bd0fc76 (patch)
treeddbc02357ed92646b801687b90b1a06c71a15d71 /internal/casino/hardening_casino_locking_test.go
parent8a94f21bd47c0a00bc415395232dba22fa958837 (diff)
downloadthehouseoficarus-6d9908b29c8187196d23b126b1165c7e0bd0fc76.tar.gz
fix: casino pai gow sorting, universal unbet, table/rules split, remove solo timers
Diffstat (limited to 'internal/casino/hardening_casino_locking_test.go')
-rw-r--r--internal/casino/hardening_casino_locking_test.go31
1 files changed, 13 insertions, 18 deletions
diff --git a/internal/casino/hardening_casino_locking_test.go b/internal/casino/hardening_casino_locking_test.go
index 080d941..f48b6c2 100644
--- a/internal/casino/hardening_casino_locking_test.go
+++ b/internal/casino/hardening_casino_locking_test.go
@@ -42,12 +42,12 @@ func assertRebetWaitsForLock(t *testing.T, name string, mu *sync.Mutex, rebet fu
}
}
-// A lone connected player is deliberately never timed out by the action
-// window. The absolute turn ceiling must therefore end that turn, or a
-// hung-but-connected client holds the hand, the seat, and the stake forever
-// (leave refuses mid-round).
+// A lone player at the table is deliberately never timed out: neither the
+// action window nor the turn ceiling advances, so the hand waits for the
+// player's own decision. (Multiplayer turns are still bounded; see
+// TestBlackjackWarnsOnceThenAutoStands.)
-func TestLoneBettorTurnCeilingSettlesTheHand(t *testing.T) {
+func TestLoneBettorHasNoTurnTimer(t *testing.T) {
table := newBlackjackTable(1, TableConfig{ID: "blackjack", Game: GameBlackjack,
Blackjack: BlackjackConfig{ActionTicks: 2}}, newTestRand())
table.shoe = tableauShoe(
@@ -61,24 +61,19 @@ func TestLoneBettorTurnCeilingSettlesTheHand(t *testing.T) {
t.Fatalf("setup: expected a dealt hand (phase=%s)", table.phase)
}
- // The action timer alone would have expired after two ticks, but the
- // lone bettor gets the full grace period: 10x the action window.
+ // Far past both the action window and the old turn ceiling, the hand must
+ // still be waiting: neither deadline runs for a lone player.
ceiling := table.Rules.ActionTicks * loneTurnGrace
- for i := 0; i < ceiling-1; i++ {
+ for i := 0; i < ceiling+5; i++ {
table.tick()
}
if table.phase != blackjackPlaying {
- t.Fatalf("lone bettor's hand ended before the turn ceiling (phase=%s, ceiling=%d)", table.phase, ceiling)
+ t.Fatalf("lone player's hand was settled by a timer (phase=%s)", table.phase)
}
-
- events := table.tick()
- if table.phase != blackjackWaiting {
- t.Fatalf("turn ceiling did not settle the hand: phase=%s events=%+v", table.phase, events)
- }
- if !hasMessage(events, "idle too long") {
- t.Fatalf("missing turn-ceiling message: %+v", events)
+ if table.ceiling.clock != 0 || table.timer.clock != 0 {
+ t.Fatalf("a lone player's timer advanced: ceiling=%d timer=%d", table.ceiling.clock, table.timer.clock)
}
- if len(wallet.open) != 0 {
- t.Fatalf("stake still committed after the ceiling stood the hand: %+v", wallet.open)
+ if len(wallet.open) != 1 {
+ t.Fatalf("stake resolved without player action: %+v", wallet.open)
}
}