diff options
author | josh.macdonald <jmacd@users.noreply.github.com> | 2007-12-06 04:16:59 +0000 |
---|---|---|
committer | josh.macdonald <jmacd@users.noreply.github.com> | 2007-12-06 04:16:59 +0000 |
commit | 440ec9c30484dbb2cbd56b3762c4ba9961efcf22 (patch) | |
tree | 3c11a24422883f18ce79b7e8f2f383d528df0fe3 /xdelta3 | |
parent | 8ee35e6f26f054730333c824158464042518ff52 (diff) |
Adjust the low-end range for command_line_arguments unittest. I wish this
didn't depend on the system rand() function, but it's portable at least.
Diffstat (limited to 'xdelta3')
-rw-r--r-- | xdelta3/xdelta3-test.h | 14 | ||||
-rw-r--r-- | xdelta3/xdelta3.c | 15 |
2 files changed, 16 insertions, 13 deletions
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h index 1c46742..3b737e7 100644 --- a/xdelta3/xdelta3-test.h +++ b/xdelta3/xdelta3-test.h | |||
@@ -1680,7 +1680,7 @@ test_command_line_arguments (xd3_stream *stream, int ignore) | |||
1680 | return XD3_INTERNAL; | 1680 | return XD3_INTERNAL; |
1681 | } | 1681 | } |
1682 | 1682 | ||
1683 | if (ratio <= TEST_ADD_RATIO * (1.0 - TEST_EPSILON)) | 1683 | if (ratio <= TEST_ADD_RATIO * (1.0 - 2 * TEST_EPSILON)) |
1684 | { | 1684 | { |
1685 | DP(RINT "xdelta3: test encode with size ratio %.4f, " | 1685 | DP(RINT "xdelta3: test encode with size ratio %.4f, " |
1686 | "expected > %.4f\n", | 1686 | "expected > %.4f\n", |
@@ -2402,8 +2402,8 @@ static const string_match_test match_tests[] = | |||
2402 | { "123 23 XYZ 123 XYZ", SM_NONE, "C11/4@0" }, | 2402 | { "123 23 XYZ 123 XYZ", SM_NONE, "C11/4@0" }, |
2403 | { "123 23 XYZ 123 XYZ", SM_LAZY, "C11/4@0 C12/6@4" }, | 2403 | { "123 23 XYZ 123 XYZ", SM_LAZY, "C11/4@0 C12/6@4" }, |
2404 | 2404 | ||
2405 | /* trylazy: no lazy matches unless there are at least two characters beyond the first | 2405 | /* trylazy: no lazy matches unless there are at least two characters beyond |
2406 | * match */ | 2406 | * the first match */ |
2407 | { "2123_121212", SM_LAZY, "C7/4@5" }, | 2407 | { "2123_121212", SM_LAZY, "C7/4@5" }, |
2408 | { "2123_1212123", SM_LAZY, "C7/4@5" }, | 2408 | { "2123_1212123", SM_LAZY, "C7/4@5" }, |
2409 | { "2123_1212123_", SM_LAZY, "C7/4@5 C8/5@0" }, | 2409 | { "2123_1212123_", SM_LAZY, "C7/4@5 C8/5@0" }, |
@@ -2416,12 +2416,12 @@ static const string_match_test match_tests[] = | |||
2416 | /* lazy run: check a run overlapped by a longer copy */ | 2416 | /* lazy run: check a run overlapped by a longer copy */ |
2417 | { "11111112 111111112 1", SM_LAZY, "C1/6@0 R9/8 C10/10@0" }, | 2417 | { "11111112 111111112 1", SM_LAZY, "C1/6@0 R9/8 C10/10@0" }, |
2418 | 2418 | ||
2419 | /* lazy match: match_length,run_l >= min_match tests, shouldn't get any copies within | 2419 | /* lazy match: match_length,run_l >= min_match tests, shouldn't get any |
2420 | * the run, no run within the copy */ | 2420 | * copies within the run, no run within the copy */ |
2421 | { "^________^________ ", SM_LAZY, "R1/8 C9/9@0" }, | 2421 | { "^________^________ ", SM_LAZY, "R1/8 C9/9@0" }, |
2422 | 2422 | ||
2423 | /* chain depth: it only goes back 10. this checks that the 10th match hits and the 11th | 2423 | /* chain depth: it only goes back 10. this checks that the 10th match hits |
2424 | * misses. */ | 2424 | * and the 11th misses. */ |
2425 | { "1234 1234_1234-1234=1234+1234[1234]1234{1234}1234<1234 ", SM_NONE, | 2425 | { "1234 1234_1234-1234=1234+1234[1234]1234{1234}1234<1234 ", SM_NONE, |
2426 | "C5/4@0 C10/4@5 C15/4@10 C20/4@15 C25/4@20 C30/4@25 C35/4@30 C40/4@35 C45/4@40 C50/5@0" }, | 2426 | "C5/4@0 C10/4@5 C15/4@10 C20/4@15 C25/4@20 C30/4@25 C35/4@30 C40/4@35 C45/4@40 C50/5@0" }, |
2427 | { "1234 1234_1234-1234=1234+1234[1234]1234{1234}1234<1234>1234 ", SM_NONE, | 2427 | { "1234 1234_1234-1234=1234+1234[1234]1234{1234}1234<1234>1234 ", SM_NONE, |
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c index 0f8cf8d..826375f 100644 --- a/xdelta3/xdelta3.c +++ b/xdelta3/xdelta3.c | |||
@@ -1122,7 +1122,8 @@ xd3_choose_instruction (const xd3_code_table_desc *desc, xd3_rinst *prev, xd3_ri | |||
1122 | } | 1122 | } |
1123 | #else /* GENERIC_ENCODE_TABLES */ | 1123 | #else /* GENERIC_ENCODE_TABLES */ |
1124 | 1124 | ||
1125 | /* This version of xd3_choose_instruction is hard-coded for the default table. */ | 1125 | /* This version of xd3_choose_instruction is hard-coded for the default |
1126 | table. */ | ||
1126 | static void | 1127 | static void |
1127 | xd3_choose_instruction (xd3_rinst *prev, xd3_rinst *inst) | 1128 | xd3_choose_instruction (xd3_rinst *prev, xd3_rinst *inst) |
1128 | { | 1129 | { |
@@ -1303,9 +1304,10 @@ xd3_compute_alternate_table_encoding (xd3_stream *stream, const uint8_t **data, | |||
1303 | return ret; | 1304 | return ret; |
1304 | } | 1305 | } |
1305 | 1306 | ||
1306 | /* During development of a new code table, enable this variable to print the new | 1307 | /* During development of a new code table, enable this variable to print |
1307 | * static contents and determine its size. At run time the table will be filled in | 1308 | * the new static contents and determine its size. At run time the |
1308 | * appropriately, but at least it should have the proper size beforehand. */ | 1309 | * table will be filled in appropriately, but at least it should have |
1310 | * the proper size beforehand. */ | ||
1309 | #if GENERIC_ENCODE_TABLES_COMPUTE_PRINT | 1311 | #if GENERIC_ENCODE_TABLES_COMPUTE_PRINT |
1310 | { | 1312 | { |
1311 | int i; | 1313 | int i; |
@@ -1337,8 +1339,9 @@ xd3_compute_alternate_table_encoding (xd3_stream *stream, const uint8_t **data, | |||
1337 | 1339 | ||
1338 | #endif /* XD3_ENCODER */ | 1340 | #endif /* XD3_ENCODER */ |
1339 | 1341 | ||
1340 | /* This function generates the 1536-byte string specified in sections 5.4 and 7 of | 1342 | /* This function generates the 1536-byte string specified in sections 5.4 and |
1341 | * rfc3284, which is used to represent a code table within a VCDIFF file. */ | 1343 | * 7 of rfc3284, which is used to represent a code table within a VCDIFF |
1344 | * file. */ | ||
1342 | void xd3_compute_code_table_string (const xd3_dinst *code_table, uint8_t *str) | 1345 | void xd3_compute_code_table_string (const xd3_dinst *code_table, uint8_t *str) |
1343 | { | 1346 | { |
1344 | int i, s; | 1347 | int i, s; |