43 {
44
45
46
47
48
50 public:
51
52
53 enum Type {
54 kSuccess,
55 kNonFatalFailure,
56 kFatalFailure,
57 kSkip
58 };
59
60
61
62
63 TestPartResult(Type a_type, const char* a_file_name, int a_line_number,
64 const char* a_message)
65 : type_(a_type),
66 file_name_(a_file_name == nullptr ? "" : a_file_name),
67 line_number_(a_line_number),
68 summary_(ExtractSummary(a_message)),
69 message_(a_message) {}
70
71
72 Type
type()
const {
return type_; }
73
74
75
76 const char* file_name() const {
77 return file_name_.empty() ? nullptr : file_name_.c_str();
78 }
79
80
81
82 int line_number() const { return line_number_; }
83
84
85 const char* summary() const { return summary_.c_str(); }
86
87
88 const char*
message()
const {
return message_.c_str(); }
89
90
91 bool skipped() const { return type_ == kSkip; }
92
93
94 bool passed() const { return type_ == kSuccess; }
95
96
97 bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
98
99
100 bool fatally_failed() const { return type_ == kFatalFailure; }
101
102
103 bool failed() const { return fatally_failed() || nonfatally_failed(); }
104
105 private:
106 Type type_;
107
108
109
110 static std::string ExtractSummary(
const char*
message);
111
112
113
114 std::string file_name_;
115
116
117 int line_number_;
118 std::string summary_;
119 std::string message_;
120};
121
122
123std::ostream&
operator<<(std::ostream& os,
const TestPartResult& result);
124
125
126
127
128
130 public:
131 TestPartResultArray() {}
132
133
134 void Append(const TestPartResult& result);
135
136
137 const TestPartResult& GetTestPartResult(int index) const;
138
139
140 int size() const;
141
142 private:
143 std::vector<TestPartResult> array_;
144
146};
147
148
149class GTEST_API_ TestPartResultReporterInterface {
150 public:
151 virtual ~TestPartResultReporterInterface() {}
152
153 virtual void ReportTestPartResult(const TestPartResult& result) = 0;
154};
155
156namespace internal {
157
158
159
160
161
162
163
165 : public TestPartResultReporterInterface {
166 public:
167 HasNewFatalFailureHelper();
168 ~HasNewFatalFailureHelper() override;
169 void ReportTestPartResult(const TestPartResult& result) override;
170 bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
171 private:
172 bool has_new_fatal_failure_;
173 TestPartResultReporterInterface* original_reporter_;
174
176};
177
178}
179
180}
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
std::ostream & operator<<(std::ostream &os, const Message &sb)