aboutsummaryrefslogtreecommitdiff
path: root/tests/tuktest.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2022-06-16 11:47:37 +0300
committerLasse Collin <lasse.collin@tukaani.org>2022-06-16 11:47:37 +0300
commit1d51536a4b19a8fae768f8eb462fc2238cb36d53 (patch)
treeeaca9b744a103a7d0bd3cf1112e5468ffdb06324 /tests/tuktest.h
parentTests: test_vli: Remove an invalid test-assertion. (diff)
downloadxz-1d51536a4b19a8fae768f8eb462fc2238cb36d53.tar.xz
Tests: tuktest.h: Move a function.
Diffstat (limited to '')
-rw-r--r--tests/tuktest.h44
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/tuktest.h b/tests/tuktest.h
index 0d22b891..ebc40eda 100644
--- a/tests/tuktest.h
+++ b/tests/tuktest.h
@@ -268,6 +268,28 @@ tuktest_basename(const char *filename)
}
+// Internal helper that prints the prefix of the fail/skip/error message line.
+static void
+tuktest_print_result_prefix(enum tuktest_result result,
+ const char *filename, unsigned line)
+{
+ // This is never called with TUKTEST_PASS but I kept it here anyway.
+ const char *result_str
+ = result == TUKTEST_PASS ? TUKTEST_STR_PASS
+ : result == TUKTEST_FAIL ? TUKTEST_STR_FAIL
+ : result == TUKTEST_SKIP ? TUKTEST_STR_SKIP
+ : TUKTEST_STR_ERROR;
+
+ const char *short_filename = tuktest_basename(filename);
+
+ if (tuktest_name != NULL)
+ printf("%s %s [%s:%u] ", result_str, tuktest_name,
+ short_filename, line);
+ else
+ printf("%s [%s:%u] ", result_str, short_filename, line);
+}
+
+
/// Initialize the test framework. No other functions or macros
/// from this file may be called before calling this.
///
@@ -459,28 +481,6 @@ tuktest_run_test(void (*testfunc)(void), const char *testfunc_str)
}
-// Internal helper that prints the prefix of the fail/skip/error message line.
-static void
-tuktest_print_result_prefix(enum tuktest_result result,
- const char *filename, unsigned line)
-{
- // This is never called with TUKTEST_PASS but I kept it here anyway.
- const char *result_str
- = result == TUKTEST_PASS ? TUKTEST_STR_PASS
- : result == TUKTEST_FAIL ? TUKTEST_STR_FAIL
- : result == TUKTEST_SKIP ? TUKTEST_STR_SKIP
- : TUKTEST_STR_ERROR;
-
- const char *short_filename = tuktest_basename(filename);
-
- if (tuktest_name != NULL)
- printf("%s %s [%s:%u] ", result_str, tuktest_name,
- short_filename, line);
- else
- printf("%s [%s:%u] ", result_str, short_filename, line);
-}
-
-
// Maximum allowed file size in file_from_* macros and functions.
#ifndef TUKTEST_FILE_SIZE_MAX
# define TUKTEST_FILE_SIZE_MAX (64L << 20)