141 |
141 |
142 # todo: should use a sentinal at end as from get_matching_blocks |
142 # todo: should use a sentinal at end as from get_matching_blocks |
143 # to match without zz |
143 # to match without zz |
144 self.assertEquals(list(m3.find_sync_regions()), |
144 self.assertEquals(list(m3.find_sync_regions()), |
145 [(0, 1, 2, 3, 0, 1), |
145 [(0, 1, 2, 3, 0, 1), |
146 (1, 1, 3, 3, 1, 1),]) |
146 (1, 1, 3, 3, 1, 1)]) |
147 |
147 |
148 self.assertEquals(list(m3.merge_regions()), |
148 self.assertEquals(list(m3.merge_regions()), |
149 [('a', 0, 2), |
149 [('a', 0, 2), |
150 ('unchanged', 0, 1)]) |
150 ('unchanged', 0, 1)]) |
151 |
151 |
178 [(0, 1), (1, 2)]) |
178 [(0, 1), (1, 2)]) |
179 |
179 |
180 self.assertEquals(list(m3.find_sync_regions()), |
180 self.assertEquals(list(m3.find_sync_regions()), |
181 [(0, 1, 0, 1, 0, 1), |
181 [(0, 1, 0, 1, 0, 1), |
182 (1, 2, 2, 3, 1, 2), |
182 (1, 2, 2, 3, 1, 2), |
183 (2, 2, 3, 3, 2, 2),]) |
183 (2, 2, 3, 3, 2, 2)]) |
184 |
184 |
185 self.assertEquals(list(m3.merge_regions()), |
185 self.assertEquals(list(m3.merge_regions()), |
186 [('unchanged', 0, 1), |
186 [('unchanged', 0, 1), |
187 ('a', 1, 2), |
187 ('a', 1, 2), |
188 ('unchanged', 1, 2),]) |
188 ('unchanged', 1, 2)]) |
189 |
189 |
190 def test_append_a(self): |
190 def test_append_a(self): |
191 m3 = Merge3(['aaa\n', 'bbb\n'], |
191 m3 = Merge3(['aaa\n', 'bbb\n'], |
192 ['aaa\n', 'bbb\n', '222\n'], |
192 ['aaa\n', 'bbb\n', '222\n'], |
193 ['aaa\n', 'bbb\n']) |
193 ['aaa\n', 'bbb\n']) |
254 [(0, 1), (1, 2)]) |
254 [(0, 1), (1, 2)]) |
255 |
255 |
256 self.assertEquals(list(m3.find_sync_regions()), |
256 self.assertEquals(list(m3.find_sync_regions()), |
257 [(0, 1, 0, 1, 0, 1), |
257 [(0, 1, 0, 1, 0, 1), |
258 (1, 2, 2, 3, 2, 3), |
258 (1, 2, 2, 3, 2, 3), |
259 (2, 2, 3, 3, 3, 3),]) |
259 (2, 2, 3, 3, 3, 3)]) |
260 |
260 |
261 self.assertEquals(list(m3.merge_regions()), |
261 self.assertEquals(list(m3.merge_regions()), |
262 [('unchanged', 0, 1), |
262 [('unchanged', 0, 1), |
263 ('conflict', 1, 1, 1, 2, 1, 2), |
263 ('conflict', 1, 1, 1, 2, 1, 2), |
264 ('unchanged', 1, 2)]) |
264 ('unchanged', 1, 2)]) |
294 [(0, 1), (2, 3)]) |
294 [(0, 1), (2, 3)]) |
295 |
295 |
296 self.assertEquals(list(m3.find_sync_regions()), |
296 self.assertEquals(list(m3.find_sync_regions()), |
297 [(0, 1, 0, 1, 0, 1), |
297 [(0, 1, 0, 1, 0, 1), |
298 (2, 3, 2, 3, 2, 3), |
298 (2, 3, 2, 3, 2, 3), |
299 (3, 3, 3, 3, 3, 3),]) |
299 (3, 3, 3, 3, 3, 3)]) |
300 |
300 |
301 def test_replace_multi(self): |
301 def test_replace_multi(self): |
302 """Replacement with regions of different size.""" |
302 """Replacement with regions of different size.""" |
303 m3 = Merge3(['aaa', '000', '000', 'bbb'], |
303 m3 = Merge3(['aaa', '000', '000', 'bbb'], |
304 ['aaa', '111', '111', '111', 'bbb'], |
304 ['aaa', '111', '111', '111', 'bbb'], |