tests/test-bdiff.py.out
author Gregory Szorc <gregory.szorc@gmail.com>
Fri, 25 Nov 2016 09:59:39 -0800
changeset 30550 342d0cb4f446
parent 30442 96f2f50d923f
child 30566 7c0c722d568d
permissions -rw-r--r--
debugcommands: sort command order The diff is a bit large but it is straight code moving without any logical modifications.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30436
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
     1
test 'a\nc\n\n\n\n' 'a\nb\n\n\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
     2
test 'a\nb\nc\n' 'a\nc\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
     3
test '' ''
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
     4
test 'a\nb\nc' 'a\nb\nc'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
     5
test 'a\nb\nc\nd\n' 'a\nd\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
     6
test 'a\nb\nc\nd\n' 'a\nc\ne\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
     7
test 'a\nb\nc\n' 'a\nc\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
     8
test 'a\n' 'c\na\nb\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
     9
test 'a\n' ''
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    10
test 'a\n' 'b\nc\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    11
test 'a\n' 'c\na\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    12
test '' 'adjfkjdjksdhfksj'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    13
test '' 'ab'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    14
test '' 'abc'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    15
test 'a' 'a'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    16
test 'ab' 'ab'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    17
test 'abc' 'abc'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    18
test 'a\n' 'a\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    19
test 'a\nb' 'a\nb'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    20
showdiff(
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    21
  'x\n\nx\n\nx\n\nx\n\nz\n',
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    22
  'x\n\nx\n\ny\n\nx\n\nx\n\nz\n'):
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    23
 'x\n\nx\n\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    24
 6 6 '' -> 'y\n\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    25
 'x\n\nx\n\nz\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    26
showdiff(
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    27
  'x\n\nx\n\nx\n\nx\n\nz\n',
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    28
  'x\n\nx\n\ny\n\nx\n\ny\n\nx\n\nz\n'):
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    29
 'x\n\nx\n\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    30
 6 6 '' -> 'y\n\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    31
 'x\n\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    32
 9 9 '' -> 'y\n\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    33
 'x\n\nz\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    34
showdiff(
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    35
  'a\nb\nb\nb\nc\n.\nd\ne\n.\nf\n',
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    36
  'a\nb\nb\na\nb\nb\nb\nc\n.\nb\nc\n.\nd\ne\nf\n'):
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    37
 0 0 '' -> 'a\nb\nb\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    38
 'a\nb\nb\nb\nc\n.\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    39
 12 12 '' -> 'b\nc\n.\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    40
 'd\ne\n'
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    41
 16 18 '.\n' -> ''
ede7bc45bf0a tests: make test-bdiff.py easier to maintain
Mads Kiilerich <madski@unity3d.com>
parents: 29013
diff changeset
    42
 'f\n'
400
8b067bde6679 Add a fast binary diff extension (not yet used)
mpm@selenic.com
parents:
diff changeset
    43
done
15530
eeac5e179243 mdiff: replace wscleanup() regexps with C loops
Patrick Mezard <pmezard@gmail.com>
parents: 8449
diff changeset
    44
done
30440
8c0c75aa3ff4 bdiff: give slight preference to longest matches in the middle of the B side
Mads Kiilerich <madski@unity3d.com>
parents: 30438
diff changeset
    45
Nice diff for a trivial change:
30437
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    46
showdiff(
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    47
  '<0\n-\n<1\n-\n<2\n-\n<3\n-\n<4\n-\n',
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    48
  '>0\n-\n>1\n-\n>2\n-\n>3\n-\n>4\n-\n'):
30440
8c0c75aa3ff4 bdiff: give slight preference to longest matches in the middle of the B side
Mads Kiilerich <madski@unity3d.com>
parents: 30438
diff changeset
    49
 0 3 '<0\n' -> '>0\n'
30437
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    50
 '-\n'
30440
8c0c75aa3ff4 bdiff: give slight preference to longest matches in the middle of the B side
Mads Kiilerich <madski@unity3d.com>
parents: 30438
diff changeset
    51
 5 8 '<1\n' -> '>1\n'
8c0c75aa3ff4 bdiff: give slight preference to longest matches in the middle of the B side
Mads Kiilerich <madski@unity3d.com>
parents: 30438
diff changeset
    52
 '-\n'
8c0c75aa3ff4 bdiff: give slight preference to longest matches in the middle of the B side
Mads Kiilerich <madski@unity3d.com>
parents: 30438
diff changeset
    53
 10 13 '<2\n' -> '>2\n'
30437
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    54
 '-\n'
30440
8c0c75aa3ff4 bdiff: give slight preference to longest matches in the middle of the B side
Mads Kiilerich <madski@unity3d.com>
parents: 30438
diff changeset
    55
 15 18 '<3\n' -> '>3\n'
30437
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    56
 '-\n'
30440
8c0c75aa3ff4 bdiff: give slight preference to longest matches in the middle of the B side
Mads Kiilerich <madski@unity3d.com>
parents: 30438
diff changeset
    57
 20 23 '<4\n' -> '>4\n'
30437
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    58
 '-\n'
30441
3633403888ae bdiff: give slight preference to appending lines
Mads Kiilerich <madski@unity3d.com>
parents: 30440
diff changeset
    59
Diff 1 to 3 lines - preference for appending:
30437
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    60
showdiff(
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    61
  'a\n',
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    62
  'a\na\na\n'):
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    63
 'a\n'
30441
3633403888ae bdiff: give slight preference to appending lines
Mads Kiilerich <madski@unity3d.com>
parents: 30440
diff changeset
    64
 2 2 '' -> 'a\na\n'
3633403888ae bdiff: give slight preference to appending lines
Mads Kiilerich <madski@unity3d.com>
parents: 30440
diff changeset
    65
Diff 1 to 5 lines - preference for appending:
30437
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    66
showdiff(
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    67
  'a\n',
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    68
  'a\na\na\na\na\n'):
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    69
 'a\n'
30441
3633403888ae bdiff: give slight preference to appending lines
Mads Kiilerich <madski@unity3d.com>
parents: 30440
diff changeset
    70
 2 2 '' -> 'a\na\na\na\n'
30442
96f2f50d923f bdiff: give slight preference to removing trailing lines
Mads Kiilerich <madski@unity3d.com>
parents: 30441
diff changeset
    71
Diff 3 to 1 lines - preference for removing trailing lines:
30437
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    72
showdiff(
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    73
  'a\na\na\n',
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    74
  'a\n'):
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    75
 'a\n'
30442
96f2f50d923f bdiff: give slight preference to removing trailing lines
Mads Kiilerich <madski@unity3d.com>
parents: 30441
diff changeset
    76
 2 6 'a\na\n' -> ''
96f2f50d923f bdiff: give slight preference to removing trailing lines
Mads Kiilerich <madski@unity3d.com>
parents: 30441
diff changeset
    77
Diff 5 to 1 lines - preference for removing trailing lines:
30437
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    78
showdiff(
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    79
  'a\na\na\na\na\n',
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    80
  'a\n'):
3743e5dbb824 tests: explore some bdiff cases
Mads Kiilerich <madski@unity3d.com>
parents: 30436
diff changeset
    81
 'a\n'
30442
96f2f50d923f bdiff: give slight preference to removing trailing lines
Mads Kiilerich <madski@unity3d.com>
parents: 30441
diff changeset
    82
 2 10 'a\na\na\na\n' -> ''