]> code.delx.au - offlineimap/blobdiff - testsrc/runtests.hs
All changes fixed, I think
[offlineimap] / testsrc / runtests.hs
index 0456dd6f8c7f1c6a4c26dd1f412f949a69d55cbf..9252912d58b35b6b28a5db4f54dc9101dc07023c 100644 (file)
@@ -104,7 +104,33 @@ prop_allChangesToMaster master child =
 prop_allChanges :: SyncCollection Int Float -> SyncCollection Int Float -> SyncCollection Int Float -> Result
 prop_allChanges master child lastchild =
     let (resMaster, resChild) = syncBiDir master child lastchild
-        masterChildCommon = findModified child master
+        masterChildCommon = 
+            Map.fromList . catMaybes . map procKV . Map.toList . Map.union
+                (Map.intersection master lastchild) $
+                (Map.intersection child master)
+            where procKV (k, v) =
+                      case (Map.lookup k master, Map.lookup k child,
+                            Map.lookup k lastchild) of
+                        (Just m, Just c, Just lc) ->
+                            if lc == c 
+                               then if lc == m
+                                    then Nothing
+                                    else Just (k, m)
+                               else Just (k, c)
+                        (Just m, Just c, Nothing) -> 
+                            if m == c
+                               then Nothing
+                               else Just (k, c)
+                        (Just m, Nothing, Just lc) ->
+                            if m == lc
+                               then Nothing
+                               else Just (k, m)
+                        (Nothing, Just c, Just lc) ->
+                            if c == lc
+                               then Nothing
+                               else Just (k, c)
+                        _ -> Nothing
+                               
         masterMods = findNewMods masterChildCommon master
         childMods = findNewMods masterChildCommon child