added location to ASSERT()

This commit is contained in:
Patrick 2024-07-29 00:39:08 +02:00
parent dadebf0a4b
commit 00874526f5
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ constexpr auto make_copy(auto& value) -> std::remove_cvref_t<decltype(value)> {
#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, "")