105 {
107
108 bool terse_output = false;
109 if (argc > 1 && strcmp(
argv[1],
"--terse_output") == 0 )
110 terse_output = true;
111 else
112 printf(
"%s\n",
"Run this program with --terse_output to change the way "
113 "it prints its output.");
114
115 UnitTest& unit_test = *UnitTest::GetInstance();
116
117
118
119 if (terse_output) {
120 TestEventListeners& listeners = unit_test.listeners();
121
122
123
124
125
126 delete listeners.Release(listeners.default_result_printer());
127
128
129
130
131
132 listeners.Append(new TersePrinter);
133 }
135
136
137
138 int unexpectedly_failed_tests = 0;
139 for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
140 const TestCase& test_case = *unit_test.GetTestCase(i);
141 for (
int j = 0;
j < test_case.total_test_count(); ++
j) {
142 const TestInfo& test_info = *test_case.GetTestInfo(
j);
143
144
145 if (test_info.result()->Failed() &&
146 strcmp(test_info.name(), "Fails") != 0) {
147 unexpectedly_failed_tests++;
148 }
149 }
150 }
151
152
153 if (unexpectedly_failed_tests == 0)
154 ret_val = 0;
155
156 return ret_val;
157}
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
LOGGING_API void printf(Category category, const char *format,...)
GTEST_API_ void InitGoogleTest(int *argc, char **argv)