summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3-test.py
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3/xdelta3-test.py')
-rwxr-xr-xxdelta3/xdelta3-test.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/xdelta3/xdelta3-test.py b/xdelta3/xdelta3-test.py
index 7ad25dd..2c37030 100755
--- a/xdelta3/xdelta3-test.py
+++ b/xdelta3/xdelta3-test.py
@@ -33,7 +33,7 @@ assert len(patch) < len(source)
33 33
34print 'encode: adler32 ...' 34print 'encode: adler32 ...'
35result, patch_adler32 = xdelta3.xd3_encode_memory(target, source, 50, 35result, patch_adler32 = xdelta3.xd3_encode_memory(target, source, 50,
36 1<<10) 36 xdelta3.XD3_ADLER32)
37 37
38assert result == 0 38assert result == 0
39assert len(patch_adler32) < len(source) 39assert len(patch_adler32) < len(source)
@@ -41,7 +41,7 @@ assert len(patch_adler32) > len(patch)
41 41
42print 'encode: secondary ...' 42print 'encode: secondary ...'
43result, patch_djw = xdelta3.xd3_encode_memory(target, source, 50, 43result, patch_djw = xdelta3.xd3_encode_memory(target, source, 50,
44 1<<5) 44 xdelta3.XD3_SEC_DJW)
45 45
46assert result == 0 46assert result == 0
47# secondary compression doesn't help 47# secondary compression doesn't help
@@ -111,7 +111,7 @@ for corrupt_pos in range(len(patch_adler32)):
111 # without adler32 verification, the error may be in the data section which 111 # without adler32 verification, the error may be in the data section which
112 # in this case is 6 bytes 'target' 112 # in this case is 6 bytes 'target'
113 result, corrupt = xdelta3.xd3_decode_memory(input, source, len(target), 113 result, corrupt = xdelta3.xd3_decode_memory(input, source, len(target),
114 1<<11) 114 xdelta3.XD3_ADLER32_NOVER)
115 if result == 0: 115 if result == 0:
116 noverify_count = noverify_count + 1 116 noverify_count = noverify_count + 1
117 #print "got %s" % corrupt 117 #print "got %s" % corrupt
@@ -125,6 +125,22 @@ result, target2 = xdelta3.xd3_decode_memory(zdata, None, len(target))
125assert result == 0 125assert result == 0
126assert target == target2 126assert target == target2
127 127
128# Test compression level setting via flags. assumes a 9 byte checksum
129# and that level 9 steps 2, level 1 steps 15:
130# 01234567890123456789012345678901
131# level 1 only indexes 2 checksums "abcdefghi" and "ABCDEFGHI"
132# outputs 43 vs. 23 bytes
133print 'encode: compression level ...'
134
135source = '_la_la_abcdefghi_la_la_ABCDEFGHI'
136target = 'la_la_ABCDEFGH__la_la_abcdefgh__'
137
138result1, level1 = xdelta3.xd3_encode_memory(target, source, 50, xdelta3.XD3_COMPLEVEL_1)
139result9, level9 = xdelta3.xd3_encode_memory(target, source, 50, xdelta3.XD3_COMPLEVEL_9)
140
141assert result1 == 0 and result9 == 0
142assert len(level1) > len(level9)
143
128# 144#
129# 145#
130 146