aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/correct_casino_room_validate_test.go
diff options
context:
space:
mode:
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)
+ }
+}