bamse-0.9.4: tests/Tests.hs
module Main where
import Bamse.Util.List
import Test.QuickCheck
import Test.HUnit
instance Arbitrary Char where
arbitrary = choose ('\x20','\x80')
coarbitrary c = variant (fromEnum c `mod` 4)
unitSplit :: Test
unitSplit = TestList $
zipWith (\ t i -> ("Bamse.Util.List.split-"++show i) ~: t)
[ ["a","b","c"] ~=? (split ',' "a,b,c")
, ["a","b","c"] ~=? (split ',' "a,b,c,")
]
[(1::Integer)..]
unitList :: Test
unitList = TestList
[ unitSplit
]
quickList :: IO ()
quickList = do
quickCheck (\ s -> null s == null (init0 s) || init0 (s::String) == take (length s - 1) s)
checkList :: IO ()
checkList = do
quickList
c <- runTestTT unitList
putStrLn (showCounts c)
main :: IO ()
main = do
checkList