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