comparison tests/test-bdiff @ 400:8b067bde6679

Add a fast binary diff extension (not yet used) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Add a fast binary diff extension (not yet used) manifest hash: fbfdcab2b1f4856af45176fcf2423d602dfe88c4 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCuL6eywK+sNU5EO8RAoT+AJ95z9gx2IrucBS30CnCQFkZT7lSbgCgnXh5 ScZcgwzJ/mEo9i5vuKNlCIs= =Gr58 -----END PGP SIGNATURE-----
author mpm@selenic.com
date Tue, 21 Jun 2005 17:27:58 -0800
parents
children ec85f9e6f3b1 8f5637f0a0c0 0902ffece4b4
comparison
equal deleted inserted replaced
399:f060d728fe54 400:8b067bde6679
1 #!/usr/bin/env python
2
3 import sys
4 from mercurial import bdiff, mpatch
5
6 def test1(a, b):
7 d = bdiff.bdiff(a, b)
8 c = a
9 if d:
10 c = mpatch.patches(a, [d])
11 if c != b:
12 print "***", `a`, `b`
13 print "bad:"
14 print `c`[:200]
15 print `d`
16
17 def test(a, b):
18 print "***", `a`, `b`
19 test1(a, b)
20 test1(b, a)
21
22 test("a\nc\n\n\n\n", "a\nb\n\n\n")
23 test("a\nb\nc\n", "a\nc\n")
24 test("", "")
25 test("a\nb\nc", "a\nb\nc")
26 test("a\nb\nc\nd\n", "a\nd\n")
27 test("a\nb\nc\nd\n", "a\nc\ne\n")
28 test("a\nb\nc\n", "a\nc\n")
29 test("a\n", "c\na\nb\n")
30 test("a\n", "")
31 test("a\n", "b\nc\n")
32 test("a\n", "c\na\n")
33 test("", "adjfkjdjksdhfksj")
34 test("", "ab")
35 test("", "abc")
36 test("a", "a")
37 test("ab", "ab")
38 test("abc", "abc")
39 test("a\n", "a\n")
40 test("a\nb", "a\nb")
41
42 print "done"