From: Michael Tremer Date: Wed, 29 Jan 2025 14:00:59 +0000 (+0000) Subject: tests: compress: Tidy up the code to get better assertion messages X-Git-Tag: 0.9.30~303 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5092e9ca21f2b93cdacf007997078cb39426503;p=pakfire.git tests: compress: Tidy up the code to get better assertion messages Signed-off-by: Michael Tremer --- diff --git a/tests/libpakfire/compress.c b/tests/libpakfire/compress.c index 7823e586..557f743a 100644 --- a/tests/libpakfire/compress.c +++ b/tests/libpakfire/compress.c @@ -37,6 +37,7 @@ static int read_test(const struct test* t, FILE* f = NULL; char path[PATH_MAX]; char buffer[1024]; + size_t bytes_read; ASSERT_SUCCESS(pakfire_string_format(path, "%s/%s", TEST_SRC_PATH, file)); @@ -44,12 +45,10 @@ static int read_test(const struct test* t, ASSERT(f = fopen(path, "r")); // Engage decompressor - f = function(f, "r"); - ASSERT(f); + ASSERT(f = function(f, "r")); // Read into buffer - size_t bytes_read = fread(buffer, 1, sizeof(buffer), f); - ASSERT(bytes_read); + ASSERT(bytes_read = fread(buffer, 1, sizeof(buffer), f)); // Buffer should equal the test data ASSERT(bytes_read >= sizeof(TEST_DATA) - 1);