testRootSetRootSet :: TestTree
testRootSetRootSet = 
  let rs1 = O.RootSet (N.IntNode 123) 1
      rs2 = O.RootSet (N.BoolNode False) 2
      rs3 = O.RootSet (N.BoolNode False) 1 in
  testGroup "RootSet vs RootSet"
  [ testCase "Wins tiebreaker" $ do
      assertEqual "a" (Just rs2) $ T.transform rs2 rs1 T.Left
      assertEqual "b" (Just rs2) $ T.transform rs2 rs1 T.Right
      assertEqual "c" (Just rs1) $ T.transform rs1 rs3 T.Right
  , testCase "Loses tiebreaker" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform rs1 rs2 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform rs1 rs2 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform rs1 rs3 T.Left
  , testCase "EqualValues" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform rs2 rs3 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform rs2 rs3 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform rs3 rs2 T.Left
      assertEqual "c" (Just O.NoOp) $ T.transform rs3 rs2 T.Right
  ]
testRootSetRootSet :: TestTree
testRootSetRootSet = 
  let rs1 = O.RootSet (N.IntNode 123) 1
      rs2 = O.RootSet (N.BoolNode False) 2
      rs3 = O.RootSet (N.BoolNode False) 1 in
  testGroup "RootSet vs RootSet"
  [ testCase "Wins tiebreaker" $ do
      assertEqual "a" (Just rs2) $ T.transform rs2 rs1 T.Left
      assertEqual "b" (Just rs2) $ T.transform rs2 rs1 T.Right
      assertEqual "c" (Just rs1) $ T.transform rs1 rs3 T.Right
  , testCase "Loses tiebreaker" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform rs1 rs2 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform rs1 rs2 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform rs1 rs3 T.Left
  , testCase "EqualValues" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform rs2 rs3 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform rs2 rs3 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform rs3 rs2 T.Left
      assertEqual "c" (Just O.NoOp) $ T.transform rs3 rs2 T.Right
  ]
testRootSetRootSet = 
  let rs1 = O.RootSet (N.IntNode 123) 1
      rs2 = O.RootSet (N.BoolNode False) 2
      rs3 = O.RootSet (N.BoolNode False) 1 in
  testGroup "RootSet vs RootSet"
  [ testCase "Wins tiebreaker" $ do
      assertEqual "a" (Just rs2) $ T.transform rs2 rs1 T.Left
      assertEqual "b" (Just rs2) $ T.transform rs2 rs1 T.Right
      assertEqual "c" (Just rs1) $ T.transform rs1 rs3 T.Right
  , testCase "Loses tiebreaker" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform rs1 rs2 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform rs1 rs2 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform rs1 rs3 T.Left
  , testCase "EqualValues" $ do
      assertEqual "a" (Just O.NoOp) $ T.transform rs2 rs3 T.Left
      assertEqual "b" (Just O.NoOp) $ T.transform rs2 rs3 T.Right
      assertEqual "c" (Just O.NoOp) $ T.transform rs3 rs2 T.Left
      assertEqual "c" (Just O.NoOp) $ T.transform rs3 rs2 T.Right
  ]