libcryfs/test/assert/assert_debug_test.cpp

26 lines
555 B
C++
Raw Normal View History

2015-07-22 13:38:36 +02:00
#include <google/gtest/gtest.h>
#include <google/gmock/gmock.h>
//Include the ASSERT macro for a debug build
#undef NDEBUG
#include "../../assert/assert.h"
using testing::MatchesRegex;
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:25: my message"
);
}