]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
Tests: test_index: Edit a misleading test
authorLasse Collin <lasse.collin@tukaani.org>
Sat, 27 Apr 2024 15:30:40 +0000 (18:30 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Tue, 21 May 2024 21:12:07 +0000 (00:12 +0300)
(cherry picked from commit d879686469c9c4bf2a7c0bb6420ebe4530fc8f07)

tests/test_index.c

index 0eb10206c83c693f6a6a49d0d2637c44ad580e05..b9726bc2e6c0387b4ec60663886b68b92917dd79 100644 (file)
@@ -44,8 +44,11 @@ test_lzma_index_memusage(void)
        assert_uint_eq(lzma_index_memusage((lzma_vli)UINT32_MAX + 1, 1),
                        UINT64_MAX);
 
-       // The maximum number of Blocks should be LZMA_VLI_MAX
-       assert_uint_eq(lzma_index_memusage(1, LZMA_VLI_MAX), UINT64_MAX);
+       // While the number of blocks is lzma_vli, the real maximum value is
+       // much smaller than LZMA_VLI_MAX. Just check that it fails with a
+       // huge but valid VLI and that it succeeds with a smaller one.
+       assert_uint_eq(lzma_index_memusage(1, LZMA_VLI_MAX / 5), UINT64_MAX);
+       assert_uint(lzma_index_memusage(1, LZMA_VLI_MAX / 11), <, UINT64_MAX);
 
        // Number of Streams must be non-zero
        assert_uint_eq(lzma_index_memusage(0, 1), UINT64_MAX);