Update contrib.
2 * Copyright (c) 2003, 2004
5 * This material is provided "as is", with absolutely no warranty expressed
6 * or implied. Any use is at your own risk.
8 * Permission to use or copy this software for any purpose is hereby granted
9 * without fee, provided the above notices are retained on all copies.
10 * Permission to modify the code and to distribute modified code is granted,
11 * provided the above notices are retained, and a notice that the code was
12 * modified is included with the above copyright notice.
16 #include "cppunit_proxy.h"
17 #include "file_reporter.h"
18 #include "cppunit_timer.h"
22 int CPPUNIT_NS::TestCase::m_numErrors = 0;
23 int CPPUNIT_NS::TestCase::m_numTests = 0;
25 CPPUNIT_NS::TestCase *CPPUNIT_NS::TestCase::m_root = 0;
26 CPPUNIT_NS::Reporter *CPPUNIT_NS::TestCase::m_reporter = 0;
28 void CPPUNIT_NS::TestCase::registerTestCase(TestCase *in_testCase) {
29 in_testCase->m_next = m_root;
33 int CPPUNIT_NS::TestCase::run(Reporter *in_reporter, const char *in_testName, bool invert) {
34 TestCase::m_reporter = in_reporter;
39 TestCase *tmp = m_root;
41 in_reporter->setFirstStep(true);
42 tmp->myRun(in_testName, invert);
49 int main(int argc, char** argv) {
51 // CppUnit(mini) test launcher
52 // command line option syntax:
55 // -t=CLASS[::TEST] run the test class CLASS or member test CLASS::TEST
56 // -x=CLASS[::TEST] run all except the test class CLASS or member test CLASS::TEST
57 // -f=FILE save output in file FILE instead of stdout
58 // -m monitor test(s) execution
62 bool doMonitoring = false;
64 for (int i = 1; i < argc; ++i) {
65 if (argv[i][0] != '-')
67 if (!strncmp(argv[i], "-t=", 3)) {
70 else if (!strncmp(argv[i], "-f=", 3)) {
73 else if (!strncmp(argv[i], "-x=", 3)) {
74 xtestName = argv[i]+3;
76 else if (Timer::supported() && !strncmp(argv[i], "-m", 2)) {
81 CPPUNIT_NS::Reporter* reporter;
83 reporter = new FileReporter(fileName, doMonitoring);
85 reporter = new FileReporter(stdout, doMonitoring);
88 if (xtestName[0] != 0) {
89 num_errors = CPPUNIT_NS::TestCase::run(reporter, xtestName, true);
91 num_errors = CPPUNIT_NS::TestCase::run(reporter, testName);
94 reporter->printSummary();
100 // See doc/README.intel for explanation about this code
101 #if defined (STLPORT) && defined (__ICL) && (__ICL >= 900) && \
102 (_STLP_MSVC_LIB < 1300) && defined (_STLP_USE_DYNAMIC_LIB)
103 # include <exception>
108 void _STLP_CALL unexpected() {
109 unexpected_handler hdl;
110 set_unexpected(hdl = set_unexpected((unexpected_handler)0));