~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_multiparent.py

merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
                          multiparent.ParentText(0, 1, 2, 3)],
50
50
                         diff.hunks)
51
51
 
 
52
        diff = multiparent.MultiParent.from_lines(LINES_2, [LINES_1])
 
53
        self.assertEqual([multiparent.ParentText(0, 0, 0, 1),
 
54
                          multiparent.ParentText(0, 2, 1, 3)],
 
55
                         diff.hunks)
 
56
 
52
57
    def test_compare_two_parents(self):
53
58
        diff = multiparent.MultiParent.from_lines(LINES_1, [LINES_2, LINES_3])
54
59
        self.assertEqual([multiparent.ParentText(1, 0, 0, 4),
64
69
                          multiparent.ParentText(0, 3, 4, 1)],
65
70
                         diff.hunks)
66
71
 
 
72
    def test_get_matching_blocks(self):
 
73
        diff = multiparent.MultiParent.from_lines(LINES_1, [LINES_2])
 
74
        self.assertEqual([(0, 0, 1), (1, 2, 3), (4, 5, 0)],
 
75
                         list(diff.get_matching_blocks(0, len(LINES_2))))
 
76
 
 
77
        diff = multiparent.MultiParent.from_lines(LINES_2, [LINES_1])
 
78
        self.assertEqual([(0, 0, 1), (2, 1, 3), (5, 4, 0)],
 
79
                         list(diff.get_matching_blocks(0, len(LINES_1))))
 
80
 
67
81
    def test_range_iterator(self):
68
82
        diff = multiparent.MultiParent.from_lines(LINES_1, [LINES_2, LINES_3])
69
83
        diff.hunks.append(multiparent.NewText(['q\n']))