module Main where import Test.Tasty import Test.Tasty.QuickCheck as QC import Test.Tasty.HUnit import Data.List(sort) import qualified Persistent.EventSource() main :: IO () main = defaultMain tests tests :: TestTree tests = testGroup "Tests" [qcProps, unitTests] qcProps :: TestTree qcProps = testGroup "(checked by QuickCheck)" [ QC.testProperty "sort == sort . reverse" $ \list -> sort (list :: [Int]) == sort (reverse list) , QC.testProperty "Fermat's little theorem" $ \x -> ((x :: Integer)^zeven - x) `mod` zeven == 0 ] where zeven :: Integer zeven = 7 oneTwoThree :: [Int] oneTwoThree = [1, 2, 3] unitTests :: TestTree unitTests = testGroup "Unit tests" [ testCase "List comparison (different length)" $ oneTwoThree `compare` [1,2] @?= GT -- the following test does not hold , testCase "List comparison (same length)" $ oneTwoThree `compare` [1,2,3] @?= EQ ]