aboutsummaryrefslogtreecommitdiff
path: root/internal/game/video_poker_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-01 04:26:20 -0400
committerhistoria <[not public]>2026-10-01 04:26:20 -0400
commit0ba388bbe229dd1ccfcb0831d21a5542ae0935f1 (patch)
treec5686cf404e3dc5001d2c9b2792749ae7a3c9801 /internal/game/video_poker_test.go
parente3ff06fc79682673194c8913f0feb9e90920e7d0 (diff)
downloadthehouseoficarus-0ba388bbe229dd1ccfcb0831d21a5542ae0935f1.tar.gz
feat: video poker machines added to casino
Diffstat (limited to 'internal/game/video_poker_test.go')
-rw-r--r--internal/game/video_poker_test.go79
1 files changed, 79 insertions, 0 deletions
diff --git a/internal/game/video_poker_test.go b/internal/game/video_poker_test.go
new file mode 100644
index 0000000..f2ea43f
--- /dev/null
+++ b/internal/game/video_poker_test.go
@@ -0,0 +1,79 @@
+package game
+
+import (
+ "strings"
+ "testing"
+
+ "thehouseoficarus/internal/casino"
+)
+
+func TestVideoPokerCommandsAndLook(t *testing.T) {
+ g, sess, conn := casinoCrapsGame(t, "name: Poker\ncasino_tables:\n - id: vp\n game: video_poker\n")
+ g.executePlay(sess, []string{"vp"}, "play vp")
+ conn.data = nil
+ g.executeRules(sess, nil, "rules")
+ if text := stripANSI(string(conn.data)); !strings.Contains(text, "Jacks or Better") {
+ t.Fatal(text)
+ }
+ g.executeBet(sess, []string{"max"}, "bet max")
+ g.executeTableAction(sess, "deal")
+ if classifyCommand("531") != ClassInstant {
+ t.Fatal("numeric holds rejected by dispatch")
+ }
+ g.executeCommand(sess, "531", nil, "531")
+ table, _ := g.Casino.Participation(sess.Player.Name)
+ snap := table.Status(sess.Player.Name)[0].Snapshot.(*casino.VideoPokerSnapshot)
+ if snap.Held != ([5]bool{true, false, true, false, true}) {
+ t.Fatalf("numeric holds: %+v", snap.Held)
+ }
+ conn.data = nil
+ room, _ := g.World.LoadRoom(1)
+ g.showCasinoGameLook(sess, sess.Player, room)
+ text := stripANSI(string(conn.data))
+ for _, want := range []string{"1 HELD", "3 HELD", "5 HELD", "draw"} {
+ if !strings.Contains(text, want) {
+ t.Fatalf("look missing %q: %s", want, text)
+ }
+ }
+ after := table.Status(sess.Player.Name)[0].Snapshot.(*casino.VideoPokerSnapshot)
+ if after.Held != snap.Held {
+ t.Fatal("look altered holds")
+ }
+ conn.data = nil
+ g.executeList(sess, nil, "list")
+ if text := stripANSI(string(conn.data)); !strings.Contains(text, "No wagers are available") || strings.Contains(text, "COINS PER HAND") {
+ t.Fatal(text)
+ }
+ g.executeCommand(sess, "1", []string{"3", "5"}, "1 3 5")
+ if got := table.Status(sess.Player.Name)[0].Snapshot.(*casino.VideoPokerSnapshot).Held; got != ([5]bool{}) {
+ t.Fatalf("holds did not toggle off: %v", got)
+ }
+ g.executeCommand(sess, "d", nil, "d")
+ if table.Status(sess.Player.Name)[0].Snapshot.(*casino.VideoPokerSnapshot).Drawing || len(sess.Player.PendingWagers) != 0 {
+ t.Fatal("d did not draw")
+ }
+ g.executeCommand(sess, "game", []string{"deuces", "wild"}, "game deuces wild")
+ conn.data = nil
+ g.executeTableStatus(sess, []string{"rules"}, "table rules")
+ if text := stripANSI(string(conn.data)); !strings.Contains(text, "Deuces Wild / 25/15/9/5/3/2") || !strings.Contains(text, "4000") || !strings.Contains(text, "COINS PER HAND") {
+ t.Fatal(text)
+ }
+}
+func TestBlackjackListUsesRealActionCommands(t *testing.T) {
+ g, sess, conn := casinoCrapsGame(t, "name: BJ\ncasino_tables:\n - id: bj\n game: blackjack\n")
+ g.executePlay(sess, []string{"bj"}, "play bj")
+ // Deal until a hand has available action rows (a natural can settle immediately).
+ table, _ := g.Casino.Participation(sess.Player.Name)
+ for i := 0; i < 10 && len(table.Wagers(sess.Player.Name)) == 0; i++ {
+ g.executeBet(sess, []string{"1"}, "bet 1")
+ }
+ if len(table.Wagers(sess.Player.Name)) == 0 {
+ t.Fatal("no action rows")
+ }
+ conn.data = nil
+ g.executeList(sess, nil, "list")
+ text := stripANSI(string(conn.data))
+ if strings.Contains(text, "bet <amount> on") || !strings.Contains(text, "Available actions") {
+ t.Fatal(text)
+ }
+}