mirror of
https://github.com/correl/euler.git
synced 2024-11-23 19:19:53 +00:00
Updated Haskell poker libary tests to check high card hands and value comparisons
This commit is contained in:
parent
2398bdc7b2
commit
98cf332435
1 changed files with 5 additions and 0 deletions
|
@ -8,6 +8,8 @@ testTwo = [parseCard "9D", parseCard "2H", parseCard "9S", parseCard "2D", parse
|
||||||
testFlush = [parseCard "9D", parseCard "2D", parseCard "KD", parseCard "JD", parseCard "5D"]
|
testFlush = [parseCard "9D", parseCard "2D", parseCard "KD", parseCard "JD", parseCard "5D"]
|
||||||
testStraight = [parseCard "9D", parseCard "TS", parseCard "JD", parseCard "QD", parseCard "KD"]
|
testStraight = [parseCard "9D", parseCard "TS", parseCard "JD", parseCard "QD", parseCard "KD"]
|
||||||
testWheel = [parseCard "2D", parseCard "3S", parseCard "4D", parseCard "5D", parseCard "AD"]
|
testWheel = [parseCard "2D", parseCard "3S", parseCard "4D", parseCard "5D", parseCard "AD"]
|
||||||
|
testHigh1 = [parseCard "8C", parseCard "TS", parseCard "KC", parseCard "9H", parseCard "4S"]
|
||||||
|
testHigh2 = [parseCard "7D", parseCard "2S", parseCard "5D", parseCard "3S", parseCard "AC"]
|
||||||
|
|
||||||
tests = TestList [ "Rank 4 of a kind" ~: FourOfAKind ~=? (fst $ rankHand testFour)
|
tests = TestList [ "Rank 4 of a kind" ~: FourOfAKind ~=? (fst $ rankHand testFour)
|
||||||
, "Rank 3 of a kind" ~: ThreeOfAKind ~=? (fst $ rankHand testThree)
|
, "Rank 3 of a kind" ~: ThreeOfAKind ~=? (fst $ rankHand testThree)
|
||||||
|
@ -16,6 +18,9 @@ tests = TestList [ "Rank 4 of a kind" ~: FourOfAKind ~=? (fst $ rankHand testFou
|
||||||
, "Rank a flush" ~: Flush ~=? (fst $ rankHand testFlush)
|
, "Rank a flush" ~: Flush ~=? (fst $ rankHand testFlush)
|
||||||
, "Rank a straight" ~: Straight ~=? (fst $ rankHand testStraight)
|
, "Rank a straight" ~: Straight ~=? (fst $ rankHand testStraight)
|
||||||
, "Rank the wheel" ~: Straight ~=? (fst $ rankHand testWheel)
|
, "Rank the wheel" ~: Straight ~=? (fst $ rankHand testWheel)
|
||||||
|
, "Rank a high card" ~: HighCard ~=? (fst $ rankHand testHigh1)
|
||||||
|
|
||||||
|
, "Compare values" ~: True ~=? (rankHand testHigh1) < (rankHand testHigh2)
|
||||||
]
|
]
|
||||||
|
|
||||||
main = runTestTT tests
|
main = runTestTT tests
|
||||||
|
|
Loading…
Reference in a new issue