summaryrefslogtreecommitdiffstats
path: root/tests/test_utils.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_utils.hpp')
-rw-r--r--tests/test_utils.hpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/tests/test_utils.hpp b/tests/test_utils.hpp
index 48e3a588..4c358739 100644
--- a/tests/test_utils.hpp
+++ b/tests/test_utils.hpp
@@ -14,25 +14,32 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ingen/fmt.hpp"
+#include <ingen/fmt.hpp>
#include <iostream>
+#include <string>
#define EXPECT_TRUE(value) \
- if (!(value)) { \
- std::cerr << fmt("error: %1%:%2%: !%3%\n", \
- __FILE__, __LINE__, (#value)); \
- }
+ do { \
+ if (!(value)) { \
+ std::cerr << fmt("error: %1%:%2%: !%3%\n", \
+ __FILE__, __LINE__, (#value)); \
+ } \
+ } while (0)
#define EXPECT_FALSE(value) \
- if ((value)) { \
- std::cerr << (fmt("error: %1%:%2%: !%3%\n", \
- __FILE__, __LINE__, (#value))); \
- }
+ do { \
+ if ((value)) { \
+ std::cerr << (fmt("error: %1%:%2%: !%3%\n", \
+ __FILE__, __LINE__, (#value))); \
+ } \
+ } while (0)
#define EXPECT_EQ(value, expected) \
- if (!((value) == (expected))) { \
- std::cerr << fmt("error: %1%:%2%: %3% != %4%\n", \
- __FILE__, __LINE__, (#value), (#expected)); \
- std::cerr << "note: actual value: " << value << std::endl; \
- }
+ do { \
+ if (!((value) == (expected))) { \
+ std::cerr << fmt("error: %1%:%2%: %3% != %4%\n", \
+ __FILE__, __LINE__, (#value), (#expected)); \
+ std::cerr << "note: actual value: " << (value) << std::endl; \
+ } \
+ } while (0)