testSequenceSetSequenceSet :: TestTree
testSequenceSetSequenceSet =
  let ss1 = O.SequenceSet 0 c 0
      ss2 = O.SequenceSet 0 c2 1
      ss3 = O.SequenceSet 1 c 0
      ss4 = O.SequenceSet 0 c2 0 in
  testGroup "SequenceSet vs SequenceSet"
  [ testCase "Wins tiebreaker" $ do
      assertEqual "a" (Just ss2) $ T.transform ss2 ss1 T.Left
      assertEqual "b" (Just ss2) $ T.transform ss2 ss1 T.Right
      assertEqual "c" (Just ss1) $ T.transform ss1 ss4 T.Right
  , testCase "Loses tiebreaker" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform ss1 ss2 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform ss1 ss2 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform ss1 ss4 T.Left
  , testCase "Non-conflicting" $ do
      assertEqual "a" (Just ss1) $ T.transform ss1 ss3 T.Left
      assertEqual "b" (Just ss1) $ T.transform ss1 ss3 T.Right
      assertEqual "c" (Just ss3) $ T.transform ss3 ss1 T.Left
      assertEqual "d" (Just ss3) $ T.transform ss3 ss1 T.Right
  , testCase "Equal objects" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform ss2 ss4 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform ss2 ss4 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform ss4 ss2 T.Left
      assertEqual "d" (Just O.NoOp) $ T.transform ss4 ss2 T.Right
  ]
testSequenceSetSequenceSet :: TestTree
testSequenceSetSequenceSet =
  let ss1 = O.SequenceSet 0 c 0
      ss2 = O.SequenceSet 0 c2 1
      ss3 = O.SequenceSet 1 c 0
      ss4 = O.SequenceSet 0 c2 0 in
  testGroup "SequenceSet vs SequenceSet"
  [ testCase "Wins tiebreaker" $ do
      assertEqual "a" (Just ss2) $ T.transform ss2 ss1 T.Left
      assertEqual "b" (Just ss2) $ T.transform ss2 ss1 T.Right
      assertEqual "c" (Just ss1) $ T.transform ss1 ss4 T.Right
  , testCase "Loses tiebreaker" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform ss1 ss2 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform ss1 ss2 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform ss1 ss4 T.Left
  , testCase "Non-conflicting" $ do
      assertEqual "a" (Just ss1) $ T.transform ss1 ss3 T.Left
      assertEqual "b" (Just ss1) $ T.transform ss1 ss3 T.Right
      assertEqual "c" (Just ss3) $ T.transform ss3 ss1 T.Left
      assertEqual "d" (Just ss3) $ T.transform ss3 ss1 T.Right
  , testCase "Equal objects" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform ss2 ss4 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform ss2 ss4 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform ss4 ss2 T.Left
      assertEqual "d" (Just O.NoOp) $ T.transform ss4 ss2 T.Right
  ]
testSequenceSetSequenceSet =
  let ss1 = O.SequenceSet 0 c 0
      ss2 = O.SequenceSet 0 c2 1
      ss3 = O.SequenceSet 1 c 0
      ss4 = O.SequenceSet 0 c2 0 in
  testGroup "SequenceSet vs SequenceSet"
  [ testCase "Wins tiebreaker" $ do
      assertEqual "a" (Just ss2) $ T.transform ss2 ss1 T.Left
      assertEqual "b" (Just ss2) $ T.transform ss2 ss1 T.Right
      assertEqual "c" (Just ss1) $ T.transform ss1 ss4 T.Right
  , testCase "Loses tiebreaker" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform ss1 ss2 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform ss1 ss2 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform ss1 ss4 T.Left
  , testCase "Non-conflicting" $ do
      assertEqual "a" (Just ss1) $ T.transform ss1 ss3 T.Left
      assertEqual "b" (Just ss1) $ T.transform ss1 ss3 T.Right
      assertEqual "c" (Just ss3) $ T.transform ss3 ss1 T.Left
      assertEqual "d" (Just ss3) $ T.transform ss3 ss1 T.Right
  , testCase "Equal objects" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform ss2 ss4 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform ss2 ss4 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform ss4 ss2 T.Left
      assertEqual "d" (Just O.NoOp) $ T.transform ss4 ss2 T.Right
  ]