aboutsummaryrefslogtreecommitdiff
path: root/tests/test_block_header.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-11-19 20:46:52 +0200
committerLasse Collin <lasse.collin@tukaani.org>2008-11-19 20:46:52 +0200
commite114502b2bc371e4a45449832cb69be036360722 (patch)
tree449c41d0408f99926de202611091747f1fbe2f85 /tests/test_block_header.c
parentFixed the test that should have been fixed as part (diff)
downloadxz-e114502b2bc371e4a45449832cb69be036360722.tar.xz
Oh well, big messy commit again. Some highlights:
- Updated to the latest, probably final file format version. - Command line tool reworked to not use threads anymore. Threading will probably go into liblzma anyway. - Memory usage limit is now about 30 % for uncompression and about 90 % for compression. - Progress indicator with --verbose - Simplified --help and full --long-help - Upgraded to the last LGPLv2.1+ getopt_long from gnulib. - Some bug fixes
Diffstat (limited to 'tests/test_block_header.c')
-rw-r--r--tests/test_block_header.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/test_block_header.c b/tests/test_block_header.c
index 4d398095..5c0f8b9a 100644
--- a/tests/test_block_header.c
+++ b/tests/test_block_header.c
@@ -89,7 +89,7 @@ code(void)
{
expect(lzma_block_header_encode(&known_options, buf) == LZMA_OK);
- lzma_filter filters[LZMA_BLOCK_FILTERS_MAX + 1];
+ lzma_filter filters[LZMA_FILTERS_MAX + 1];
memcrap(filters, sizeof(filters));
memcrap(&decoded_options, sizeof(decoded_options));
@@ -108,7 +108,7 @@ code(void)
!= LZMA_VLI_UNKNOWN; ++i)
expect(known_options.filters[i].id == filters[i].id);
- for (size_t i = 0; i < LZMA_BLOCK_FILTERS_MAX; ++i)
+ for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i)
free(decoded_options.filters[i].options);
}
@@ -137,12 +137,18 @@ test1(void)
known_options.check = 999; // Some invalid value, which gets ignored.
expect(lzma_block_header_size(&known_options) == LZMA_OK);
- known_options.compressed_size = 5; // Not a multiple of four.
- expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
+ known_options.compressed_size = 5;
+ expect(lzma_block_header_size(&known_options) == LZMA_OK);
known_options.compressed_size = 0; // Cannot be zero.
expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
+ // LZMA_VLI_MAX is too big to keep the total size of the Block
+ // a valid VLI, but lzma_block_header_size() is not meant
+ // to validate it. (lzma_block_header_encode() must validate it.)
+ known_options.compressed_size = LZMA_VLI_MAX;
+ expect(lzma_block_header_size(&known_options) == LZMA_OK);
+
known_options.compressed_size = LZMA_VLI_UNKNOWN;
known_options.uncompressed_size = 0;
expect(lzma_block_header_size(&known_options) == LZMA_OK);
@@ -192,7 +198,7 @@ test3(void)
known_options.header_size += 4;
expect(lzma_block_header_encode(&known_options, buf) == LZMA_OK);
- lzma_filter filters[LZMA_BLOCK_FILTERS_MAX + 1];
+ lzma_filter filters[LZMA_FILTERS_MAX + 1];
decoded_options.header_size = known_options.header_size;
decoded_options.check = known_options.check;
decoded_options.filters = filters;