diff options
| author | historia <[not public]> | 2026-09-30 16:16:17 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-30 16:16:17 -0400 |
| commit | a4c09c2d38d1f3bc1d3ad4bdb0234bdea7c37e73 (patch) | |
| tree | 00c9567e620f331a59dd44f1f1fa779ecd94a845 /internal/casino/craps_regression_test.go | |
| parent | 724079f8de1ae69965c6267dca3d7fc3cc86afa2 (diff) | |
| download | thehouseoficarus-a4c09c2d38d1f3bc1d3ad4bdb0234bdea7c37e73.tar.gz | |
feat: additional craps variants added, standardizard casino command hints
Diffstat (limited to 'internal/casino/craps_regression_test.go')
| -rw-r--r-- | internal/casino/craps_regression_test.go | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/internal/casino/craps_regression_test.go b/internal/casino/craps_regression_test.go new file mode 100644 index 0000000..322325c --- /dev/null +++ b/internal/casino/craps_regression_test.go @@ -0,0 +1,51 @@ +package casino + +import ( + "testing" +) + +func TestCrapsLargestStakeAndOddsLimit(t *testing.T) { + tb := crapsFixture() + tb.Config.MaxBet = MaxCredits / 1000 + tb.Config.Craps.Odds = 1000000 + tb.join("a") + w := &testWallet{chips: MaxCredits} + amount := tb.Config.MaxBet + tb.bet("a", "pass", amount, w) + tb.resolveRoll(2, 2) + tb.bet("a", "odds pass", amount, w) + if len(w.open) != 2 { + t.Fatal("valid large odds rejected") + } +} +func TestCrapsHopIsUnordered(t *testing.T) { + tb := crapsFixture() + tb.join("a") + w := &testWallet{chips: 100} + tb.bet("a", "hop 3 2", 10, w) + tb.bet("a", "hop 2 3", 10, w) + if len(w.open) != 1 || w.chips != 90 { + t.Fatal("duplicate unordered hop accepted") + } + tb.action("a", "unbet hop 3 2") + if len(w.open) != 0 || w.paid != 10 || w.chips != 90 { + t.Fatal("reverse-order removal failed") + } +} +func TestCrapsMixedPairPreviewCombinesAllBets(t *testing.T) { + tb := crapsFixture() + tb.join("a") + w := &testWallet{chips: 1000} + tb.point = 8 + tb.bet("a", "hard 8", 10, w) + tb.bet("a", "hop 2 3", 10, w) + tb.bet("a", "field", 10, w) + for _, row := range tb.projectionFor(tb.players.get("a")) { + if row.Rolls == "4+4" && row.Net != 70 { + t.Fatal("hard win minus hop and field losses", row) + } + if row.Rolls == "2+3" && row.Net != 140 { + t.Fatal("hop win minus field loss", row) + } + } +} |
