36 using testing::TestPartResult;
37 using testing::TestPartResultArray;
44 class TestPartResultTest :
public Test {
47 : r1_(TestPartResult::kSuccess,
"foo/bar.cc", 10,
"Success!"),
48 r2_(TestPartResult::kNonFatalFailure,
"foo/bar.cc", -1,
"Failure!"),
49 r3_(TestPartResult::kFatalFailure, nullptr, -1,
"Failure!"),
50 r4_(TestPartResult::kSkip,
"foo/bar.cc", 2,
"Skipped!") {}
52 TestPartResult r1_, r2_, r3_, r4_;
56 TEST_F(TestPartResultTest, ConstructorWorks) {
58 message <<
"something is terribly wrong";
60 message <<
"some unimportant stack trace";
62 const TestPartResult result(TestPartResult::kNonFatalFailure,
65 message.GetString().c_str());
67 EXPECT_EQ(TestPartResult::kNonFatalFailure, result.type());
70 EXPECT_STREQ(message.GetString().c_str(), result.message());
71 EXPECT_STREQ(
"something is terribly wrong", result.summary());
74 TEST_F(TestPartResultTest, ResultAccessorsWork) {
75 const TestPartResult success(TestPartResult::kSuccess,
85 const TestPartResult nonfatal_failure(TestPartResult::kNonFatalFailure,
95 const TestPartResult fatal_failure(TestPartResult::kFatalFailure,
105 const TestPartResult skip(TestPartResult::kSkip,
"file.cc", 42,
"message");
114 TEST_F(TestPartResultTest, type) {
115 EXPECT_EQ(TestPartResult::kSuccess, r1_.type());
116 EXPECT_EQ(TestPartResult::kNonFatalFailure, r2_.type());
117 EXPECT_EQ(TestPartResult::kFatalFailure, r3_.type());
118 EXPECT_EQ(TestPartResult::kSkip, r4_.type());
122 TEST_F(TestPartResultTest, file_name) {
129 TEST_F(TestPartResultTest, line_number) {
136 TEST_F(TestPartResultTest, message) {
142 TEST_F(TestPartResultTest, Passed) {
150 TEST_F(TestPartResultTest, Failed) {
158 TEST_F(TestPartResultTest, Skipped) {
166 TEST_F(TestPartResultTest, FatallyFailed) {
174 TEST_F(TestPartResultTest, NonfatallyFailed) {
183 class TestPartResultArrayTest :
public Test {
185 TestPartResultArrayTest()
186 : r1_(TestPartResult::kNonFatalFailure,
"foo/bar.cc", -1,
"Failure 1"),
187 r2_(TestPartResult::kFatalFailure,
"foo/bar.cc", -1,
"Failure 2") {}
189 const TestPartResult r1_, r2_;
193 TEST_F(TestPartResultArrayTest, InitialSizeIsZero) {
194 TestPartResultArray results;
200 TEST_F(TestPartResultArrayTest, ContainsGivenResultAfterAppend) {
201 TestPartResultArray results;
204 EXPECT_STREQ(
"Failure 1", results.GetTestPartResult(0).message());
209 TEST_F(TestPartResultArrayTest, ContainsGivenResultsAfterTwoAppends) {
210 TestPartResultArray results;
214 EXPECT_STREQ(
"Failure 1", results.GetTestPartResult(0).message());
215 EXPECT_STREQ(
"Failure 2", results.GetTestPartResult(1).message());
218 typedef TestPartResultArrayTest TestPartResultArrayDeathTest;
222 TEST_F(TestPartResultArrayDeathTest, DiesWhenIndexIsOutOfBound) {
223 TestPartResultArray results;
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex)
#define TEST_F(test_fixture, test_name)
#define EXPECT_STREQ(s1, s2)
GTEST_API_ const char kStackTraceMarker[]
#define EXPECT_EQ(val1, val2)
#define EXPECT_TRUE(condition)
#define EXPECT_FALSE(condition)