diff options
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); |
