aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2023-02-28 23:22:36 +0800
committerJia Tan <jiat0218@gmail.com>2023-03-13 20:53:26 +0800
commit1c558a26928b753fcf1c0d4bce9c0643285edd86 (patch)
tree01b539cb683ff736c25205c911c6d58cb6f80263
parentTests: Refactors existing lzma_index tests. (diff)
downloadxz-1c558a26928b753fcf1c0d4bce9c0643285edd86.tar.xz
Tests: Remove unused macros and functions.
-rw-r--r--tests/tests.h75
1 files changed, 0 insertions, 75 deletions
diff --git a/tests/tests.h b/tests/tests.h
index 8d53e9de..2d427000 100644
--- a/tests/tests.h
+++ b/tests/tests.h
@@ -28,18 +28,6 @@
#define INVALID_LZMA_CHECK_ID ((lzma_check)(LZMA_CHECK_ID_MAX + 1))
-#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", \
- __FILE__, __LINE__, #test), abort(), 0))
-
-#define succeed(test) expect(!(test))
-
-#define fail(test) expect(test)
-
-
// This table and macro allow getting more readable error messages when
// comparing the lzma_ret enumeration values.
static const char enum_strings_lzma_ret[][24] = {
@@ -84,67 +72,4 @@ static const char enum_strings_lzma_check[][24] = {
#define assert_lzma_check(test_expr, ref_val) \
assert_enum_eq(test_expr, ref_val, enum_strings_lzma_check)
-
-static inline bool
-coder_loop(lzma_stream *strm, uint8_t *in, size_t in_size,
- uint8_t *out, size_t out_size,
- lzma_ret expected_ret, lzma_action finishing_action)
-{
- size_t in_left = in_size;
- size_t out_left = out_size > 0 ? out_size + 1 : 0;
- lzma_action action = LZMA_RUN;
- lzma_ret ret;
-
- strm->next_in = NULL;
- strm->avail_in = 0;
- strm->next_out = NULL;
- strm->avail_out = 0;
-
- while (true) {
- if (in_left > 0) {
- if (--in_left == 0)
- action = finishing_action;
-
- strm->next_in = in++;
- strm->avail_in = 1;
- }
-
- if (out_left > 0) {
- --out_left;
- strm->next_out = out++;
- strm->avail_out = 1;
- }
-
- ret = lzma_code(strm, action);
- if (ret != LZMA_OK)
- break;
- }
-
- bool error = false;
-
- if (ret != expected_ret)
- error = true;
-
- if (strm->total_in != in_size || strm->total_out != out_size)
- error = true;
-
- return error;
-}
-
-
-static inline bool
-decoder_loop_ret(lzma_stream *strm, uint8_t *in, size_t in_size,
- lzma_ret expected_ret)
-{
- return coder_loop(strm, in, in_size, NULL, 0, expected_ret, LZMA_RUN);
-}
-
-
-static inline bool
-decoder_loop(lzma_stream *strm, uint8_t *in, size_t in_size)
-{
- return coder_loop(strm, in, in_size, NULL, 0,
- LZMA_STREAM_END, LZMA_RUN);
-}
-
#endif