on master help sign in
WIP test more merge strategies
commit2e8ae784e7288cd29f9eb6a70e67257162ac41b4 authorAgentM <agentm@themactionfaction.com> dateSun 3 Jul 2016, 14:43 (10 years ago) parentb6ba986
1 file changed+19−4
test/TransactionGraph/Merge.hs+19−4
test/TransactionGraph/Merge.hs+19−4
@@ -123,7 +123,7 @@ testSelectedBranchMerge = TestCase $ do
123123 (Just err, _) -> assertFailure (show err) >> undefined
124124 (Nothing, context) -> pure context
125125 (_, graph') <- addTransaction "branchB" (fakeUUID 3) updatedBranchBContext (transactionUUID branchBTrans) graph
126− --putStrLn $ "struct " ++ showGraphStructure graph'
126+
127127 --create the merge transaction in the graph
128128 let eGraph' = mergeTransactions (fakeUUID 4) (fakeUUID 10) (SelectedBranchMergeStrategy "branchA") ("branchA", "branchB") graph'
129129
@@ -139,9 +139,24 @@ testSelectedBranchMerge = TestCase $ do
139139 mergeTrans <- assertMaybe (transactionForUUID (fakeUUID 4) graph'')
140140 assertTrue "branchOnlyRelvar is present in merge" (M.notMember "branchBOnlyRelvar" (relationVariables (transactionContext mergeTrans)))
141141
142−-- try various individual components conflicts
142+-- try various individual component conflicts and check for resolution
143143testUnionPreferMergeStrategy :: Test
144144testUnionPreferMergeStrategy = TestCase $ undefined
145−
145+
146+-- try various individual component conflicts and check for merge failure
146147testUnionMergeStrategy :: Test
147−testUnionMergeStrategy = TestCase $ undefined
148+testUnionMergeStrategy = TestCase $ do
149+ graph <- basicTransactionGraph
150+ assertGraph graph
151+
152+
153+ branchBTrans <- assertMaybe (transactionForHead "branchB" graph) "failed to get branchB head"
154+ branchATrans <- assertMaybe (transactionForHead "branchA" graph) "failed to get branchA head"
155+ -- add another relvar to branchB - branchBOnlyRelvar should appear in the merge
156+ -- add inclusion dependency in branchA
157+
158+ let updatedBranchBContext = branchBTrans {relationVariables = M.insert "branchBOnlyRelVar" (relationVariables branchBTrans) }
159+ let updatedBranchAContext = branchATrans {inclusionDependencies = M.insert "branchAOnlyIncDep" (inclusionDependencies branchATrans) }
160+
161+ (_, graph') <- addTransaction "branchB" (fakeUUID 3) updatedBranchBContext (transactionUUID branchBTrans) graph
162+