aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/correct_casino_room_validate_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 05:31:09 -0400
committerhistoria <[not public]>2026-09-18 05:31:09 -0400
commit153acb7f644d755c45533b7c5311e3ffa47e8973 (patch)
tree7645e6f7b65bc3830b078e3b9336d2e6b199d584 /internal/casino/correct_casino_room_validate_test.go
parent87d08f0151e643951769e323995f1c5ed89ee200 (diff)
downloadthehouseoficarus-153acb7f644d755c45533b7c5311e3ffa47e8973.tar.gz
fix: harden engine across casino, economy, concurrency, security, and content
Diffstat (limited to 'internal/casino/correct_casino_room_validate_test.go')
-rw-r--r--internal/casino/correct_casino_room_validate_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/internal/casino/correct_casino_room_validate_test.go b/internal/casino/correct_casino_room_validate_test.go
new file mode 100644
index 0000000..319a6b6
--- /dev/null
+++ b/internal/casino/correct_casino_room_validate_test.go
@@ -0,0 +1,36 @@
+package casino
+
+import "testing"
+
+// Removing the shoe-coverage configuration floor must not disturb legitimate
+// rooms: a room whose geometry validated before still validates, and one the
+// over-strict floor previously rejected (but that plays fine) now validates
+// too — so the room is neither darkened nor blocked from the admin editor.
+
+func TestRoomWithShippedGeometryStillValidates(t *testing.T) {
+ // The shipped intro room (data/rooms/intro/2001.yaml): blackjack,
+ // baccarat, and a slots machine in one room.
+ tables := []TableConfig{
+ {ID: "blackjack", Game: GameBlackjack, MaxPlayers: 6, BettingTicks: 20,
+ MinBet: 1, MaxBet: 1000,
+ Blackjack: BlackjackConfig{Decks: 8, ShuffleAt: 0.25, BlackjackPayout: 1.5}},
+ {ID: "baccarat", Game: GameBaccarat, MaxPlayers: 6, BettingTicks: 20,
+ MinBet: 1, MaxBet: 1000,
+ Baccarat: BaccaratConfig{Decks: 8, ShuffleAt: 0.25}},
+ }
+ machines := []MachineConfig{{
+ ID: "huff_puff_01", Game: GameSlots, Variant: "huff_and_even_more_puff",
+ MinBet: 1, MaxBet: 1000, Payout: 0.97,
+ }}
+ if err := ValidateRoomConfigs(tables, machines); err != nil {
+ t.Fatalf("the shipped casino room geometry no longer validates: %v", err)
+ }
+
+ // A six-deck eight-player blackjack table that the old 11*(1+P*S) floor
+ // rejected (needs 363 cards, holds 312) now validates.
+ small := []TableConfig{{ID: "blackjack", Game: GameBlackjack, MaxPlayers: 8,
+ Blackjack: BlackjackConfig{Decks: 6}}}
+ if err := ValidateRoomConfigs(small, nil); err != nil {
+ t.Fatalf("a previously-rejected but playable room still fails validation: %v", err)
+ }
+}