import Test.QuickCheck.Batch
import qualified Test.HUnit as HU
import Test.HUnit.Utils
-import qualified Data.Map as Map
import Data.List
import System.IO(stderr)
+import Data.Word
-import Data.Syncable
import TestInfrastructure
-prop_empty :: Bool
-prop_empty =
- syncThem emptymap emptymap emptymap == ([], []) -- ([DeleteItem 5], [], [])
+import qualified TestSyncable
+import qualified TestConnection
+import qualified TestParser
+import qualified TestParserPrim
-prop_delAllFromChild :: SyncCollection Int -> Result
-prop_delAllFromChild inp =
- let (resMaster, resChild) = syncThem emptymap inp inp
- expectedResChild = sort . map DeleteItem . Map.keys $ inp
- in ([], expectedResChild) @=?
- (resMaster, sort resChild)
-
-prop_delAllFromMaster :: SyncCollection Int -> Result
-prop_delAllFromMaster inp =
- let (resMaster, resChild) = syncThem inp emptymap inp
- expectedResMaster = sort . map DeleteItem . Map.keys $ inp
- in (expectedResMaster, []) @=?
- (sort resMaster, resChild)
-
-prop_addFromMaster :: SyncCollection Int -> Result
-prop_addFromMaster inp =
- let (resMaster, resChild) = syncThem inp emptymap emptymap
- expectedResChild = sort . map CopyItem . Map.keys $ inp
- in ([], expectedResChild) @=?
- (resMaster, sort resChild)
+q :: Testable a => String -> a -> HU.Test
+q = qccheck (defaultConfig {configMaxTest = 250})
-allt = [qctest "Empty" prop_empty,
- qctest "Del all from child" prop_delAllFromChild,
- qctest "Del all from master" prop_delAllFromMaster,
- qctest "Add from master" prop_addFromMaster
+tl msg t = HU.TestLabel msg $ HU.TestList t
+
+allt = [tl "TestSyncable" TestSyncable.allt,
+ tl "TestConnection" TestConnection.allt,
+ tl "TestParserPrim" TestParserPrim.allt,
+ tl "TestParser" TestParser.allt
]
testh = HU.runTestTT $ HU.TestList allt