VCCC  2024.05
VisualCamp Common C++ library
assert.hpp
Go to the documentation of this file.
1 # /*
2 # * Created by YongGyu Lee on 2020/12/08.
3 # */
4 #
5 # ifndef VCCC_UTILITY_ASSERT_HPP
6 # define VCCC_UTILITY_ASSERT_HPP
7 #
8 # include <cassert>
9 
13 
14 # define ASSERT_IMPL(expr, msg) assert(((void)(msg), (expr)))
15 
17 
20 
21 
22 # define EXPECTS(expr, msg) ASSERT_IMPL(expr, msg)
23 # define ENSURES(expr, msg) ASSERT_IMPL(expr, msg)
24 
25 # define BOUNDS_ASSERT(index, size) EXPECTS((index) < (size), "index out of bounds")
26 
27 # define ALWAYS_ASSERT(msg) ASSERT_IMPL(false, msg)
28 
30 
31 # endif // VCCC_UTILITY_ASSERT_HPP