module Test.Data.Maybe where import Test.QuickCheck (TestGroup(..), TestResult, quickCheck) import Prelude import Data.Maybe (fromJust, isNothing, isJust) nothing :: Maybe Integer nothing = Nothing intNothing :: Maybe Int intNothing = Nothing justTest :: Bool justTest = (isJust $ Just 25) nothingTest :: Bool nothingTest = (isNothing Nothing) fromJustTest :: Bool fromJustTest = (fromJust (Just 12) == 12) test :: TestGroup (Integer -> IO TestResult) test = Exe [ quickCheck "show1" (show (Just 2) == "Just 2") , quickCheck "show2" (show nothing == "Nothing") , quickCheck "eq1" (Just 2 /= nothing) , quickCheck "eq2" (Just 2 == Just 2) , quickCheck "eq3" (nothing == nothing) , quickCheck "eq4" (Just 1 /= Just 2) , quickCheck "ord1" (Just 1 > nothing) , quickCheck "ord2" (Just 2 > Just 1) , quickCheck "just" justTest ,quickCheck "Nothing" nothingTest ,quickCheck "fromJust" fromJustTest ]