1 #ifndef SIPLASPLAS_UTILITY_ASSERT_HPP 2 #define SIPLASPLAS_UTILITY_ASSERT_HPP 6 #include "preprocessor.hpp" 7 #include "exception.hpp" 8 #include <siplasplas/utility/export.hpp> 29 using std::logic_error::logic_error;
56 const std::string& message,
57 const std::string& file,
102 std::string _message;
105 std::function<void()> _onFailureCallback;
106 bool _assertionFailed;
130 template<
typename Function>
140 #define SIPLASPLAS_ASSERT_IMPL(MESSAGE, ...) ::cpp::AssertExpression((__VA_ARGS__), MESSAGE, __FILE__, __LINE__) 142 #define SIPLASPLAS_ASSERT_IMPL(MESSAGE, ...) ::cpp::DummyAssertExpression() 159 #define SIPLASPLAS_ASSERT(...) SIPLASPLAS_ASSERT_IMPL(SIPLASPLAS_PP_STR((__VA_ARGS__)), __VA_ARGS__) 199 #define SIPLASPLAS_ASSERT_COMP_IMPL(a, b, op, wording) SIPLASPLAS_ASSERT_IMPL(::fmt::format( \ 200 "Expected '{}' ({}) {} '{}' ({})", \ 201 SIPLASPLAS_PP_STR(a), \ 204 SIPLASPLAS_PP_STR(b), \ 226 #define SIPLASPLAS_ASSERT_EQ(a, b) SIPLASPLAS_ASSERT_COMP_IMPL(a, b, ==, "equal to") 247 #define SIPLASPLAS_ASSERT_NE(a, b) SIPLASPLAS_ASSERT_COMP_IMPL(a, b, !=, "not equal to") 268 #define SIPLASPLAS_ASSERT_BT(a, b) SIPLASPLAS_ASSERT_COMP_IMPL(a, b, > , "bigger than") 289 #define SIPLASPLAS_ASSERT_LT(a, b) SIPLASPLAS_ASSERT_COMP_IMPL(a, b, < , "less than") 310 #define SIPLASPLAS_ASSERT_BE(a, b) SIPLASPLAS_ASSERT_COMP_IMPL(a, b, >=, "bigger or equal to") 331 #define SIPLASPLAS_ASSERT_LE(a, b) SIPLASPLAS_ASSERT_COMP_IMPL(a, b, <=, "less or equal to") 333 #endif // SIPLASPLAS_UTILITY_ASSERT_HPP DummyAssertExpression & onFailure(Function)
Does nothing.
Definition: assert.hpp:131
Definition: canary_allocator.hpp:7
Represents an assertion error.
Definition: assert.hpp:26
Represents an assert expression when SIPLASPLAS_ASSERT() macros are disabled.
Definition: assert.hpp:116
Implements a siplasplas assertion.
Definition: assert.hpp:43