diff options
| author | historia <[not public]> | 2026-09-29 16:50:40 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-29 16:50:40 -0400 |
| commit | 00fe5f7ead43627fa283035b27365924b76c5a0f (patch) | |
| tree | 07546518a51aaa037d64813f40eb6dc4596bd9cb /internal/game/roulette_test.go | |
| parent | bfe22e10b5b9f2c7039d1d67021229659a06a226 (diff) | |
| download | thehouseoficarus-00fe5f7ead43627fa283035b27365924b76c5a0f.tar.gz | |
feat: roulette bets street, corner, split, etc.
Diffstat (limited to 'internal/game/roulette_test.go')
| -rw-r--r-- | internal/game/roulette_test.go | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/internal/game/roulette_test.go b/internal/game/roulette_test.go index a963913..7a22d9b 100644 --- a/internal/game/roulette_test.go +++ b/internal/game/roulette_test.go @@ -43,6 +43,58 @@ func TestRouletteNumericTargetsAndRendering(t *testing.T) { } } +func TestRouletteCombinationTargetParsing(t *testing.T) { + for _, double := range []bool{false, true} { + g := &Game{Casino: casino.NewManager(1)} + cfg := casino.TableConfig{ID: "roulette", Game: casino.GameRoulette, Roulette: casino.RouletteConfig{DoubleZero: double}} + g.Casino.Join(1, cfg, "alice") + conn := &casinoTestConn{} + sess := &net.Session{Player: player.New("alice"), Conn: conn} + g.loggedInChars = map[string]*net.Session{"alice": sess} + // Multi-token targets are joined for roulette, with or without "on". + valid := [][]string{ + {"10", "on", "split", "1", "2"}, + {"10", "on", "split", "1-2"}, + {"10", "split", "1-2"}, + {"10", "on", "street", "1", "2", "3"}, + {"10", "on", "street", "3", "1", "2"}, + {"10", "on", "corner", "1", "2", "4", "5"}, + {"10", "on", "corner", "5", "1", "4", "2"}, + {"10", "on", "line", "1", "2", "3", "4", "5", "6"}, + {"10", "on", "trio", "0", "1", "2"}, + {"10", "on", "basket"}, + } + if double { + valid = append(valid, []string{"10", "on", "split", "0", "00"}) + } + for _, args := range valid { + conn.data = nil + g.executeBet(sess, args, "bet "+strings.Join(args, " ")) + if !strings.Contains(string(conn.data), "You don't have enough chips and credits") { + t.Fatalf("double=%v args=%v: expected wallet failure, got %q", double, args, conn.data) + } + } + // Non-adjacent or wrong-shaped combinations must not reach the wallet. + invalid := [][]string{ + {"10", "on", "split", "1", "5"}, + {"10", "on", "street", "2", "3", "4"}, + {"10", "on", "corner", "1", "2", "3", "4"}, + {"10", "on", "line", "1", "2", "3", "4", "5", "7"}, + {"10", "on", "trio", "0", "1", "5"}, + } + if !double { + invalid = append(invalid, []string{"10", "on", "split", "0", "00"}) + } + for _, args := range invalid { + conn.data = nil + g.executeBet(sess, args, "bet "+strings.Join(args, " ")) + if !strings.Contains(string(conn.data), "Unknown roulette target") { + t.Fatalf("double=%v args=%v: expected target rejection, got %q", double, args, conn.data) + } + } + } +} + func TestCasinoTestPortalAuthoredContract(t *testing.T) { g, rooms, _ := loadVesta(t) found := false |
