aboutsummaryrefslogtreecommitdiff
path: root/tests/test_stream_flags.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-01-12 04:14:18 +0200
committerJia Tan <jiat0218@gmail.com>2023-02-03 21:10:06 +0800
commitc47ecd6d3909d0d3ff48dfd6e2ee41e7c7130b94 (patch)
tree165c864ba678de187aa931a57874a4f1284f68d0 /tests/test_stream_flags.c
parentTests: Silence warnings from -Wsign-conversion. (diff)
downloadxz-c47ecd6d3909d0d3ff48dfd6e2ee41e7c7130b94.tar.xz
Tests: Fix warnings from clang --Wassign-enum.
Explicitly casting the integer to lzma_check silences the warning. Since such an invalid value is needed in multiple tests, a constant INVALID_LZMA_CHECK_ID was added to tests.h. The use of 0x1000 for lzma_block.check wasn't optimal as if the underlying type is a char then 0x1000 will be truncated to 0. However, in these test cases the value is ignored, thus even with such truncation the test would have passed.
Diffstat (limited to 'tests/test_stream_flags.c')
-rw-r--r--tests/test_stream_flags.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_stream_flags.c b/tests/test_stream_flags.c
index 26b4c613..2248e67a 100644
--- a/tests/test_stream_flags.c
+++ b/tests/test_stream_flags.c
@@ -87,7 +87,7 @@ test_lzma_stream_header_encode(void)
flags.version = 0;
// Should fail if Check ID is invalid
- flags.check = LZMA_CHECK_ID_MAX + 1;
+ flags.check = INVALID_LZMA_CHECK_ID;
assert_lzma_ret(lzma_stream_header_encode(&flags, header),
LZMA_PROG_ERROR);
flags.check = LZMA_CHECK_CRC32;
@@ -170,7 +170,7 @@ test_lzma_stream_footer_encode(void)
flags.version = 0;
// Should fail if Check ID is invalid
- flags.check = LZMA_CHECK_ID_MAX + 1;
+ flags.check = INVALID_LZMA_CHECK_ID;
assert_lzma_ret(lzma_stream_footer_encode(&flags, footer),
LZMA_PROG_ERROR);
@@ -410,10 +410,10 @@ test_lzma_stream_flags_compare(void)
second.version = 0;
// Check types must be under the maximum
- first.check = LZMA_CHECK_ID_MAX + 1;
+ first.check = INVALID_LZMA_CHECK_ID;
assert_lzma_ret(lzma_stream_flags_compare(&first, &second),
LZMA_PROG_ERROR);
- second.check = LZMA_CHECK_ID_MAX + 1;
+ second.check = INVALID_LZMA_CHECK_ID;
assert_lzma_ret(lzma_stream_flags_compare(&first, &second),
LZMA_PROG_ERROR);
first.check = LZMA_CHECK_CRC32;