Further improvements to the ASSERT-macro: replaced fprintf with std::cerr and added std::-prefix to abort

This commit is contained in:
eidheim 2019-03-28 10:56:16 +01:00
commit ded57636dd

View file

@ -2,7 +2,8 @@
#define TESTS_ASSERT_HPP
#include <cstdlib>
#include <iostream>
#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 */