fix: ensure HighCard only applies when no other combination matches
This commit is contained in:
@@ -5,7 +5,7 @@ import cards._
|
||||
|
||||
class HighCardTest extends FunSuite {
|
||||
|
||||
test("HighCard accepts any hand") {
|
||||
test("HighCard returns true only when no other combination applies") {
|
||||
val hand = List(
|
||||
Card(Two, Hearts),
|
||||
Card(Four, Clubs),
|
||||
@@ -13,16 +13,21 @@ class HighCardTest extends FunSuite {
|
||||
Card(Jack, Spades),
|
||||
Card(Ace, Hearts)
|
||||
)
|
||||
|
||||
val combination = HighCard()
|
||||
assert(combination.verify(hand))
|
||||
assert(combination.verify(hand)) // No other combination applies
|
||||
assertEquals(combination.score.chips, 5)
|
||||
assertEquals(combination.score.multiplier, 1)
|
||||
}
|
||||
|
||||
test("HighCard accepts even a single card") {
|
||||
val hand = List(Card(King, Clubs))
|
||||
test("HighCard returns false when hand has a pair") {
|
||||
val hand = List(
|
||||
Card(Two, Hearts),
|
||||
Card(Two, Spades), // pair
|
||||
Card(Four, Clubs),
|
||||
Card(Six, Diamonds),
|
||||
Card(Nine, Hearts)
|
||||
)
|
||||
val combination = HighCard()
|
||||
assert(combination.verify(hand))
|
||||
assert(!combination.verify(hand)) // Because it's a pair
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user