33 #include "gtest/gtest-test-part.h" 35 #include "gtest/gtest.h" 47 class TestPartResultTest :
public Test {
51 r2_(
TestPartResult::kNonFatalFailure,
"foo/bar.cc", -1,
"Failure!"),
58 TEST_F(TestPartResultTest, ConstructorWorks) {
60 message <<
"something is terribly wrong";
62 message <<
"some unimportant stack trace";
67 message.GetString().c_str());
69 EXPECT_EQ(TestPartResult::kNonFatalFailure, result.type());
72 EXPECT_STREQ(message.GetString().c_str(), result.message());
73 EXPECT_STREQ(
"something is terribly wrong", result.summary());
76 TEST_F(TestPartResultTest, ResultAccessorsWork) {
86 const TestPartResult nonfatal_failure(TestPartResult::kNonFatalFailure,
106 TEST_F(TestPartResultTest, type) {
107 EXPECT_EQ(TestPartResult::kSuccess, r1_.type());
108 EXPECT_EQ(TestPartResult::kNonFatalFailure, r2_.type());
109 EXPECT_EQ(TestPartResult::kFatalFailure, r3_.type());
113 TEST_F(TestPartResultTest, file_name) {
119 TEST_F(TestPartResultTest, line_number) {
125 TEST_F(TestPartResultTest, message) {
130 TEST_F(TestPartResultTest, Passed) {
137 TEST_F(TestPartResultTest, Failed) {
144 TEST_F(TestPartResultTest, FatallyFailed) {
151 TEST_F(TestPartResultTest, NonfatallyFailed) {
159 class TestPartResultArrayTest :
public Test {
161 TestPartResultArrayTest()
162 : r1_(
TestPartResult::kNonFatalFailure,
"foo/bar.cc", -1,
"Failure 1"),
163 r2_(
TestPartResult::kFatalFailure,
"foo/bar.cc", -1,
"Failure 2") {}
169 TEST_F(TestPartResultArrayTest, InitialSizeIsZero) {
176 TEST_F(TestPartResultArrayTest, ContainsGivenResultAfterAppend) {
185 TEST_F(TestPartResultArrayTest, ContainsGivenResultsAfterTwoAppends) {
194 typedef TestPartResultArrayTest TestPartResultArrayDeathTest;
198 TEST_F(TestPartResultArrayDeathTest, DiesWhenIndexIsOutOfBound) {
TEST_F(TestInfoTest, Names)
const char * message() const
#define EXPECT_TRUE(condition)
#define EXPECT_STREQ(expected, actual)
#define TEST_F(test_fixture, test_name)
#define EXPECT_FALSE(condition)
const TestPartResult & GetTestPartResult(int index) const
const char kStackTraceMarker[]
void Append(const TestPartResult &result)
#define EXPECT_EQ(expected, actual)
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex)