Commit 2187b27c for xz
commit 2187b27c64ef23d6ffa2917c8d835e100969e3e6
Author: Lasse Collin <lasse.collin@tukaani.org>
Date: Mon Jul 20 20:00:06 2026 +0300
Tests: test_index: Fix testing of _locate() with concatenated lzma_index
diff --git a/tests/test_index.c b/tests/test_index.c
index 5501332e..d195fc17 100644
--- a/tests/test_index.c
+++ b/tests/test_index.c
@@ -1175,6 +1175,17 @@ test_lzma_index_iter_locate(void)
LZMA_STREAM_HEADER_SIZE + group_multiple * 8);
assert_uint_eq(iter.block.uncompressed_file_offset, 0);
+ lzma_index *idx2 = lzma_index_init(NULL);
+ assert_true(idx != NULL);
+ assert_lzma_ret(lzma_index_append(idx2, NULL, 16, 1), LZMA_OK);
+ assert_lzma_ret(lzma_index_cat(idx, idx2, NULL), LZMA_OK);
+ assert_false(lzma_index_iter_locate(&iter, 0));
+ assert_uint_eq(iter.block.total_size, 16);
+ assert_uint_eq(iter.block.uncompressed_size, 1);
+ assert_uint_eq(iter.block.compressed_file_offset,
+ LZMA_STREAM_HEADER_SIZE + group_multiple * 8);
+ assert_uint_eq(iter.block.uncompressed_file_offset, 0);
+
lzma_index_end(idx, NULL);
}