Improve UnitTest macros in src/test.cpp
All checks were successful
Run UnitTest / build-and-run-UnitTest (push) Successful in 11s
All checks were successful
Run UnitTest / build-and-run-UnitTest (push) Successful in 11s
This commit is contained in:
parent
4ae6400711
commit
9fc4671bec
1 changed files with 13 additions and 10 deletions
|
@ -11,7 +11,8 @@ static int checks_passed = 0;
|
||||||
do { \
|
do { \
|
||||||
++checks_checked; \
|
++checks_checked; \
|
||||||
if (!(x)) { \
|
if (!(x)) { \
|
||||||
std::cout << "CHECK_TRUE at line " << __LINE__ << " failed!\n"; \
|
std::cout << "CHECK_TRUE at line " << __LINE__ << " failed: " \
|
||||||
|
<< #x << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
++checks_passed; \
|
++checks_passed; \
|
||||||
} \
|
} \
|
||||||
|
@ -20,7 +21,8 @@ static int checks_passed = 0;
|
||||||
do { \
|
do { \
|
||||||
++checks_checked; \
|
++checks_checked; \
|
||||||
if (x) { \
|
if (x) { \
|
||||||
std::cout << "CHECK_FALSE at line " << __LINE__ << " failed!\n"; \
|
std::cout << "CHECK_FALSE at line " << __LINE__ << " failed: " \
|
||||||
|
<< #x << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
++checks_passed; \
|
++checks_passed; \
|
||||||
} \
|
} \
|
||||||
|
@ -32,7 +34,8 @@ static int checks_passed = 0;
|
||||||
if ((var) > (value)-0.0001F && (var) < (value) + 0.0001F) { \
|
if ((var) > (value)-0.0001F && (var) < (value) + 0.0001F) { \
|
||||||
++checks_passed; \
|
++checks_passed; \
|
||||||
} else { \
|
} else { \
|
||||||
std::cout << "CHECK_FLOAT at line " << __LINE__ << " failed!\n"; \
|
std::cout << "CHECK_FLOAT at line " << __LINE__ << " failed: " \
|
||||||
|
<< #var << " != " << #value << '\n'; \
|
||||||
} \
|
} \
|
||||||
} while (false);
|
} while (false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue