From a4c09c2d38d1f3bc1d3ad4bdb0234bdea7c37e73 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 30 Sep 2026 16:16:17 -0400 Subject: feat: additional craps variants added, standardizard casino command hints --- internal/casino/craps_regression_test.go | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 internal/casino/craps_regression_test.go (limited to 'internal/casino/craps_regression_test.go') 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) + } + } +} -- cgit v1.2.3