]> code.delx.au - offlineimap/commitdiff
Switched tests to Word8
authorJohn Goerzen <jgoerzen@complete.org>
Thu, 29 May 2008 06:20:15 +0000 (01:20 -0500)
committerJohn Goerzen <jgoerzen@complete.org>
Thu, 29 May 2008 06:20:15 +0000 (01:20 -0500)
testsrc/TestInfrastructure.hs
testsrc/runtests.hs

index 83b0b84a9b4fdb8e3e41e575fecc242d187e7f1b..b2f5b841cfbbc8bacd1b81731898f6f2c8098db2 100644 (file)
@@ -24,6 +24,7 @@ import qualified Data.Map as Map
 import System.IO
 import Text.Printf
 import System.Random
+import Data.Word
 
 (@=?) :: (Eq a, Show a) => a -> a -> Result
 expected @=? actual = 
index 756e3a6fdce28bfef6bc74fd0c7afc5b5505a948..f00dc9bf1cbee1bd55bf9af308986cf4ca8a66d7 100644 (file)
@@ -25,6 +25,7 @@ import qualified Data.Map as Map
 import Data.List
 import Data.Maybe(catMaybes)
 import System.IO(stderr)
+import Data.Word
 
 import Data.Syncable
 import TestInfrastructure
@@ -47,7 +48,7 @@ prop_delAllFromMaster inp =
         in (expectedResMaster, []) @=? 
            (sort resMaster, resChild)
            
-prop_addFromMaster :: SyncCollection Int Float -> Result
+prop_addFromMaster :: SyncCollection Int Word8 -> Result
 prop_addFromMaster inp =
     let (resMaster, resChild) = syncBiDir inp emptymap emptymap
         expectedResChild = sort . map (\(k, v) -> CopyItem k v) . Map.toList $ inp
@@ -56,7 +57,7 @@ prop_addFromMaster inp =
 
 -- FIXME: prop_addFromChild
 
-prop_allChangesToChild :: SyncCollection Int Float -> SyncCollection Int Float -> Result
+prop_allChangesToChild :: SyncCollection Int Word8 -> SyncCollection Int Word8 -> Result
 prop_allChangesToChild master child =
     let (resMaster, resChild) = syncBiDir master child child
         expectedResChild = sort $
@@ -82,7 +83,7 @@ prop_allChangesToChild master child =
         in (sort masterChanges, expectedResChild) @=?
            (sort resMaster, sort resChild)
 
-prop_allChangesToMaster :: SyncCollection Int Float -> SyncCollection Int Float -> Result
+prop_allChangesToMaster :: SyncCollection Int Word8 -> SyncCollection Int Word8 -> Result
 prop_allChangesToMaster master child =
     let (resMaster, resChild) = syncBiDir master child master
         expectedResMaster = sort $
@@ -101,7 +102,7 @@ prop_allChangesToMaster master child =
 
 -- FIXME: test findModified
 
-prop_allChanges :: SyncCollection Int Float -> SyncCollection Int Float -> SyncCollection Int Float -> Result
+prop_allChanges :: SyncCollection Int Word8 -> SyncCollection Int Word8 -> SyncCollection Int Word8 -> Result
 prop_allChanges master child lastchild =
     let (resMaster, resChild) = syncBiDir master child lastchild
 
@@ -150,7 +151,7 @@ prop_allChanges master child lastchild =
        (sort resMaster, sort resChild)
 
 {- | Basic validation that unaryApplyChanges works -}
-prop_unaryApplyChanges :: SyncCollection Int Float -> [(Bool, Int, Float)] -> Result
+prop_unaryApplyChanges :: SyncCollection Int Word8 -> [(Bool, Int, Word8)] -> Result
 prop_unaryApplyChanges collection randcommands =
     let -- We use nubBy to make sure we don't get input that has reference
         -- to the same key more than once.  We then convert True/False to
@@ -170,7 +171,7 @@ prop_unaryApplyChanges collection randcommands =
 
 {- | Should validate both that unaryApplyChanges works, and that it is
 an identify -}
-prop_unaryApplyChangesId :: SyncCollection Int Float -> SyncCollection Int Float -> Result
+prop_unaryApplyChangesId :: SyncCollection Int Word8 -> SyncCollection Int Word8 -> Result
 prop_unaryApplyChangesId master child =
     let (resMaster, resChild) = syncBiDir master child child
         newMaster = unaryApplyChanges master resMaster
@@ -180,14 +181,14 @@ prop_unaryApplyChangesId master child =
         in (True, sort (Map.keys master), sort (Map.keys master)) @=?
            (newMasterKeys == newChildKeys, newMasterKeys, newChildKeys)
 
-prop_unaryApplyChanges3 :: SyncCollection Int Float -> SyncCollection Int Float -> SyncCollection Int Float -> Result
+prop_unaryApplyChanges3 :: SyncCollection Int Word8 -> SyncCollection Int Word8 -> SyncCollection Int Word8 -> Result
 prop_unaryApplyChanges3 master child lastChild =
     let (resMaster, resChild) = syncBiDir master child lastChild
         newMaster = unaryApplyChanges master resMaster
         newChild = unaryApplyChanges child resChild
     in newMaster @=? newChild
 
-prop_diffCollection :: SyncCollection Int Float -> SyncCollection Int Float -> Result
+prop_diffCollection :: SyncCollection Int Word8 -> SyncCollection Int Word8 -> Result
 prop_diffCollection coll1 coll2 = 
     let commands = diffCollection coll1 coll2
         newcoll2 = unaryApplyChanges coll1 commands