From 00874526f5acaf9117e57359f9a5762d98aacbd6 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 29 Jul 2024 00:39:08 +0200 Subject: [PATCH] added location to ASSERT() --- test/common_helper/test.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/common_helper/test.hpp b/test/common_helper/test.hpp index 7c10bfd..1a8dfc6 100644 --- a/test/common_helper/test.hpp +++ b/test/common_helper/test.hpp @@ -30,7 +30,7 @@ constexpr auto make_copy(auto& value) -> std::remove_cvref_t { #define TEST_SKIP(...) _ret_val_from_ctx<__VA_ARGS__>(ReturnCode::SKIPPED) #define TEST_SKIP_MSG(msg, ...) _ret_val_from_ctx<__VA_ARGS__>(ReturnCode::SKIPPED, msg) -#define ASSERT(condition, ...) ASSERT_MSG((condition), nullptr, __VA_ARGS__) +#define ASSERT(condition, ...) ASSERT_MSG((condition), "Condition (" #condition ") evaluated to false" _LOCATION, __VA_ARGS__) #define ASSERT_MSG(condition, msg, ...) { if (!(condition)) return _ret_val_from_ctx<__VA_ARGS__>(ReturnCode::FAILED, msg); } static_assert(true, "") #define ASSERT_THROWS(operation, exception_type, ...) if not consteval { try { operation; ASSERT_MSG(false, #operation " did not throw " #exception_type _LOCATION, __VA_ARGS__); } catch (exception_type &e) {} } static_assert(true, "")