1 // Formatting library for C++ - test main function. 2 // 3 // Copyright (c) 2012 - present, Victor Zverovich 4 // All rights reserved. 5 // 6 // For the license information refer to format.h. 7 8 #include <cstdlib> 9 10 #include "gtest/gtest.h" 11 12 #ifdef _WIN32 13 # include <windows.h> 14 #endif 15 16 #ifdef _MSC_VER 17 # include <crtdbg.h> 18 #endif 19 main(int argc,char ** argv)20int main(int argc, char** argv) { 21 #ifdef _WIN32 22 // Don't display any error dialogs. This also suppresses message boxes 23 // on assertion failures in MinGW where _set_error_mode/CrtSetReportMode 24 // doesn't help. 25 SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | 26 SEM_NOOPENFILEERRORBOX); 27 #endif 28 #ifdef _MSC_VER 29 // Disable message boxes on assertion failures. 30 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); 31 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); 32 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); 33 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); 34 #endif 35 try { 36 testing::InitGoogleTest(&argc, argv); 37 testing::FLAGS_gtest_death_test_style = "threadsafe"; 38 return RUN_ALL_TESTS(); 39 } catch (...) { 40 // Catch all exceptions to make Coverity happy. 41 } 42 return EXIT_FAILURE; 43 } 44