#include <stdio.h>
#include "gtest/gtest.h"
Go to the source code of this file.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 108 of file sample9_unittest.cc.
References i, testing::InitGoogleTest(), RUN_ALL_TESTS(), and gmock_test_utils::TestCase.
111 bool terse_output =
false;
112 if (argc > 1 && strcmp(
argv[1],
"--terse_output") == 0 )
115 printf(
"%s\n",
"Run this program with --terse_output to change the way " 116 "it prints its output.");
118 UnitTest& unit_test = *UnitTest::GetInstance();
123 TestEventListeners& listeners = unit_test.listeners();
129 delete listeners.Release(listeners.default_result_printer());
135 listeners.Append(
new TersePrinter);
141 int unexpectedly_failed_tests = 0;
142 for (
int i = 0;
i < unit_test.total_test_case_count(); ++
i) {
143 const TestCase& test_case = *unit_test.GetTestCase(
i);
144 for (
int j = 0; j < test_case.total_test_count(); ++j) {
145 const TestInfo& test_info = *test_case.GetTestInfo(j);
148 if (test_info.result()->Failed() &&
149 strcmp(test_info.name(),
"Fails") != 0) {
150 unexpectedly_failed_tests++;
156 if (unexpectedly_failed_tests == 0)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
GTEST_API_ void InitGoogleTest(int *argc, char **argv)