Loading...
Searching...
No Matches
Go to the documentation of this file.
19 #if defined FAST_RELEASE & defined NDEBUG
21 #define assert_release(ignore_test) ((void)0)
22 #define assert_release_constexpr(ignore_test) ((void)0)
28 #define CODAC_ASSERT_MESSAGE(test, file, line, function) \
30 throw std::invalid_argument( \
31 std::string("\n=============================================================================") \
32 + "\nThe following Codac assertion failed:\n\n\tIn function: " + std::string(function) + "\n\n\t" + std::string(test) \
33 + "\n\nIn file: " + std::string(file) + ":" + std::to_string(line) \
34 + "\nYou need help? Submit an issue on: https://github.com/codac-team/codac/issues" \
35 + "\n=============================================================================" \
39 #if defined(__PRETTY_FUNCTION__)
41 #define assert_release(test) \
44 CODAC_ASSERT_MESSAGE(#test, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
48 #define assert_release_constexpr(test) \
50 if constexpr(!(test)) { \
51 CODAC_ASSERT_MESSAGE(#test, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
57 #define assert_release(test) \
60 CODAC_ASSERT_MESSAGE(#test, __FILE__, __LINE__, __func__); \
64 #define assert_release_constexpr(test) \
66 if constexpr(!(test)) { \
67 CODAC_ASSERT_MESSAGE(#test, __FILE__, __LINE__, __func__); \
78 #define assert_release(test) \
81 auto l = std::source_location::current(); \
82 std::ostringstream s; \
83 s << l.file_name() << '(' \
85 << l.column() << ")\n " \
86 << l.function_name() << "\n"; \
87 throw std::invalid_argument("Wrong assertion in the following function:\n " + s.str()); \