71
71
def make_known_graph(self, ancestry):
72
72
return self.module.KnownGraph(ancestry, do_cache=self.do_cache)
74
def assertDominator(self, graph, rev, dominator):
75
node = graph._nodes[rev]
76
self.assertEqual(dominator, node.linear_dominator)
78
74
def assertGDFO(self, graph, rev, gdfo):
79
75
node = graph._nodes[rev]
80
76
self.assertEqual(gdfo, node.gdfo)
88
84
self.assertEqual(['rev4'], sorted(graph._nodes['rev3'].child_keys))
89
85
self.assertEqual(['rev4'], sorted(graph._nodes['rev2b'].child_keys))
91
def test_dominators_ancestry_1(self):
92
graph = self.make_known_graph(test_graph.ancestry_1)
93
self.assertDominator(graph, 'rev1', NULL_REVISION)
94
self.assertDominator(graph, 'rev2b', 'rev2b')
95
self.assertDominator(graph, 'rev2a', 'rev2a')
96
self.assertDominator(graph, 'rev3', 'rev2a')
97
self.assertDominator(graph, 'rev4', 'rev4')
99
def test_dominators_feature_branch(self):
100
graph = self.make_known_graph(test_graph.feature_branch)
101
self.assertDominator(graph, 'rev1', NULL_REVISION)
102
self.assertDominator(graph, 'rev2b', NULL_REVISION)
103
self.assertDominator(graph, 'rev3b', NULL_REVISION)
105
def test_dominators_extended_history_shortcut(self):
106
graph = self.make_known_graph(test_graph.extended_history_shortcut)
107
self.assertDominator(graph, 'a', NULL_REVISION)
108
self.assertDominator(graph, 'b', 'b')
109
self.assertDominator(graph, 'c', 'b')
110
self.assertDominator(graph, 'd', 'b')
111
self.assertDominator(graph, 'e', 'e')
112
self.assertDominator(graph, 'f', 'f')
114
87
def test_gdfo_ancestry_1(self):
115
88
graph = self.make_known_graph(test_graph.ancestry_1)
116
89
self.assertGDFO(graph, 'rev1', 2)