| |
42 |
42 |
printf("Unit tests execution FAILED (successful: %ld, failed: %ld, elapsed time: %I64d ms)\n>\n", |
| |
43 |
43 |
unit_test.successful_test_count(), |
| |
44 |
44 |
unit_test.failed_test_count(), |
| |
45 |
45 |
unit_test.elapsed_time()); |
| |
46 |
46 |
} |
| |
47 |
47 |
else |
| |
48 |
48 |
{ |
| |
49 |
49 |
printf("Unit tests execution succeeded (successful: %ld, failed: %ld, elapsed time: %I64d ms)\n>\n", |
| |
50 |
50 |
unit_test.successful_test_count(), |
| |
51 |
51 |
unit_test.failed_test_count(), |
| |
52 |
52 |
unit_test.elapsed_time()); |
| |
53 |
53 |
} |
| |
54 |
54 |
} |
| |
55 |
55 |
|
| |
56 |
56 |
private: |
| |
57 |
57 |
std::string m_strTestName; |
| |
58 |
58 |
}; |
| |
59 |
59 |
|
| |
60 |
60 |
#ifdef _CONSOLE |
| |
61 |
61 |
int _tmain(int argc, _TCHAR* argv[]) |
| |
62 |
|
{ |
| |
63 |
|
testing::InitGoogleMock(&argc, argv); |
| |
64 |
|
::testing::FLAGS_gtest_death_test_style = "fast"; |
| |
65 |
|
::testing::FLAGS_gtest_print_time = 1; |
| |
66 |
|
|
| |
67 |
|
::testing::TestEventListeners& listeners = ::testing::UnitTest::GetInstance()->listeners(); |
| |
68 |
|
delete listeners.Release(listeners.default_result_printer()); |
| |
69 |
|
listeners.Append(new TFailedOutputPrinter); |
| |
70 |
|
|
| |
71 |
|
return RUN_ALL_TESTS(); |
| |
72 |
|
} |
| |
73 |
62 |
#else |
| |
74 |
63 |
extern "C" |
| |
75 |
64 |
__declspec(dllexport) int __stdcall RunTests(int argc, TCHAR* argv[]) |
| |
|
65 |
#endif |
| |
76 |
66 |
{ |
| |
77 |
67 |
testing::InitGoogleMock(&argc, argv); |
| |
78 |
68 |
::testing::FLAGS_gtest_death_test_style = "fast"; |
| |
79 |
69 |
::testing::FLAGS_gtest_print_time = 1; |
| |
80 |
70 |
|
| |
|
71 |
bool bUseStdFormat = false; |
| |
|
72 |
for(int iIndex = 1; iIndex < argc; ++iIndex) |
| |
|
73 |
{ |
| |
|
74 |
if(_tcscmp(argv[ iIndex ], _T("--stdformat")) == 0) |
| |
|
75 |
{ |
| |
|
76 |
bUseStdFormat = true; |
| |
|
77 |
break; |
| |
|
78 |
} |
| |
|
79 |
} |
| |
|
80 |
|
| |
|
81 |
if(!bUseStdFormat) |
| |
|
82 |
{ |
| |
81 |
83 |
::testing::TestEventListeners& listeners = ::testing::UnitTest::GetInstance()->listeners(); |
| |
82 |
84 |
delete listeners.Release(listeners.default_result_printer()); |
| |
83 |
85 |
listeners.Append(new TFailedOutputPrinter); |
| |
|
86 |
} |
| |
84 |
87 |
|
| |
85 |
88 |
return RUN_ALL_TESTS(); |
| |
86 |
89 |
} |
| |
|
90 |
|
| |
87 |
91 |
#endif |
| |
88 |
|
#endif |