module HUnitExample (fact, runTests) where import Test.HUnit fact :: Integer -> Integer fact n = product [1..n] runTests :: IO Counts runTests = runTestTT $ TestList [testSet1, testSet2] testSet1 :: Test testSet1 = TestLabel "Factorials" $ TestList [ fact 4 ~?= 25, fact 0 ~?= 1 ] testSet2 :: Test testSet2 = TestLabel "Numerical functions" $ TestList [ even 4 ~? "4 even?", odd 4 ~? "4 odd?" ]