From 00fe5f7ead43627fa283035b27365924b76c5a0f Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 29 Sep 2026 16:50:40 -0400 Subject: feat: roulette bets street, corner, split, etc. --- internal/game/roulette_test.go | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'internal/game/roulette_test.go') 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 -- cgit v1.2.3