diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-29 18:43:09 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-29 18:43:09 +0100 |
| commit | 08269639606c0481037cbde7ebaf2e0455460883 (patch) | |
| tree | 57c1f967e8836a1a7da84b1887d932e0067d538f /tests/blackjack.rs | |
| parent | v2.2.0: add blackjack with reserved bets and hit/stand/double (diff) | |
| download | zagan-bet-08269639606c0481037cbde7ebaf2e0455460883.tar.gz zagan-bet-08269639606c0481037cbde7ebaf2e0455460883.zip | |
v2.2.1: forfeit blackjack bets when leaving or disconnecting
Diffstat (limited to '')
| -rw-r--r-- | tests/blackjack.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/blackjack.rs b/tests/blackjack.rs index 79721d3..f90ca8d 100644 --- a/tests/blackjack.rs +++ b/tests/blackjack.rs | |||
| @@ -80,6 +80,17 @@ fn doubling_adds_the_base_bet_and_draws_one_card() { | |||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | #[test] | 82 | #[test] |
| 83 | fn forfeiting_loses_the_bet() { | ||
| 84 | let mut hand = hand(&["10S", "9D", "6H", "8C"], 10); | ||
| 85 | hand.forfeit(); | ||
| 86 | |||
| 87 | assert!(hand.is_done()); | ||
| 88 | assert_eq!(hand.result, "forfeit"); | ||
| 89 | assert_eq!(hand.winnings, 0); | ||
| 90 | assert_eq!(hand.bet, 10); | ||
| 91 | } | ||
| 92 | |||
| 93 | #[test] | ||
| 83 | fn the_dealer_busts_and_the_player_wins() { | 94 | fn the_dealer_busts_and_the_player_wins() { |
| 84 | let mut hand = hand(&["10S", "7H", "8H", "9C", "10H"], 10); | 95 | let mut hand = hand(&["10S", "7H", "8H", "9C", "10H"], 10); |
| 85 | assert_eq!(hand.player_total(), 18); | 96 | assert_eq!(hand.player_total(), 18); |
