1#
2# Copyright (c) 2006 D. Richard Hipp
3#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the Simplified BSD License (also
6# known as the "2-Clause License" or "FreeBSD License".)
7#
8# This program is distributed in the hope that it will be useful,
9# but without any warranty; without even the implied warranty of
10# merchantability or fitness for a particular purpose.
11#
12# Author contact information:
13#   drh@hwaci.com
14#   http://www.hwaci.com/drh/
15#
16############################################################################
17#
18# Tests of the 3-way merge
19#
20
21test_setup ""
22
23write_file_indented t1 {
24  111 - This is line one of the demo program - 1111
25  222 - The second line program line in code - 2222
26  333 - This is a test of the merging algohm - 3333
27  444 - If all goes well, we will be pleased - 4444
28  555 - we think it well and other stuff too - 5555
29}
30write_file_indented t2 {
31  111 - This is line ONE of the demo program - 1111
32  222 - The second line program line in code - 2222
33  333 - This is a test of the merging algohm - 3333
34  444 - If all goes well, we will be pleased - 4444
35  555 - we think it well and other stuff too - 5555
36}
37write_file_indented t3 {
38  111 - This is line one of the demo program - 1111
39  222 - The second line program line in code - 2222
40  333 - This is a test OF THE merging algohm - 3333
41  444 - If all goes well, we will be pleased - 4444
42  555 - we think it well and other stuff too - 5555
43}
44write_file_indented t23 {
45  111 - This is line ONE of the demo program - 1111
46  222 - The second line program line in code - 2222
47  333 - This is a test OF THE merging algohm - 3333
48  444 - If all goes well, we will be pleased - 4444
49  555 - we think it well and other stuff too - 5555
50}
51fossil 3-way-merge t1 t3 t2 a32
52test merge1-1.1 {[same_file t23 a32]}
53fossil 3-way-merge t1 t2 t3 a23
54test merge1-1.2 {[same_file t23 a23]}
55
56write_file_indented t1 {
57  111 - This is line one of the demo program - 1111
58  222 - The second line program line in code - 2222
59  333 - This is a test of the merging algohm - 3333
60  444 - If all goes well, we will be pleased - 4444
61  555 - we think it well and other stuff too - 5555
62}
63write_file_indented t2 {
64  111 - This is line ONE of the demo program - 1111
65  222 - The second line program line in code - 2222
66  333 - This is a test of the merging algohm - 3333
67  444 - If all goes well, we will be pleased - 4444
68  555 - we think it well and other stuff too - 5555
69}
70write_file_indented t3 {
71  111 - This is line one OF the demo program - 1111
72  222 - The second line program line in code - 2222
73  333 - This is a test of the merging algohm - 3333
74  444 - If all goes well, we will be pleased - 4444
75  555 - we think it well and other stuff too - 5555
76}
77write_file_indented t23 {
78  <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<
79  111 - This is line ONE of the demo program - 1111
80  ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||||||
81  111 - This is line one of the demo program - 1111
82  ======= MERGED IN content follows ==================================
83  111 - This is line one OF the demo program - 1111
84  >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
85  222 - The second line program line in code - 2222
86  333 - This is a test of the merging algohm - 3333
87  444 - If all goes well, we will be pleased - 4444
88  555 - we think it well and other stuff too - 5555
89}
90write_file_indented t32 {
91  <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<
92  111 - This is line one OF the demo program - 1111
93  ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||||||
94  111 - This is line one of the demo program - 1111
95  ======= MERGED IN content follows ==================================
96  111 - This is line ONE of the demo program - 1111
97  >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
98  222 - The second line program line in code - 2222
99  333 - This is a test of the merging algohm - 3333
100  444 - If all goes well, we will be pleased - 4444
101  555 - we think it well and other stuff too - 5555
102}
103fossil 3-way-merge t1 t3 t2 a32
104test merge1-2.1 {[same_file t32 a32]}
105fossil 3-way-merge t1 t2 t3 a23
106test merge1-2.2 {[same_file t23 a23]}
107
108write_file_indented t1 {
109  111 - This is line one of the demo program - 1111
110  222 - The second line program line in code - 2222
111  333 - This is a test of the merging algohm - 3333
112  444 - If all goes well, we will be pleased - 4444
113  555 - we think it well and other stuff too - 5555
114}
115write_file_indented t2 {
116  111 - This is line ONE of the demo program - 1111
117  222 - The second line program line in code - 2222
118  333 - This is a test of the merging algohm - 3333
119  444 - If all goes well, we will be pleased - 4444
120  555 - we think it well and other stuff too - 5555
121}
122write_file_indented t3 {
123  111 - This is line ONE of the demo program - 1111
124  222 - The second line program line in code - 2222
125  333 - This is a test of the merging algohm - 3333
126  444 - If all goes well, we will be pleased - 4444
127  555 - we think it well and other stuff too - 5555
128}
129write_file_indented t23 {
130  111 - This is line ONE of the demo program - 1111
131  222 - The second line program line in code - 2222
132  333 - This is a test of the merging algohm - 3333
133  444 - If all goes well, we will be pleased - 4444
134  555 - we think it well and other stuff too - 5555
135}
136fossil 3-way-merge t1 t3 t2 a32
137test merge1-3.1 {[same_file t23 a32]}
138fossil 3-way-merge t1 t2 t3 a23
139test merge1-3.2 {[same_file t23 a23]}
140
141write_file_indented t1 {
142  111 - This is line one of the demo program - 1111
143  222 - The second line program line in code - 2222
144  333 - This is a test of the merging algohm - 3333
145  444 - If all goes well, we will be pleased - 4444
146  555 - we think it well and other stuff too - 5555
147}
148write_file_indented t2 {
149  000 - Zero lines added to the beginning of - 0000
150  111 - This is line one of the demo program - 1111
151  222 - The second line program line in code - 2222
152  333 - This is a test of the merging algohm - 3333
153  444 - If all goes well, we will be pleased - 4444
154  555 - we think it well and other stuff too - 5555
155}
156write_file_indented t3 {
157  222 - The second line program line in code - 2222
158  333 - This is a test of the merging algohm - 3333
159  444 - If all goes well, we will be pleased - 4444
160  555 - we think it well and other stuff too - 5555
161}
162write_file_indented t32 {
163  <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<
164  ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||||||
165  111 - This is line one of the demo program - 1111
166  ======= MERGED IN content follows ==================================
167  000 - Zero lines added to the beginning of - 0000
168  111 - This is line one of the demo program - 1111
169  >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
170  222 - The second line program line in code - 2222
171  333 - This is a test of the merging algohm - 3333
172  444 - If all goes well, we will be pleased - 4444
173  555 - we think it well and other stuff too - 5555
174}
175write_file_indented t23 {
176  <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<
177  000 - Zero lines added to the beginning of - 0000
178  111 - This is line one of the demo program - 1111
179  ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||||||
180  111 - This is line one of the demo program - 1111
181  ======= MERGED IN content follows ==================================
182  >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
183  222 - The second line program line in code - 2222
184  333 - This is a test of the merging algohm - 3333
185  444 - If all goes well, we will be pleased - 4444
186  555 - we think it well and other stuff too - 5555
187}
188fossil 3-way-merge t1 t3 t2 a32
189test merge1-4.1 {[same_file t32 a32]}
190fossil 3-way-merge t1 t2 t3 a23
191test merge1-4.2 {[same_file t23 a23]}
192
193write_file_indented t1 {
194  111 - This is line one of the demo program - 1111
195  222 - The second line program line in code - 2222
196  333 - This is a test of the merging algohm - 3333
197  444 - If all goes well, we will be pleased - 4444
198  555 - we think it well and other stuff too - 5555
199}
200write_file_indented t2 {
201  111 - This is line one of the demo program - 1111
202  222 - The second line program line in code - 2222
203  333 - This is a test of the merging algohm - 3333
204  444 - If all goes well, we will be pleased - 4444
205  555 - we think it well and other stuff too - 5555
206  666 - Extra line at the end of the file wi - 6666
207}
208write_file_indented t3 {
209  222 - The second line program line in code - 2222
210  333 - This is a test of the merging algohm - 3333
211  444 - If all goes well, we will be pleased - 4444
212  555 - we think it well and other stuff too - 5555
213}
214write_file_indented t32 {
215  222 - The second line program line in code - 2222
216  333 - This is a test of the merging algohm - 3333
217  444 - If all goes well, we will be pleased - 4444
218  555 - we think it well and other stuff too - 5555
219  666 - Extra line at the end of the file wi - 6666
220}
221fossil 3-way-merge t1 t3 t2 a32
222test merge1-5.1 {[same_file t32 a32]}
223fossil 3-way-merge t1 t2 t3 a23
224test merge1-5.2 {[same_file t32 a23]}
225
226write_file_indented t1 {
227  111 - This is line one of the demo program - 1111
228  222 - The second line program line in code - 2222
229  333 - This is a test of the merging algohm - 3333
230  444 - If all goes well, we will be pleased - 4444
231  555 - we think it well and other stuff too - 5555
232}
233write_file_indented t2 {
234  111 - This is line one of the demo program - 1111
235  333 - This is a test of the merging algohm - 3333
236  444 - If all goes well, we will be pleased - 4444
237  555 - we think it well and other stuff too - 5555
238}
239write_file_indented t3 {
240  111 - This is line one of the demo program - 1111
241  222 - The second line program line in code - 2222
242  333 - This is a test of the merging algohm - 3333
243  555 - we think it well and other stuff too - 5555
244}
245write_file_indented t32 {
246  111 - This is line one of the demo program - 1111
247  333 - This is a test of the merging algohm - 3333
248  555 - we think it well and other stuff too - 5555
249}
250fossil 3-way-merge t1 t3 t2 a32
251test merge1-6.1 {[same_file t32 a32]}
252fossil 3-way-merge t1 t2 t3 a23
253test merge1-6.2 {[same_file t32 a23]}
254
255write_file_indented t1 {
256  abcd
257  efgh
258  ijkl
259  mnop
260  qrst
261  uvwx
262  yzAB
263  CDEF
264  GHIJ
265  KLMN
266  OPQR
267  STUV
268  XYZ.
269}
270write_file_indented t2 {
271  abcd
272  efgh 2
273  ijkl 2
274  mnop 2
275  qrst
276  uvwx
277  yzAB 2
278  CDEF 2
279  GHIJ 2
280  KLMN
281  OPQR
282  STUV
283  XYZ.
284}
285write_file_indented t3 {
286  abcd
287  efgh
288  ijkl
289  mnop 3
290  qrst 3
291  uvwx 3
292  yzAB 3
293  CDEF
294  GHIJ
295  KLMN
296  OPQR
297  STUV
298  XYZ.
299}
300write_file_indented t23 {
301  abcd
302  <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<
303  efgh 2
304  ijkl 2
305  mnop 2
306  qrst
307  uvwx
308  yzAB 2
309  CDEF 2
310  GHIJ 2
311  ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||||||
312  efgh
313  ijkl
314  mnop
315  qrst
316  uvwx
317  yzAB
318  CDEF
319  GHIJ
320  ======= MERGED IN content follows ==================================
321  efgh
322  ijkl
323  mnop 3
324  qrst 3
325  uvwx 3
326  yzAB 3
327  CDEF
328  GHIJ
329  >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
330  KLMN
331  OPQR
332  STUV
333  XYZ.
334}
335fossil 3-way-merge t1 t2 t3 a23
336test merge1-7.1 {[same_file t23 a23]}
337
338write_file_indented t2 {
339  abcd
340  efgh 2
341  ijkl 2
342  mnop
343  qrst
344  uvwx
345  yzAB 2
346  CDEF 2
347  GHIJ 2
348  KLMN
349  OPQR
350  STUV
351  XYZ.
352}
353write_file_indented t3 {
354  abcd
355  efgh
356  ijkl
357  mnop 3
358  qrst 3
359  uvwx 3
360  yzAB 3
361  CDEF
362  GHIJ
363  KLMN
364  OPQR
365  STUV
366  XYZ.
367}
368write_file_indented t23 {
369  abcd
370  <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<
371  efgh 2
372  ijkl 2
373  mnop
374  qrst
375  uvwx
376  yzAB 2
377  CDEF 2
378  GHIJ 2
379  ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||||||
380  efgh
381  ijkl
382  mnop
383  qrst
384  uvwx
385  yzAB
386  CDEF
387  GHIJ
388  ======= MERGED IN content follows ==================================
389  efgh
390  ijkl
391  mnop 3
392  qrst 3
393  uvwx 3
394  yzAB 3
395  CDEF
396  GHIJ
397  >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
398  KLMN
399  OPQR
400  STUV
401  XYZ.
402}
403fossil 3-way-merge t1 t2 t3 a23
404test merge1-7.2 {[same_file t23 a23]}
405
406###############################################################################
407
408test_cleanup
409