mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 19:35:50 +00:00
other components
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
e9eab22e5c
commit
68269c43a6
250 changed files with 70871 additions and 0 deletions
44
test/test_util.h
Normal file
44
test/test_util.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
#pragma once
|
||||
|
||||
#include "stopwatch.h"
|
||||
|
||||
struct test_context {
|
||||
bool test_ok;
|
||||
unsigned test_fails;
|
||||
unsigned fails;
|
||||
double test_time;
|
||||
stopwatch test_timer;
|
||||
|
||||
test_context() : fails(0) {}
|
||||
};
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
#define TEST_CLASS(context, CLASS_NAME, TYPE, CALL_DESTRUCTORS) \
|
||||
context.test_fails = 0; \
|
||||
cout << "" << #CLASS_NAME << "<" << #TYPE << ">" << endl; \
|
||||
CLASS_NAME ## _test< TYPE, CALL_DESTRUCTORS >::run_tests(context); \
|
||||
context.fails += context.test_fails;
|
||||
|
||||
#define TEST_METHOD(context, METHOD) \
|
||||
cout << "\t" << #METHOD << "... "; \
|
||||
context.test_timer.reset(); \
|
||||
context.test_ok = test_ ## METHOD; \
|
||||
context.test_time = context.test_timer.get_seconds(); \
|
||||
if (context.test_ok) { \
|
||||
cout << "PASS"; \
|
||||
if (context.test_time > 0) { \
|
||||
cout << "(" << context.test_time << "s)"; \
|
||||
} \
|
||||
cout << endl; \
|
||||
} \
|
||||
else { \
|
||||
cout << "FAIL"; \
|
||||
if (context.test_time > 0) { \
|
||||
cout << "(" << context.test_time << "s)"; \
|
||||
} \
|
||||
cout << endl; \
|
||||
++ context.test_fails; \
|
||||
} \
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue