From 98cf332435f0b856624fdb08a1d6058197dc3d90 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Tue, 31 Jan 2012 23:47:41 -0500 Subject: [PATCH] Updated Haskell poker libary tests to check high card hands and value comparisons --- haskell/Util/TestPoker.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/haskell/Util/TestPoker.hs b/haskell/Util/TestPoker.hs index 78fb411..46de3a2 100644 --- a/haskell/Util/TestPoker.hs +++ b/haskell/Util/TestPoker.hs @@ -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"] testStraight = [parseCard "9D", parseCard "TS", parseCard "JD", parseCard "QD", parseCard "KD"] 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) , "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 straight" ~: Straight ~=? (fst $ rankHand testStraight) , "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