Updated Haskell poker libary tests to check high card hands and value comparisons

This commit is contained in:
Correl Roush 2012-01-31 23:47:41 -05:00
parent 2398bdc7b2
commit 98cf332435

View file

@ -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