From ded57636dde99757a1f967111c3a6cf3002ec549 Mon Sep 17 00:00:00 2001 From: eidheim Date: Thu, 28 Mar 2019 10:56:16 +0100 Subject: [PATCH] Further improvements to the ASSERT-macro: replaced fprintf with std::cerr and added std::-prefix to abort --- tests/assert.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/assert.hpp b/tests/assert.hpp index e6ede15..552d4b7 100644 --- a/tests/assert.hpp +++ b/tests/assert.hpp @@ -2,7 +2,8 @@ #define TESTS_ASSERT_HPP #include +#include -#define ASSERT(e) ((void)((e) ? ((void)0) : ((void)fprintf(stderr, "Assertion failed: (%s), function %s, file %s, line %u.\n", #e, __func__, __FILE__, __LINE__), abort()))) +#define ASSERT(e) ((void)((e) ? ((void)0) : ((void)(std::cerr << "Assertion failed: (" << #e << "), function " << __func__ << ", file " << __FILE__ << ", line " << __LINE__ << ".\n"), std::abort()))) #endif /* TESTS_ASSERT_HPP */