Tests: Include tuktest.h in tests.h.

This breaks -Werror because none of the tests so far use
tuktest.h and thus there are warnings about unused variables
and functions.
This commit is contained in:
Lasse Collin 2022-06-02 20:27:00 +03:00
parent df71ba1c99
commit 96da21470f
1 changed files with 22 additions and 23 deletions

View File

@ -16,11 +16,13 @@
#include "sysdefs.h" #include "sysdefs.h"
#include "tuklib_integer.h" #include "tuklib_integer.h"
#include "lzma.h" #include "lzma.h"
#include "tuktest.h"
#include <stdio.h>
#define memcrap(buf, size) memset(buf, 0xFD, size) #define memcrap(buf, size) memset(buf, 0xFD, size)
// TODO: Remove these three macros once all tests have been converted.
#define expect(test) ((test) ? 0 : (fprintf(stderr, "%s:%d: %s\n", \ #define expect(test) ((test) ? 0 : (fprintf(stderr, "%s:%d: %s\n", \
__FILE__, __LINE__, #test), abort(), 0)) __FILE__, __LINE__, #test), abort(), 0))
@ -29,29 +31,26 @@
#define fail(test) expect(test) #define fail(test) expect(test)
static inline const char * // This table and macro allow getting more readable error messages when
lzma_ret_sym(lzma_ret ret) // comparing the lzma_ret enumeration values.
{ static const char *enum_strings_lzma_ret[] = {
if ((unsigned int)(ret) > LZMA_PROG_ERROR) "LZMA_OK",
return "UNKNOWN_ERROR"; "LZMA_STREAM_END",
"LZMA_NO_CHECK",
"LZMA_UNSUPPORTED_CHECK",
"LZMA_GET_CHECK",
"LZMA_MEM_ERROR",
"LZMA_MEMLIMIT_ERROR",
"LZMA_FORMAT_ERROR",
"LZMA_OPTIONS_ERROR",
"LZMA_DATA_ERROR",
"LZMA_BUF_ERROR",
"LZMA_PROG_ERROR",
"LZMA_SEEK_NEEDED",
};
static const char *msgs[] = { #define assert_lzma_ret(test_expr, ref_val) \
"LZMA_OK", assert_enum_eq(test_expr, ref_val, enum_strings_lzma_ret)
"LZMA_STREAM_END",
"LZMA_NO_CHECK",
"LZMA_UNSUPPORTED_CHECK",
"LZMA_GET_CHECK",
"LZMA_MEM_ERROR",
"LZMA_MEMLIMIT_ERROR",
"LZMA_FORMAT_ERROR",
"LZMA_OPTIONS_ERROR",
"LZMA_DATA_ERROR",
"LZMA_BUF_ERROR",
"LZMA_PROG_ERROR"
};
return msgs[ret];
}
static inline bool static inline bool