fmt/test/test-main.cc

44 lines
1.2 KiB
C++
Raw Normal View History

2018-03-04 17:16:51 +00:00
// Formatting library for C++ - test main function.
//
// Copyright (c) 2012 - present, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.
2014-05-02 13:33:21 +00:00
2015-10-18 16:16:10 +00:00
#include <cstdlib>
2020-05-07 22:59:46 +00:00
#include "gtest/gtest.h"
2014-05-02 13:33:21 +00:00
#ifdef _WIN32
2019-01-13 02:27:38 +00:00
# include <windows.h>
#endif
#ifdef _MSC_VER
2019-01-13 02:27:38 +00:00
# include <crtdbg.h>
2014-05-02 13:33:21 +00:00
#endif
2019-01-13 02:27:38 +00:00
int main(int argc, char** argv) {
#ifdef _WIN32
// Don't display any error dialogs. This also suppresses message boxes
// on assertion failures in MinGW where _set_error_mode/CrtSetReportMode
// doesn't help.
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
2019-01-13 02:27:38 +00:00
SEM_NOOPENFILEERRORBOX);
#endif
#ifdef _MSC_VER
2014-05-02 13:33:21 +00:00
// Disable message boxes on assertion failures.
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
#endif
2015-10-18 16:16:10 +00:00
try {
testing::InitGoogleTest(&argc, argv);
2021-07-29 13:56:38 +00:00
testing::FLAGS_gtest_death_test_style = "threadsafe";
2015-10-18 16:16:10 +00:00
return RUN_ALL_TESTS();
} catch (...) {
// Catch all exceptions to make Coverity happy.
}
return EXIT_FAILURE;
2014-05-02 13:33:21 +00:00
}