testTransformChildNonAffecting :: TestTree
testTransformChildNonAffecting =
  let dop1 = O.DirectedOperation "foo/bar" $ O.IntInc 1
      dop1' = O.DirectedOperation "foo/0" $ O.IntInc 1
      dop2 = O.DirectedOperation "foo/bar/baz" $ O.MapUnset "bar"
      dop3 = O.DirectedOperation "foo/baz" $ O.MapUnset "baz"
      dop4 = O.DirectedOperation "baz" $ O.MapUnset "baz"
      dop5 = O.DirectedOperation "foo/bar/baz" $ O.MapSet "bar" c 0
      dop6 = O.DirectedOperation "foo/baz" $ O.MapSet "baz" c 0
      dop7 = O.DirectedOperation "baz" $ O.MapSet "baz" c 0
      dop8 = O.DirectedOperation "foo/bar/baz" $ O.SequenceSet 0 c 0
      dop9 = O.DirectedOperation "foo/baz" $ O.SequenceSet 0 c 0
      dop10 = O.DirectedOperation "baz" $ O.SequenceSet 0 c 0
      dop11 = O.DirectedOperation "foo/bar/baz" $ O.SequenceInsert 0 c 0
      dop12 = O.DirectedOperation "foo/baz" $ O.SequenceInsert 0 c 0
      dop13 = O.DirectedOperation "baz" $ O.SequenceInsert 0 c 0
      dop14 = O.DirectedOperation "foo/bar/baz" $ O.SequenceDelete 0
      dop15 = O.DirectedOperation "foo/baz" $ O.SequenceDelete 0
      dop16 = O.DirectedOperation "baz" $ O.SequenceDelete 0
      dop17 = O.DirectedOperation "foo/bar/baz" $ O.RootSet c 0
      dop18 = O.DirectedOperation "foo/baz" $ O.RootSet c 0
      dop19 = O.DirectedOperation "baz" $ O.RootSet c 0
      in
  testCase "Transform Child Non-Affecting" $ do
    assertEqual "a" (Just dop1) $ T.transformDirected dop1 dop2 T.Left
    assertEqual "b" (Just dop1) $ T.transformDirected dop1 dop2 T.Right
    assertEqual "c" (Just dop1) $ T.transformDirected dop1 dop3 T.Left
    assertEqual "d" (Just dop1) $ T.transformDirected dop1 dop3 T.Right
    assertEqual "e" (Just dop1) $ T.transformDirected dop1 dop4 T.Left
    assertEqual "f" (Just dop1) $ T.transformDirected dop1 dop4 T.Right
    assertEqual "g" (Just dop1) $ T.transformDirected dop1 dop5 T.Left
    assertEqual "h" (Just dop1) $ T.transformDirected dop1 dop5 T.Right
    assertEqual "i" (Just dop1) $ T.transformDirected dop1 dop6 T.Left
    assertEqual "j" (Just dop1) $ T.transformDirected dop1 dop6 T.Right
    assertEqual "k" (Just dop1) $ T.transformDirected dop1 dop7 T.Left
    assertEqual "l" (Just dop1) $ T.transformDirected dop1 dop7 T.Right
    assertEqual "m" (Just dop1') $ T.transformDirected dop1' dop8 T.Left
    assertEqual "n" (Just dop1') $ T.transformDirected dop1' dop8 T.Right
    assertEqual "o" (Just dop1') $ T.transformDirected dop1' dop9 T.Left
    assertEqual "p" (Just dop1') $ T.transformDirected dop1' dop9 T.Right
    assertEqual "q" (Just dop1') $ T.transformDirected dop1' dop10 T.Left
    assertEqual "r" (Just dop1') $ T.transformDirected dop1' dop10 T.Right
    assertEqual "s" (Just dop1') $ T.transformDirected dop1' dop11 T.Left
    assertEqual "t" (Just dop1') $ T.transformDirected dop1' dop11 T.Right
    assertEqual "u" (Just dop1') $ T.transformDirected dop1' dop12 T.Left
    assertEqual "v" (Just dop1') $ T.transformDirected dop1' dop12 T.Right
    assertEqual "w" (Just dop1') $ T.transformDirected dop1' dop13 T.Left
    assertEqual "x" (Just dop1') $ T.transformDirected dop1' dop13 T.Right
    assertEqual "y" (Just dop1') $ T.transformDirected dop1' dop14 T.Left
    assertEqual "z" (Just dop1') $ T.transformDirected dop1' dop14 T.Right
    assertEqual "aa" (Just dop1') $ T.transformDirected dop1' dop15 T.Left
    assertEqual "ab" (Just dop1') $ T.transformDirected dop1' dop15 T.Right
    assertEqual "ac" (Just dop1') $ T.transformDirected dop1' dop16 T.Left
    assertEqual "ad" (Just dop1') $ T.transformDirected dop1' dop16 T.Right
    assertEqual "ae" (Just dop1') $ T.transformDirected dop1' dop17 T.Left
    assertEqual "af" (Just dop1') $ T.transformDirected dop1' dop17 T.Right
    assertEqual "ag" (Just dop1') $ T.transformDirected dop1' dop18 T.Left
    assertEqual "ah" (Just dop1') $ T.transformDirected dop1' dop18 T.Right
    assertEqual "ai" (Just dop1') $ T.transformDirected dop1' dop19 T.Left
    assertEqual "aj" (Just dop1') $ T.transformDirected dop1' dop19 T.Right
testTransformChildNonAffecting :: TestTree
testTransformChildNonAffecting =
  let dop1 = O.DirectedOperation "foo/bar" $ O.IntInc 1
      dop1' = O.DirectedOperation "foo/0" $ O.IntInc 1
      dop2 = O.DirectedOperation "foo/bar/baz" $ O.MapUnset "bar"
      dop3 = O.DirectedOperation "foo/baz" $ O.MapUnset "baz"
      dop4 = O.DirectedOperation "baz" $ O.MapUnset "baz"
      dop5 = O.DirectedOperation "foo/bar/baz" $ O.MapSet "bar" c 0
      dop6 = O.DirectedOperation "foo/baz" $ O.MapSet "baz" c 0
      dop7 = O.DirectedOperation "baz" $ O.MapSet "baz" c 0
      dop8 = O.DirectedOperation "foo/bar/baz" $ O.SequenceSet 0 c 0
      dop9 = O.DirectedOperation "foo/baz" $ O.SequenceSet 0 c 0
      dop10 = O.DirectedOperation "baz" $ O.SequenceSet 0 c 0
      dop11 = O.DirectedOperation "foo/bar/baz" $ O.SequenceInsert 0 c 0
      dop12 = O.DirectedOperation "foo/baz" $ O.SequenceInsert 0 c 0
      dop13 = O.DirectedOperation "baz" $ O.SequenceInsert 0 c 0
      dop14 = O.DirectedOperation "foo/bar/baz" $ O.SequenceDelete 0
      dop15 = O.DirectedOperation "foo/baz" $ O.SequenceDelete 0
      dop16 = O.DirectedOperation "baz" $ O.SequenceDelete 0
      dop17 = O.DirectedOperation "foo/bar/baz" $ O.RootSet c 0
      dop18 = O.DirectedOperation "foo/baz" $ O.RootSet c 0
      dop19 = O.DirectedOperation "baz" $ O.RootSet c 0
      in
  testCase "Transform Child Non-Affecting" $ do
    assertEqual "a" (Just dop1) $ T.transformDirected dop1 dop2 T.Left
    assertEqual "b" (Just dop1) $ T.transformDirected dop1 dop2 T.Right
    assertEqual "c" (Just dop1) $ T.transformDirected dop1 dop3 T.Left
    assertEqual "d" (Just dop1) $ T.transformDirected dop1 dop3 T.Right
    assertEqual "e" (Just dop1) $ T.transformDirected dop1 dop4 T.Left
    assertEqual "f" (Just dop1) $ T.transformDirected dop1 dop4 T.Right
    assertEqual "g" (Just dop1) $ T.transformDirected dop1 dop5 T.Left
    assertEqual "h" (Just dop1) $ T.transformDirected dop1 dop5 T.Right
    assertEqual "i" (Just dop1) $ T.transformDirected dop1 dop6 T.Left
    assertEqual "j" (Just dop1) $ T.transformDirected dop1 dop6 T.Right
    assertEqual "k" (Just dop1) $ T.transformDirected dop1 dop7 T.Left
    assertEqual "l" (Just dop1) $ T.transformDirected dop1 dop7 T.Right
    assertEqual "m" (Just dop1') $ T.transformDirected dop1' dop8 T.Left
    assertEqual "n" (Just dop1') $ T.transformDirected dop1' dop8 T.Right
    assertEqual "o" (Just dop1') $ T.transformDirected dop1' dop9 T.Left
    assertEqual "p" (Just dop1') $ T.transformDirected dop1' dop9 T.Right
    assertEqual "q" (Just dop1') $ T.transformDirected dop1' dop10 T.Left
    assertEqual "r" (Just dop1') $ T.transformDirected dop1' dop10 T.Right
    assertEqual "s" (Just dop1') $ T.transformDirected dop1' dop11 T.Left
    assertEqual "t" (Just dop1') $ T.transformDirected dop1' dop11 T.Right
    assertEqual "u" (Just dop1') $ T.transformDirected dop1' dop12 T.Left
    assertEqual "v" (Just dop1') $ T.transformDirected dop1' dop12 T.Right
    assertEqual "w" (Just dop1') $ T.transformDirected dop1' dop13 T.Left
    assertEqual "x" (Just dop1') $ T.transformDirected dop1' dop13 T.Right
    assertEqual "y" (Just dop1') $ T.transformDirected dop1' dop14 T.Left
    assertEqual "z" (Just dop1') $ T.transformDirected dop1' dop14 T.Right
    assertEqual "aa" (Just dop1') $ T.transformDirected dop1' dop15 T.Left
    assertEqual "ab" (Just dop1') $ T.transformDirected dop1' dop15 T.Right
    assertEqual "ac" (Just dop1') $ T.transformDirected dop1' dop16 T.Left
    assertEqual "ad" (Just dop1') $ T.transformDirected dop1' dop16 T.Right
    assertEqual "ae" (Just dop1') $ T.transformDirected dop1' dop17 T.Left
    assertEqual "af" (Just dop1') $ T.transformDirected dop1' dop17 T.Right
    assertEqual "ag" (Just dop1') $ T.transformDirected dop1' dop18 T.Left
    assertEqual "ah" (Just dop1') $ T.transformDirected dop1' dop18 T.Right
    assertEqual "ai" (Just dop1') $ T.transformDirected dop1' dop19 T.Left
    assertEqual "aj" (Just dop1') $ T.transformDirected dop1' dop19 T.Right
testTransformChildNonAffecting =
  let dop1 = O.DirectedOperation "foo/bar" $ O.IntInc 1
      dop1' = O.DirectedOperation "foo/0" $ O.IntInc 1
      dop2 = O.DirectedOperation "foo/bar/baz" $ O.MapUnset "bar"
      dop3 = O.DirectedOperation "foo/baz" $ O.MapUnset "baz"
      dop4 = O.DirectedOperation "baz" $ O.MapUnset "baz"
      dop5 = O.DirectedOperation "foo/bar/baz" $ O.MapSet "bar" c 0
      dop6 = O.DirectedOperation "foo/baz" $ O.MapSet "baz" c 0
      dop7 = O.DirectedOperation "baz" $ O.MapSet "baz" c 0
      dop8 = O.DirectedOperation "foo/bar/baz" $ O.SequenceSet 0 c 0
      dop9 = O.DirectedOperation "foo/baz" $ O.SequenceSet 0 c 0
      dop10 = O.DirectedOperation "baz" $ O.SequenceSet 0 c 0
      dop11 = O.DirectedOperation "foo/bar/baz" $ O.SequenceInsert 0 c 0
      dop12 = O.DirectedOperation "foo/baz" $ O.SequenceInsert 0 c 0
      dop13 = O.DirectedOperation "baz" $ O.SequenceInsert 0 c 0
      dop14 = O.DirectedOperation "foo/bar/baz" $ O.SequenceDelete 0
      dop15 = O.DirectedOperation "foo/baz" $ O.SequenceDelete 0
      dop16 = O.DirectedOperation "baz" $ O.SequenceDelete 0
      dop17 = O.DirectedOperation "foo/bar/baz" $ O.RootSet c 0
      dop18 = O.DirectedOperation "foo/baz" $ O.RootSet c 0
      dop19 = O.DirectedOperation "baz" $ O.RootSet c 0
      in
  testCase "Transform Child Non-Affecting" $ do
    assertEqual "a" (Just dop1) $ T.transformDirected dop1 dop2 T.Left
    assertEqual "b" (Just dop1) $ T.transformDirected dop1 dop2 T.Right
    assertEqual "c" (Just dop1) $ T.transformDirected dop1 dop3 T.Left
    assertEqual "d" (Just dop1) $ T.transformDirected dop1 dop3 T.Right
    assertEqual "e" (Just dop1) $ T.transformDirected dop1 dop4 T.Left
    assertEqual "f" (Just dop1) $ T.transformDirected dop1 dop4 T.Right
    assertEqual "g" (Just dop1) $ T.transformDirected dop1 dop5 T.Left
    assertEqual "h" (Just dop1) $ T.transformDirected dop1 dop5 T.Right
    assertEqual "i" (Just dop1) $ T.transformDirected dop1 dop6 T.Left
    assertEqual "j" (Just dop1) $ T.transformDirected dop1 dop6 T.Right
    assertEqual "k" (Just dop1) $ T.transformDirected dop1 dop7 T.Left
    assertEqual "l" (Just dop1) $ T.transformDirected dop1 dop7 T.Right
    assertEqual "m" (Just dop1') $ T.transformDirected dop1' dop8 T.Left
    assertEqual "n" (Just dop1') $ T.transformDirected dop1' dop8 T.Right
    assertEqual "o" (Just dop1') $ T.transformDirected dop1' dop9 T.Left
    assertEqual "p" (Just dop1') $ T.transformDirected dop1' dop9 T.Right
    assertEqual "q" (Just dop1') $ T.transformDirected dop1' dop10 T.Left
    assertEqual "r" (Just dop1') $ T.transformDirected dop1' dop10 T.Right
    assertEqual "s" (Just dop1') $ T.transformDirected dop1' dop11 T.Left
    assertEqual "t" (Just dop1') $ T.transformDirected dop1' dop11 T.Right
    assertEqual "u" (Just dop1') $ T.transformDirected dop1' dop12 T.Left
    assertEqual "v" (Just dop1') $ T.transformDirected dop1' dop12 T.Right
    assertEqual "w" (Just dop1') $ T.transformDirected dop1' dop13 T.Left
    assertEqual "x" (Just dop1') $ T.transformDirected dop1' dop13 T.Right
    assertEqual "y" (Just dop1') $ T.transformDirected dop1' dop14 T.Left
    assertEqual "z" (Just dop1') $ T.transformDirected dop1' dop14 T.Right
    assertEqual "aa" (Just dop1') $ T.transformDirected dop1' dop15 T.Left
    assertEqual "ab" (Just dop1') $ T.transformDirected dop1' dop15 T.Right
    assertEqual "ac" (Just dop1') $ T.transformDirected dop1' dop16 T.Left
    assertEqual "ad" (Just dop1') $ T.transformDirected dop1' dop16 T.Right
    assertEqual "ae" (Just dop1') $ T.transformDirected dop1' dop17 T.Left
    assertEqual "af" (Just dop1') $ T.transformDirected dop1' dop17 T.Right
    assertEqual "ag" (Just dop1') $ T.transformDirected dop1' dop18 T.Left
    assertEqual "ah" (Just dop1') $ T.transformDirected dop1' dop18 T.Right
    assertEqual "ai" (Just dop1') $ T.transformDirected dop1' dop19 T.Left
    assertEqual "aj" (Just dop1') $ T.transformDirected dop1' dop19 T.Right