aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/craps_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/craps_test.go')
-rw-r--r--internal/casino/craps_test.go26
1 files changed, 21 insertions, 5 deletions
diff --git a/internal/casino/craps_test.go b/internal/casino/craps_test.go
index 3d92e5e..7f3bcfa 100644
--- a/internal/casino/craps_test.go
+++ b/internal/casino/craps_test.go
@@ -5,7 +5,6 @@ import (
"math/rand"
"strings"
"testing"
- "time"
)
func crapsFixture() *crapsTable {
@@ -227,6 +226,23 @@ func TestCrapsATSAndSevenReset(t *testing.T) {
t.Fatal("late bonus allowed")
}
}
+
+// TestCrapsATSSeenTracksWithoutBonusBet: the Small/Tall tracker records every
+// roll even when nobody holds an All/Small/Tall wager, so the display always
+// shows progress and entices a bet.
+func TestCrapsATSSeenTracksWithoutBonusBet(t *testing.T) {
+ tb := crapsFixture()
+ tb.join("a")
+ w := &testWallet{chips: 100}
+ tb.bet("a", "pass", 10, w)
+ tb.resolveRoll(2, 3) // point 5
+ tb.resolveRoll(3, 3) // 6
+ tb.resolveRoll(4, 4) // 8
+ snap := tb.board("a").(*CrapsSnapshot)
+ if len(snap.Seen) != 3 {
+ t.Fatalf("ATS tracker did not track without a bonus bet: %v", snap.Seen)
+ }
+}
func TestCrapsTimersControlsAndRefunds(t *testing.T) {
tb := crapsFixture()
tb.join("a")
@@ -237,7 +253,7 @@ func TestCrapsTimersControlsAndRefunds(t *testing.T) {
if tb.dice != [2]int{} {
t.Fatal("early roll")
}
- tb.tickElapsed(10 * time.Second)
+ tb.advance(10)
if tb.phase != phasePlaying {
t.Fatal(tb.phase)
}
@@ -253,7 +269,7 @@ func TestCrapsTimersControlsAndRefunds(t *testing.T) {
if tb.dice != [2]int{} {
t.Fatal("roll resolved before the shake")
}
- tb.tickElapsed(3 * time.Second)
+ tb.advance(3)
if tb.dice == [2]int{} {
t.Fatal("no roll")
}
@@ -261,12 +277,12 @@ func TestCrapsTimersControlsAndRefunds(t *testing.T) {
tb.join("a")
w = &testWallet{chips: 100}
tb.bet("a", "pass", 10, w)
- tb.tickElapsed(120 * time.Second)
+ tb.advance(120)
if tb.dice != [2]int{} {
t.Fatal("solo players must never be forced to roll")
}
tb.action("a", "roll")
- tb.tickElapsed(3 * time.Second)
+ tb.advance(3)
if tb.dice == [2]int{} {
t.Fatal("solo manual roll stalled")
}