import Test.QuickCheck.Batch
import qualified Test.HUnit as HU
import Test.HUnit.Utils
-import qualified Data.Map as Map
-import System.IO
-import Text.Printf
+import Data.List
+import System.IO(stderr)
+import Data.Word
-import Data.Syncable
+import TestInfrastructure
-prop_empty =
- syncThem emptymap emptymap emptymap == ([], [], []) -- ([DeleteItem 5], [], [])
+import qualified TestSyncable
+import qualified TestConnection
+import qualified TestParser
-keysToMap :: Ord k => [k] -> Map.Map k ()
-keysToMap = foldl (\map k -> Map.insert k () map) Map.empty
+q :: Testable a => String -> a -> HU.Test
+q = qccheck (defaultConfig {configMaxTest = 250})
-emptymap :: Map.Map Integer ()
-emptymap = Map.empty
+tl msg t = HU.TestLabel msg $ HU.TestList t
-allt = [("Empty", prop_empty)]
-alltHU = map (\(str, prop) -> qctest str prop) allt
+allt = [tl "TestSyncable" TestSyncable.allt,
+ tl "TestConnection" TestConnection.allt,
+ tl "TestParser" TestParser.allt]
-testh = HU.runTestTT $ HU.TestList alltHU
-testv = runVerbTestText (HU.putTextToHandle stderr True) $ HU.TestList alltHU
+testh = HU.runTestTT $ HU.TestList allt
+testv = runVerbTestText (HU.putTextToHandle stderr True) $ HU.TestList allt
-testq = runTests "Test Stuff" defOpt (map (run . snd) allt)
-
--- Modified from HUnit
-runVerbTestText :: HU.PutText st -> HU.Test -> IO (HU.Counts, st)
-runVerbTestText (HU.PutText put us) t = do
- (counts, us') <- HU.performTest reportStart reportError reportFailure us t
- us'' <- put (HU.showCounts counts) True us'
- return (counts, us'')
- where
- reportStart ss us = do hPrintf stderr "\rTesting %-68s\n" (HU.showPath (HU.path ss))
- put (HU.showCounts (HU.counts ss)) False us
- reportError = reportProblem "Error:" "Error in: "
- reportFailure = reportProblem "Failure:" "Failure in: "
- reportProblem p0 p1 msg ss us = put line True us
- where line = "### " ++ kind ++ path' ++ '\n' : msg
- kind = if null path' then p0 else p1
- path' = HU.showPath (HU.path ss)
-
-
+
main =
do testv
return ()