summaryrefslogtreecommitdiff
path: root/test/test-api.c
diff options
context:
space:
mode:
authordaan <daanl@outlook.com>2022-01-10 15:29:49 -0800
committerdaan <daanl@outlook.com>2022-01-10 15:29:49 -0800
commitae1c06d9401f16da149b9f1a04a98aa8c16cfd13 (patch)
tree3e8d5295ddb1d86994bffb9aae0bfeb6eb641e2a /test/test-api.c
parentf317225a70929fea9be62e15945c2e8890cf6a1a (diff)
parent8c50aa65eec76eff0684a0730b29247cff3644c0 (diff)
merge from dev
Diffstat (limited to 'test/test-api.c')
-rw-r--r--test/test-api.c35
1 files changed, 3 insertions, 32 deletions
diff --git a/test/test-api.c b/test/test-api.c
index f057799..7ce6f11 100644
--- a/test/test-api.c
+++ b/test/test-api.c
@@ -23,7 +23,6 @@ we therefore test the API over various inputs. Please add more tests :-)
[1] https://github.com/daanx/mimalloc-bench
*/
-#include <stdio.h>
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
@@ -35,34 +34,9 @@ we therefore test the API over various inputs. Please add more tests :-)
#include "mimalloc.h"
// #include "mimalloc-internal.h"
+#include "mimalloc-types.h" // for MI_DEBUG
-// ---------------------------------------------------------------------------
-// Test macros: CHECK(name,predicate) and CHECK_BODY(name,body)
-// ---------------------------------------------------------------------------
-static int ok = 0;
-static int failed = 0;
-
-#define CHECK_BODY(name,body) \
- do { \
- fprintf(stderr,"test: %s... ", name ); \
- bool result = true; \
- do { body } while(false); \
- if (!(result)) { \
- failed++; \
- fprintf(stderr, \
- "\n FAILED: %s:%d:\n %s\n", \
- __FILE__, \
- __LINE__, \
- #body); \
- /* exit(1); */ \
- } \
- else { \
- ok++; \
- fprintf(stderr,"ok.\n"); \
- } \
- } while (false)
-
-#define CHECK(name,expr) CHECK_BODY(name,{ result = (expr); })
+#include "testhelper.h"
// ---------------------------------------------------------------------------
// Test functions
@@ -219,10 +193,7 @@ int main(void) {
// ---------------------------------------------------
// Done
// ---------------------------------------------------[]
- fprintf(stderr,"\n\n---------------------------------------------\n"
- "succeeded: %i\n"
- "failed : %i\n\n", ok, failed);
- return failed;
+ return print_test_summary();
}
// ---------------------------------------------------