libcryfs/test/cpp-utils/assert/assert_debug_test.cpp
Sebastian Messmer cc7b38b3c1 - run-clang-tidy.sh also runs on test cases.
- fix clang-tidy warnings in test cases
2017-12-01 15:01:49 +00:00

26 lines
521 B
C++

#include <gtest/gtest.h>
#include <gmock/gmock.h>
//Include the ASSERT macro for a debug build
#undef NDEBUG
#include "cpp-utils/assert/assert.h"
TEST(AssertTest_DebugBuild, DoesntDieIfTrue) {
ASSERT(true, "bla");
}
TEST(AssertTest_DebugBuild, DiesIfFalse) {
EXPECT_DEATH(
ASSERT(false, "bla"),
""
);
}
TEST(AssertTest_DebugBuild, AssertMessage) {
EXPECT_DEATH(
ASSERT(2==5, "my message"),
"Assertion \\[2==5\\] failed in .*/assert_debug_test.cpp:[0-9]+: my message"
);
}