Implemented hand and deck
This commit is contained in:
parent
77315c79b0
commit
ac25a1caea
8 changed files with 451 additions and 59 deletions
|
|
@ -2,6 +2,7 @@ use poker_api::card::Card;
|
|||
|
||||
#[test]
|
||||
fn test_card_integration() {
|
||||
let card = Card::from_string("As");
|
||||
let card = Card::from_string("As").unwrap();
|
||||
assert_eq!(card.to_string(), "As");
|
||||
}
|
||||
|
||||
|
|
|
|||
9
api/tests/deck_tests.rs
Normal file
9
api/tests/deck_tests.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
use poker_api::deck::Deck;
|
||||
|
||||
#[test]
|
||||
fn test_deck_integration() {
|
||||
let mut deck = Deck::new();
|
||||
let card = deck.deal().unwrap();
|
||||
assert_eq!(deck.cards_left(), 51);
|
||||
assert!(!deck.in_deck(card));
|
||||
}
|
||||
11
api/tests/hand_test.rs
Normal file
11
api/tests/hand_test.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
use poker_api::card::Card;
|
||||
use poker_api::hand::Hand;
|
||||
|
||||
#[test]
|
||||
fn test_hand_integration() {
|
||||
let mut hand = Hand::new();
|
||||
hand.add_card(Card::from_string("As").unwrap()).unwrap();
|
||||
hand.add_card(Card::from_string("Ks").unwrap()).unwrap();
|
||||
assert_eq!(hand.size(), 2);
|
||||
assert_eq!(hand.to_string(), "As Ks");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue