tests: explore some bdiff cases
authorMads Kiilerich <madski@unity3d.com>
Tue, 08 Nov 2016 18:37:33 +0100
changeset 30428 3743e5dbb824
parent 30427 ede7bc45bf0a
child 30429 38ed54888617
tests: explore some bdiff cases
tests/test-bdiff.py
tests/test-bdiff.py.out
--- a/tests/test-bdiff.py	Tue Nov 15 21:56:49 2016 +0100
+++ b/tests/test-bdiff.py	Tue Nov 08 18:37:33 2016 +0100
@@ -78,3 +78,17 @@
 testfixws("", "", 0)
 
 print("done")
+
+print("Odd diff for a trivial change:")
+showdiff(
+    ''.join('<%s\n-\n' % i for i in range(5)),
+    ''.join('>%s\n-\n' % i for i in range(5)))
+
+print("Diff 1 to 3 lines - preference for adding / removing at the end of sequences:")
+showdiff('a\n', 'a\n' * 3)
+print("Diff 1 to 5 lines - preference for adding / removing at the end of sequences:")
+showdiff('a\n', 'a\n' * 5)
+print("Diff 3 to 1 lines - preference for adding / removing at the end of sequences:")
+showdiff('a\n' * 3, 'a\n')
+print("Diff 5 to 1 lines - this diff seems weird:")
+showdiff('a\n' * 5, 'a\n')
--- a/tests/test-bdiff.py.out	Tue Nov 15 21:56:49 2016 +0100
+++ b/tests/test-bdiff.py.out	Tue Nov 08 18:37:33 2016 +0100
@@ -42,3 +42,41 @@
  'f\n'
 done
 done
+Odd diff for a trivial change:
+showdiff(
+  '<0\n-\n<1\n-\n<2\n-\n<3\n-\n<4\n-\n',
+  '>0\n-\n>1\n-\n>2\n-\n>3\n-\n>4\n-\n'):
+ 0 8 '<0\n-\n<1\n' -> '>0\n'
+ '-\n'
+ 10 13 '<2\n' -> '>1\n'
+ '-\n'
+ 15 18 '<3\n' -> '>2\n'
+ '-\n'
+ 20 23 '<4\n' -> '>3\n'
+ '-\n'
+ 25 25 '' -> '>4\n-\n'
+Diff 1 to 3 lines - preference for adding / removing at the end of sequences:
+showdiff(
+  'a\n',
+  'a\na\na\n'):
+ 'a\n'
+ 2 2 '' -> 'a\na\n'
+Diff 1 to 5 lines - preference for adding / removing at the end of sequences:
+showdiff(
+  'a\n',
+  'a\na\na\na\na\n'):
+ 'a\n'
+ 2 2 '' -> 'a\na\na\na\n'
+Diff 3 to 1 lines - preference for adding / removing at the end of sequences:
+showdiff(
+  'a\na\na\n',
+  'a\n'):
+ 'a\n'
+ 2 6 'a\na\n' -> ''
+Diff 5 to 1 lines - this diff seems weird:
+showdiff(
+  'a\na\na\na\na\n',
+  'a\n'):
+ 0 2 'a\n' -> ''
+ 'a\n'
+ 4 10 'a\na\na\n' -> ''