1 // SPDX-License-Identifier: 0BSD
3 ///////////////////////////////////////////////////////////////////////////////
5 /// \file test_filter_str.c
6 /// \brief Tests Filter string functions
10 ///////////////////////////////////////////////////////////////////////////////
16 test_lzma_str_to_filters(void)
18 lzma_filter filters
[LZMA_FILTERS_MAX
+ 1];
21 // Test with NULL string.
23 assert_true(lzma_str_to_filters(NULL
, &error_pos
, filters
, 0,
25 assert_int_eq(error_pos
, 0);
27 // Test with NULL filter array.
29 assert_true(lzma_str_to_filters("lzma2", &error_pos
, NULL
, 0,
31 assert_int_eq(error_pos
, 0);
33 // Test with unsupported flags.
35 assert_true(lzma_str_to_filters("lzma2", &error_pos
, filters
,
36 UINT32_MAX
, NULL
) != NULL
);
37 assert_int_eq(error_pos
, 0);
40 assert_true(lzma_str_to_filters("lzma2", &error_pos
, filters
,
41 LZMA_STR_NO_SPACES
<< 1, NULL
) != NULL
);
42 assert_int_eq(error_pos
, 0);
45 assert_true(lzma_str_to_filters("lzma2", &error_pos
, filters
,
46 LZMA_STR_NO_SPACES
, NULL
) != NULL
);
47 assert_int_eq(error_pos
, 0);
49 // Test with empty string.
51 assert_true(lzma_str_to_filters("", &error_pos
,
52 filters
, 0, NULL
) != NULL
);
53 assert_int_eq(error_pos
, 0);
55 // Test with invalid filter name and missing filter name.
57 assert_true(lzma_str_to_filters("abcd", &error_pos
,
58 filters
, 0, NULL
) != NULL
);
59 assert_int_eq(error_pos
, 0);
62 assert_true(lzma_str_to_filters("lzma2 abcd", &error_pos
,
63 filters
, 0, NULL
) != NULL
);
64 assert_int_eq(error_pos
, 6);
67 assert_true(lzma_str_to_filters("lzma2--abcd", &error_pos
,
68 filters
, 0, NULL
) != NULL
);
69 assert_int_eq(error_pos
, 7);
72 assert_true(lzma_str_to_filters("lzma2--", &error_pos
,
73 filters
, 0, NULL
) != NULL
);
74 assert_int_eq(error_pos
, 7);
76 // Test LZMA_STR_ALL_FILTERS flag (should work with LZMA1 if built).
77 #if defined(HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1)
78 // Using LZMA1 as a Filter should fail without LZMA_STR_ALL_FILTERS.
80 assert_true(lzma_str_to_filters("lzma1", &error_pos
, filters
,
82 assert_int_eq(error_pos
, 0);
85 assert_true(lzma_str_to_filters("lzma1", &error_pos
, filters
,
86 LZMA_STR_ALL_FILTERS
, NULL
) == NULL
);
87 assert_int_eq(error_pos
, 5);
89 // Verify Filters array IDs are correct. The array should contain
92 // 2. LZMA_VLI_UNKNOWN filter array terminator
93 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA1
);
94 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
96 lzma_filters_free(filters
, NULL
);
99 // Test LZMA_STR_NO_VALIDATION flag. This should allow having the
100 // same Filter multiple times in the chain and having a non-last
101 // Filter like lzma2 appear before another Filter.
102 // Without the flag, "lzma2 lzma2" must fail.
104 assert_true(lzma_str_to_filters("lzma2 lzma2", &error_pos
, filters
,
106 assert_int_eq(error_pos
, 11);
109 assert_true(lzma_str_to_filters("lzma2 lzma2", &error_pos
, filters
,
110 LZMA_STR_NO_VALIDATION
, NULL
) == NULL
);
111 assert_int_eq(error_pos
, 11);
113 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
114 assert_uint_eq(filters
[1].id
, LZMA_FILTER_LZMA2
);
115 assert_uint_eq(filters
[2].id
, LZMA_VLI_UNKNOWN
);
117 lzma_filters_free(filters
, NULL
);
119 // Should fail with invalid Filter options (lc + lp must be <= 4).
121 assert_true(lzma_str_to_filters("lzma2:lc=3,lp=3", &error_pos
, filters
,
122 LZMA_STR_NO_VALIDATION
, NULL
) != NULL
);
123 assert_int_eq(error_pos
, 15);
125 // Test invalid option name.
127 assert_true(lzma_str_to_filters("lzma2:foo=1,bar=2", &error_pos
,
128 filters
, 0, NULL
) != NULL
);
129 assert_int_eq(error_pos
, 6);
132 assert_true(lzma_str_to_filters("lzma2:pb=1,bar=2", &error_pos
,
133 filters
, 0, NULL
) != NULL
);
134 assert_int_eq(error_pos
, 11);
136 // Test missing option value.
138 assert_true(lzma_str_to_filters("lzma2:lc=", &error_pos
,
139 filters
, 0, NULL
) != NULL
);
140 assert_int_eq(error_pos
, 9);
143 assert_true(lzma_str_to_filters("lzma2:=,pb=1", &error_pos
,
144 filters
, 0, NULL
) != NULL
);
145 assert_int_eq(error_pos
, 6);
147 // Test unsupported preset value.
149 assert_true(lzma_str_to_filters("-10", &error_pos
,
150 filters
, 0, NULL
) != NULL
);
151 assert_int_eq(error_pos
, 2);
154 assert_true(lzma_str_to_filters("-5f", &error_pos
,
155 filters
, 0, NULL
) != NULL
);
156 assert_int_eq(error_pos
, 2);
158 // Test filter chain too long.
160 assert_true(lzma_str_to_filters("lzma2 lzma2 lzma2 lzma2 lzma2",
161 &error_pos
, filters
, LZMA_STR_NO_VALIDATION
,
163 assert_int_eq(error_pos
, 24); // The fifth is too many.
165 #if defined(HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1)
166 // Should fail with a Filter not supported in the .xz format (lzma1).
168 assert_true(lzma_str_to_filters("lzma1", &error_pos
, filters
,
169 LZMA_STR_NO_VALIDATION
, NULL
) != NULL
);
170 assert_int_eq(error_pos
, 0);
173 // Test setting options with the "=" format.
175 assert_true(lzma_str_to_filters("lzma2=dict=4096,lc=2,lp=2,pb=1,"
176 "mode=fast,nice=3,mf=hc3,depth=10", &error_pos
,
177 filters
, 0, NULL
) == NULL
);
178 assert_int_eq(error_pos
, 63);
179 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
180 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
182 lzma_options_lzma
*opts
= filters
[0].options
;
183 assert_uint_eq(opts
->dict_size
, 4096);
184 assert_uint_eq(opts
->lc
, 2);
185 assert_uint_eq(opts
->lp
, 2);
186 assert_uint_eq(opts
->pb
, 1);
187 assert_uint_eq(opts
->mode
, LZMA_MODE_FAST
);
188 assert_uint_eq(opts
->nice_len
, 3);
189 assert_uint_eq(opts
->mf
, LZMA_MF_HC3
);
190 assert_uint_eq(opts
->depth
, 10);
192 lzma_filters_free(filters
, NULL
);
194 #if defined(HAVE_ENCODER_X86) || defined(HAVE_DECODER_X86)
195 // Test BCJ Filter options.
197 assert_true(lzma_str_to_filters("x86:start=16", &error_pos
, filters
,
198 LZMA_STR_NO_VALIDATION
, NULL
) == NULL
);
199 assert_int_eq(error_pos
, 12);
201 assert_uint_eq(filters
[0].id
, LZMA_FILTER_X86
);
202 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
204 lzma_options_bcj
*bcj_opts
= filters
[0].options
;
205 assert_uint_eq(bcj_opts
->start_offset
, 16);
207 lzma_filters_free(filters
, NULL
);
210 #if defined(HAVE_ENCODER_DELTA) || defined(HAVE_DECODER_DELTA)
211 // Test Delta Filter options.
213 assert_true(lzma_str_to_filters("delta:dist=20", &error_pos
, filters
,
214 LZMA_STR_NO_VALIDATION
, NULL
) == NULL
);
215 assert_int_eq(error_pos
, 13);
217 assert_uint_eq(filters
[0].id
, LZMA_FILTER_DELTA
);
218 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
220 lzma_options_delta
*delta_opts
= filters
[0].options
;
221 assert_uint_eq(delta_opts
->dist
, 20);
223 lzma_filters_free(filters
, NULL
);
226 // Test skipping leading spaces.
228 assert_true(lzma_str_to_filters(" lzma2", &error_pos
, filters
,
230 assert_int_eq(error_pos
, 9);
232 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
233 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
235 lzma_filters_free(filters
, NULL
);
237 // Test skipping trailing spaces.
239 assert_true(lzma_str_to_filters("lzma2 ", &error_pos
, filters
,
241 assert_int_eq(error_pos
, 9);
243 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
244 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
246 lzma_filters_free(filters
, NULL
);
248 // Test with "--" instead of space separating.
250 assert_true(lzma_str_to_filters("lzma2--lzma2", &error_pos
, filters
,
251 LZMA_STR_NO_VALIDATION
, NULL
) == NULL
);
252 assert_int_eq(error_pos
, 12);
254 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
255 assert_uint_eq(filters
[1].id
, LZMA_FILTER_LZMA2
);
256 assert_uint_eq(filters
[2].id
, LZMA_VLI_UNKNOWN
);
258 lzma_filters_free(filters
, NULL
);
260 // Test preset with and without leading "-", and with "e".
262 assert_true(lzma_str_to_filters("-3", &error_pos
, filters
,
264 assert_int_eq(error_pos
, 2);
266 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
267 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
269 lzma_filters_free(filters
, NULL
);
272 assert_true(lzma_str_to_filters("4", &error_pos
, filters
,
274 assert_int_eq(error_pos
, 1);
276 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
277 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
279 lzma_filters_free(filters
, NULL
);
282 assert_true(lzma_str_to_filters("9e", &error_pos
, filters
,
284 assert_int_eq(error_pos
, 2);
286 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
287 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
289 lzma_filters_free(filters
, NULL
);
291 // Test using a preset as an lzma2 option.
293 assert_true(lzma_str_to_filters("lzma2:preset=9e", &error_pos
, filters
,
295 assert_int_eq(error_pos
, 15);
297 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
298 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
300 lzma_filters_free(filters
, NULL
);
302 // Test setting dictionary size with invalid modifier suffix.
304 assert_true(lzma_str_to_filters("lzma2:dict=4096ZiB", &error_pos
, filters
,
306 assert_int_eq(error_pos
, 15);
309 assert_true(lzma_str_to_filters("lzma2:dict=4096KiBs", &error_pos
, filters
,
311 assert_int_eq(error_pos
, 15);
313 // Test option that cannot have multiplier modifier.
315 assert_true(lzma_str_to_filters("lzma2:pb=1k", &error_pos
, filters
,
317 assert_int_eq(error_pos
, 10);
319 // Test option value too large.
321 assert_true(lzma_str_to_filters("lzma2:dict=4096GiB", &error_pos
, filters
,
323 assert_int_eq(error_pos
, 11);
325 // Test valid uses of multiplier modifiers (k,m,g).
327 assert_true(lzma_str_to_filters("lzma2:dict=4096KiB", &error_pos
, filters
,
329 assert_int_eq(error_pos
, 18);
331 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
332 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
334 opts
= filters
[0].options
;
335 assert_uint_eq(opts
->dict_size
, 4096 << 10);
337 lzma_filters_free(filters
, NULL
);
340 assert_true(lzma_str_to_filters("lzma2:dict=40Mi", &error_pos
, filters
,
342 assert_int_eq(error_pos
, 15);
344 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
345 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
347 opts
= filters
[0].options
;
348 assert_uint_eq(opts
->dict_size
, 40 << 20);
350 lzma_filters_free(filters
, NULL
);
353 assert_true(lzma_str_to_filters("lzma2:dict=1g", &error_pos
, filters
,
355 assert_int_eq(error_pos
, 13);
357 assert_uint_eq(filters
[0].id
, LZMA_FILTER_LZMA2
);
358 assert_uint_eq(filters
[1].id
, LZMA_VLI_UNKNOWN
);
360 opts
= filters
[0].options
;
361 assert_uint_eq(opts
->dict_size
, 1 << 30);
363 lzma_filters_free(filters
, NULL
);
368 test_lzma_str_from_filters(void)
370 lzma_filter filters
[LZMA_FILTERS_MAX
];
371 filters
[0].id
= LZMA_VLI_UNKNOWN
;
373 char *output_str
= NULL
;
375 // Test basic NULL inputs.
376 assert_lzma_ret(lzma_str_from_filters(NULL
, filters
, 0, NULL
),
379 assert_lzma_ret(lzma_str_from_filters(&output_str
, NULL
, 0, NULL
),
382 // Test with empty filters array.
383 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
, 0, NULL
),
386 // Create a simple filter array only containing an LZMA2 Filter.
387 assert_true(lzma_str_to_filters("lzma2", NULL
, filters
, 0, NULL
)
390 // Test with bad flags.
391 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
,
392 LZMA_STR_ALL_FILTERS
, NULL
), LZMA_OPTIONS_ERROR
);
394 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
,
395 LZMA_STR_NO_VALIDATION
, NULL
), LZMA_OPTIONS_ERROR
);
397 // Test with no flags.
398 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
, 0, NULL
),
401 assert_str_eq(output_str
, "lzma2");
404 // Test LZMA_STR_ENCODER flag.
405 // Only the the return value is checked since the actual string
406 // may change in the future (even though it is unlikely).
407 // The order of options or the inclusion of new options could
408 // cause a change in output, so we will avoid hardcoding an
410 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
,
411 LZMA_STR_ENCODER
, NULL
), LZMA_OK
);
414 // Test LZMA_STR_DECODER flag.
415 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
,
416 LZMA_STR_DECODER
, NULL
), LZMA_OK
);
419 // Test LZMA_STR_GETOPT_LONG flag.
420 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
,
421 LZMA_STR_GETOPT_LONG
, NULL
), LZMA_OK
);
424 // Test LZMA_STR_NO_SPACES flag.
425 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
,
426 LZMA_STR_NO_SPACES
, NULL
), LZMA_OK
);
428 // Check to be sure there are no spaces.
429 assert_true(strchr(output_str
, ' ') == NULL
);
433 lzma_filters_free(filters
, NULL
);
435 #if defined(HAVE_ENCODER_X86) || defined(HAVE_DECODER_X86)
436 assert_true(lzma_str_to_filters("x86 lzma2", NULL
, filters
, 0, NULL
)
439 // It always allocates the options structure even when it's not
440 // needed due to start_offset = 0 being the default.
441 assert_true(filters
[0].options
!= NULL
);
443 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
, 0, NULL
),
446 assert_str_eq(output_str
, "x86 lzma2");
450 // Test setting BCJ option to NULL.
451 free(filters
[0].options
);
452 filters
[0].options
= NULL
;
454 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
, 0, NULL
),
457 assert_str_eq(output_str
, "x86 lzma2");
459 lzma_filters_free(filters
, NULL
);
463 lzma_options_lzma opts
;
464 assert_false(lzma_lzma_preset(&opts
, LZMA_PRESET_DEFAULT
));
466 // Test with too many Filters (array terminated after 4+ filters).
467 lzma_filter oversized_filters
[LZMA_FILTERS_MAX
+ 2];
469 for (uint32_t i
= 0; i
< ARRAY_SIZE(oversized_filters
) - 1; i
++) {
470 oversized_filters
[i
].id
= LZMA_FILTER_LZMA2
;
471 oversized_filters
[i
].options
= &opts
;
474 oversized_filters
[LZMA_FILTERS_MAX
+ 1].id
= LZMA_VLI_UNKNOWN
;
475 oversized_filters
[LZMA_FILTERS_MAX
+ 1].options
= NULL
;
477 assert_lzma_ret(lzma_str_from_filters(&output_str
, oversized_filters
,
478 0, NULL
), LZMA_OPTIONS_ERROR
);
480 // Test with NULL filter options (when they cannot be NULL).
481 filters
[0].id
= LZMA_FILTER_LZMA2
;
482 filters
[0].options
= NULL
;
483 filters
[1].id
= LZMA_VLI_UNKNOWN
;
485 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
,
486 LZMA_STR_ENCODER
, NULL
), LZMA_OPTIONS_ERROR
);
488 // Test with bad Filter ID.
489 filters
[0].id
= LZMA_VLI_UNKNOWN
- 1;
490 assert_lzma_ret(lzma_str_from_filters(&output_str
, filters
,
491 LZMA_STR_ENCODER
, NULL
), LZMA_OPTIONS_ERROR
);
495 static const char supported_encoders
[][9] = {
497 #ifdef HAVE_ENCODER_X86
500 #ifdef HAVE_ENCODER_POWERPC
503 #ifdef HAVE_ENCODER_IA64
506 #ifdef HAVE_ENCODER_ARM
509 #ifdef HAVE_ENCODER_ARMTHUMB
512 #ifdef HAVE_ENCODER_SPARC
515 #ifdef HAVE_ENCODER_ARM64
518 #ifdef HAVE_ENCODER_RISCV
521 #ifdef HAVE_ENCODER_DELTA
526 static const char supported_decoders
[][9] = {
528 #ifdef HAVE_DECODER_X86
531 #ifdef HAVE_DECODER_POWERPC
534 #ifdef HAVE_DECODER_IA64
537 #ifdef HAVE_DECODER_ARM
540 #ifdef HAVE_DECODER_ARMTHUMB
543 #ifdef HAVE_DECODER_SPARC
546 #ifdef HAVE_DECODER_ARM64
549 #ifdef HAVE_DECODER_RISCV
552 #ifdef HAVE_DECODER_DELTA
557 static const char supported_filters
[][9] = {
559 #if defined(HAVE_ENCODER_X86) || defined(HAVE_DECODER_X86)
562 #if defined(HAVE_ENCODER_POWERPC) || defined(HAVE_DECODER_POWERPC)
565 #if defined(HAVE_ENCODER_IA64) || defined(HAVE_DECODER_IA64)
568 #if defined(HAVE_ENCODER_ARM) || defined(HAVE_DECODER_ARM)
571 #if defined(HAVE_ENCODER_ARMTHUMB) || defined(HAVE_DECODER_ARMTHUMB)
574 #if defined(HAVE_ENCODER_SPARC) || defined(HAVE_DECODER_SPARC)
577 #if defined(HAVE_ENCODER_ARM64) || defined(HAVE_DECODER_ARM64)
580 #if defined(HAVE_ENCODER_RISCV) || defined(HAVE_DECODER_RISCV)
583 #if defined(HAVE_ENCODER_DELTA) || defined(HAVE_DECODER_DELTA)
590 test_lzma_str_list_filters(void)
592 // Test with basic NULL inputs.
593 assert_lzma_ret(lzma_str_list_filters(NULL
, LZMA_VLI_UNKNOWN
, 0,
594 NULL
), LZMA_PROG_ERROR
);
598 // Test with bad flags.
599 assert_lzma_ret(lzma_str_list_filters(&str
, LZMA_VLI_UNKNOWN
,
600 LZMA_STR_NO_VALIDATION
, NULL
), LZMA_OPTIONS_ERROR
);
601 assert_true(str
== NULL
);
603 assert_lzma_ret(lzma_str_list_filters(&str
, LZMA_VLI_UNKNOWN
,
604 LZMA_STR_NO_SPACES
, NULL
), LZMA_OPTIONS_ERROR
);
605 assert_true(str
== NULL
);
607 // Test with bad Filter ID.
608 assert_lzma_ret(lzma_str_list_filters(&str
, LZMA_VLI_UNKNOWN
- 1,
609 0, NULL
), LZMA_OPTIONS_ERROR
);
610 assert_true(str
== NULL
);
612 // Test LZMA_STR_ENCODER flag.
613 assert_lzma_ret(lzma_str_list_filters(&str
, LZMA_VLI_UNKNOWN
,
614 LZMA_STR_ENCODER
, NULL
), LZMA_OK
);
616 // NOTE: Just checking for "contains" is a bit weak check as
617 // "arm" matches "armthumb" and "arm64" too.
618 for (uint32_t i
= 0; i
< ARRAY_SIZE(supported_encoders
); i
++)
619 assert_str_contains(str
, supported_encoders
[i
]);
623 // Test LZMA_STR_DECODER flag.
624 assert_lzma_ret(lzma_str_list_filters(&str
, LZMA_VLI_UNKNOWN
,
625 LZMA_STR_DECODER
, NULL
), LZMA_OK
);
627 for (uint32_t i
= 0; i
< ARRAY_SIZE(supported_decoders
); i
++)
628 assert_str_contains(str
, supported_decoders
[i
]);
632 // Test LZMA_STR_GETOPT_LONG flag.
633 assert_lzma_ret(lzma_str_list_filters(&str
, LZMA_VLI_UNKNOWN
,
634 LZMA_STR_GETOPT_LONG
, NULL
), LZMA_OK
);
635 assert_str_contains(str
, "--");
639 // Test LZMA_STR_ALL_FILTERS flag.
640 assert_lzma_ret(lzma_str_list_filters(&str
, LZMA_VLI_UNKNOWN
,
641 LZMA_STR_ALL_FILTERS
, NULL
), LZMA_OK
);
642 #if defined(HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1)
643 // With the flag, the string should contain the LZMA1 Filter.
644 assert_str_contains(str
, "lzma1");
648 // If a non .xz filter is specified, it should still list the Filter.
649 assert_lzma_ret(lzma_str_list_filters(&str
, LZMA_FILTER_LZMA1
,
651 assert_str_eq(str
, "lzma1");
655 // Test with no flags.
656 assert_lzma_ret(lzma_str_list_filters(&str
, LZMA_VLI_UNKNOWN
,
659 for (uint32_t i
= 0; i
< ARRAY_SIZE(supported_filters
); i
++)
660 assert_str_contains(str
, supported_filters
[i
]);
662 assert_str_doesnt_contain(str
, "lzma1");
666 // Test providing a Filter ID.
667 assert_lzma_ret(lzma_str_list_filters(&str
, LZMA_FILTER_LZMA2
,
668 LZMA_STR_ALL_FILTERS
, NULL
), LZMA_OK
);
669 assert_str_eq(str
, "lzma2");
676 main(int argc
, char **argv
)
678 tuktest_start(argc
, argv
);
680 tuktest_run(test_lzma_str_to_filters
);
681 tuktest_run(test_lzma_str_from_filters
);
682 tuktest_run(test_lzma_str_list_filters
);
684 return tuktest_end();