diff options
Diffstat (limited to 'xdelta3/xdelta3-test.py')
-rwxr-xr-x | xdelta3/xdelta3-test.py | 22 |
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 | ||
34 | print 'encode: adler32 ...' | 34 | print 'encode: adler32 ...' |
35 | result, patch_adler32 = xdelta3.xd3_encode_memory(target, source, 50, | 35 | result, patch_adler32 = xdelta3.xd3_encode_memory(target, source, 50, |
36 | 1<<10) | 36 | xdelta3.XD3_ADLER32) |
37 | 37 | ||
38 | assert result == 0 | 38 | assert result == 0 |
39 | assert len(patch_adler32) < len(source) | 39 | assert len(patch_adler32) < len(source) |
@@ -41,7 +41,7 @@ assert len(patch_adler32) > len(patch) | |||
41 | 41 | ||
42 | print 'encode: secondary ...' | 42 | print 'encode: secondary ...' |
43 | result, patch_djw = xdelta3.xd3_encode_memory(target, source, 50, | 43 | result, patch_djw = xdelta3.xd3_encode_memory(target, source, 50, |
44 | 1<<5) | 44 | xdelta3.XD3_SEC_DJW) |
45 | 45 | ||
46 | assert result == 0 | 46 | assert 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)) | |||
125 | assert result == 0 | 125 | assert result == 0 |
126 | assert target == target2 | 126 | assert 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 | ||
133 | print 'encode: compression level ...' | ||
134 | |||
135 | source = '_la_la_abcdefghi_la_la_ABCDEFGHI' | ||
136 | target = 'la_la_ABCDEFGH__la_la_abcdefgh__' | ||
137 | |||
138 | result1, level1 = xdelta3.xd3_encode_memory(target, source, 50, xdelta3.XD3_COMPLEVEL_1) | ||
139 | result9, level9 = xdelta3.xd3_encode_memory(target, source, 50, xdelta3.XD3_COMPLEVEL_9) | ||
140 | |||
141 | assert result1 == 0 and result9 == 0 | ||
142 | assert len(level1) > len(level9) | ||
143 | |||
128 | # | 144 | # |
129 | # | 145 | # |
130 | 146 | ||