Go to the documentation of this file. 35 #define LIBCARLA_ASSERT_LEVEL_DEBUG 30 36 #define LIBCARLA_ASSERT_LEVEL_DEVELOPMENT 20 37 #define LIBCARLA_ASSERT_LEVEL_RELEASE 10 39 #ifndef LIBCARLA_ASSERT_LEVEL 41 # define LIBCARLA_ASSERT_LEVEL LIBCARLA_ASSERT_LEVEL_DEVELOPMENT 43 # define LIBCARLA_ASSERT_LEVEL LIBCARLA_ASSERT_LEVEL_DEBUG 45 #endif // LIBCARLA_ASSERT_LEVEL 47 #if (LIBCARLA_ASSERT_LEVEL >= LIBCARLA_ASSERT_LEVEL_DEBUG) 49 # error Cannot have debug asserts with NDEBUG enabled. 54 #if (LIBCARLA_ASSERT_LEVEL >= LIBCARLA_ASSERT_LEVEL_DEBUG) 55 # define DEBUG_ONLY(code) code 57 # define DEBUG_ONLY(code) 60 #if (LIBCARLA_ASSERT_LEVEL >= LIBCARLA_ASSERT_LEVEL_DEVELOPMENT) 61 # define DEVELOPMENT_ONLY(code) code 63 # define DEVELOPMENT_ONLY(code) 66 #define DEBUG_ASSERT(predicate) DEBUG_ONLY(assert(predicate)); 68 #define DEBUG_ERROR DEBUG_ASSERT(false); 70 #ifdef LIBCARLA_WITH_GTEST 71 # include <gtest/gtest.h> 73 # define DEBUG_ASSERT_EQ(lhs, rhs) DEBUG_ONLY(EXPECT_EQ(lhs, rhs));DEBUG_ASSERT(lhs == rhs); 74 # define DEBUG_ASSERT_NE(lhs, rhs) DEBUG_ONLY(EXPECT_NE(lhs, rhs));DEBUG_ASSERT(lhs != rhs); 76 # define DEBUG_ASSERT_EQ(lhs, rhs) DEBUG_ASSERT((lhs) == (rhs)) 77 # define DEBUG_ASSERT_NE(lhs, rhs) DEBUG_ASSERT((lhs) != (rhs)) 78 #endif // LIBCARLA_WITH_GTEST 80 #define LIBCARLA_ASSERT_THROW__(pred, msg) if (!(pred)) { ::carla::throw_exception(std::runtime_error(msg)); } 82 #define DEVELOPMENT_ASSERT(pred) DEVELOPMENT_ONLY(LIBCARLA_ASSERT_THROW__(pred, #pred)) 84 #define RELEASE_ASSERT(pred) LIBCARLA_ASSERT_THROW__(pred, #pred)