Moved all flush checks to single function and assigned values to hands with flushes
This commit is contained in:
parent
79978235b9
commit
765b292e24
2 changed files with 29 additions and 46 deletions
|
@ -116,7 +116,8 @@ mod tests {
|
|||
hand.cards.push(Card { rank: "5".to_string(), value: 5, suit: "♥".to_string() });
|
||||
hand.cards.push(Card { rank: "8".to_string(), value: 8, suit: "♥".to_string() });
|
||||
|
||||
assert_eq!(hand.has_flush(), true)
|
||||
assert_eq!(hand.has_flush(), true);
|
||||
assert_eq!(hand.value, 34);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -142,7 +143,8 @@ mod tests {
|
|||
hand.cards.push(Card { rank: "5".to_string(), value: 5, suit: "♥".to_string() });
|
||||
hand.cards.push(Card { rank: "6".to_string(), value: 6, suit: "♥".to_string() });
|
||||
|
||||
assert_eq!(hand.has_straight_flush(), true)
|
||||
assert_eq!(hand.has_flush(), true);
|
||||
assert_eq!(hand.value, 28);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -154,7 +156,9 @@ mod tests {
|
|||
hand.cards.push(Card { rank: "Q".to_string(), value: 12, suit: "♥".to_string() });
|
||||
hand.cards.push(Card { rank: "K".to_string(), value: 13, suit: "♥".to_string() });
|
||||
hand.cards.push(Card { rank: "A".to_string(), value: 14, suit: "♥".to_string() });
|
||||
//9
|
||||
|
||||
assert_eq!(hand.has_royal_flush(), true)
|
||||
assert_eq!(hand.has_flush(), true);
|
||||
assert_eq!(hand.value, 69);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue