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") if len(w.open) != 0 || w.paid != 0 || w.chips != 100 { 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) } } }