aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2023-08-03 20:10:21 +0800
committerJia Tan <jiat0218@gmail.com>2023-08-03 20:10:21 +0800
commitcd678a6077358935249b64a4a16fe8d17434f9c9 (patch)
tree4c866941307c473d83c246a348eba04ee64c1318 /tests
parentTranslations: Update the Chinese (simplified) translation. (diff)
downloadxz-cd678a6077358935249b64a4a16fe8d17434f9c9.tar.xz
Tests: Style fixes to test_lzip_decoder.c.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_lzip_decoder.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/tests/test_lzip_decoder.c b/tests/test_lzip_decoder.c
index 42c730ad..3743d434 100644
--- a/tests/test_lzip_decoder.c
+++ b/tests/test_lzip_decoder.c
@@ -34,7 +34,8 @@ static const uint32_t trailing_garbage_crc = 0x87081A60;
// Helper function to decode a good file with no flags and plenty high memlimit
static void
-basic_lzip_decode(const char *src, const uint32_t expected_crc) {
+basic_lzip_decode(const char *src, const uint32_t expected_crc)
+{
size_t file_size;
uint8_t *data = tuktest_file_from_srcdir(src, &file_size);
uint32_t checksum = 0;
@@ -95,7 +96,8 @@ test_options(void)
static void
-test_v0_decode(void) {
+test_v0_decode(void)
+{
// This tests if liblzma can decode lzip version 0 files.
// lzip 1.17 and older can decompress this, but lzip 1.18
// and newer can no longer decode these files.
@@ -104,7 +106,8 @@ test_v0_decode(void) {
static void
-test_v1_decode(void) {
+test_v1_decode(void)
+{
// This tests decoding a basic lzip v1 file
basic_lzip_decode("files/good-1-v1.lz", hello_world_crc);
}
@@ -114,7 +117,8 @@ test_v1_decode(void) {
// the lzip stream
static void
trailing_helper(const char *src, const uint32_t expected_data_checksum,
- const uint32_t expected_trailing_checksum) {
+ const uint32_t expected_trailing_checksum)
+{
size_t file_size;
uint32_t checksum = 0;
uint8_t *data = tuktest_file_from_srcdir(src, &file_size);
@@ -199,14 +203,16 @@ decode_expect_error(const char *src, lzma_ret expected_error)
static void
-test_v0_trailing(void) {
+test_v0_trailing(void)
+{
trailing_helper("files/good-1-v0-trailing-1.lz", hello_world_crc,
trailing_garbage_crc);
}
static void
-test_v1_trailing(void) {
+test_v1_trailing(void)
+{
trailing_helper("files/good-1-v1-trailing-1.lz", hello_world_crc,
trailing_garbage_crc);
@@ -296,7 +302,8 @@ test_concatentated(void)
static void
-test_crc(void) {
+test_crc(void)
+{
// Test invalid checksum
lzma_stream strm = LZMA_STREAM_INIT;
size_t file_size;
@@ -344,7 +351,8 @@ test_crc(void) {
static void
-test_invalid_magic_bytes(void) {
+test_invalid_magic_bytes(void)
+{
uint8_t lzip_id_string[] = { 0x4C, 0x5A, 0x49, 0x50 };
lzma_stream strm = LZMA_STREAM_INIT;
@@ -383,7 +391,8 @@ test_invalid_version(void)
static void
-test_invalid_dictionary_size(void) {
+test_invalid_dictionary_size(void)
+{
// First file has too small dictionary size field
decode_expect_error("files/bad-1-v1-dict-1.lz", LZMA_DATA_ERROR);
@@ -393,7 +402,8 @@ test_invalid_dictionary_size(void) {
static void
-test_invalid_uncomp_size(void) {
+test_invalid_uncomp_size(void)
+{
// Test invalid v0 lzip file uncomp size
decode_expect_error("files/bad-1-v0-uncomp-size.lz",
LZMA_DATA_ERROR);
@@ -405,14 +415,16 @@ test_invalid_uncomp_size(void) {
static void
-test_invalid_member_size(void) {
+test_invalid_member_size(void)
+{
decode_expect_error("files/bad-1-v1-member-size.lz",
LZMA_DATA_ERROR);
}
static void
-test_invalid_memlimit(void) {
+test_invalid_memlimit(void)
+{
// A very low memlimit should prevent decoding.
// Should be able to update the memlimit after failing
size_t file_size;