mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 05:12:55 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
225
sdk/lib/3rdparty/stlport/test/unit/cppunit/cppunit_mini.h
vendored
Normal file
225
sdk/lib/3rdparty/stlport/test/unit/cppunit/cppunit_mini.h
vendored
Normal file
|
@ -0,0 +1,225 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2004
|
||||
* Zdenek Nemec
|
||||
*
|
||||
* This material is provided "as is", with absolutely no warranty expressed
|
||||
* or implied. Any use is at your own risk.
|
||||
*
|
||||
* Permission to use or copy this software for any purpose is hereby granted
|
||||
* without fee, provided the above notices are retained on all copies.
|
||||
* Permission to modify the code and to distribute modified code is granted,
|
||||
* provided the above notices are retained, and a notice that the code was
|
||||
* modified is included with the above copyright notice.
|
||||
*
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _CPPUNITMPFR_H_
|
||||
#define _CPPUNITMPFR_H_
|
||||
|
||||
#if 0
|
||||
# define CPPUNIT_NS CppUnitMini
|
||||
#else
|
||||
# define CPPUNIT_NS
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if 0
|
||||
namespace CPPUNIT_NS
|
||||
{
|
||||
#endif
|
||||
class Reporter {
|
||||
public:
|
||||
virtual ~Reporter() {}
|
||||
virtual void error(const char * /*macroName*/, const char * /*in_macro*/, const char * /*in_file*/, int /*in_line*/) {}
|
||||
virtual void message( const char * /*msg*/ ) {}
|
||||
virtual void progress( const char * /*in_className*/, const char * /*in_testName*/, bool /*ignored*/, bool /* explicit */) {}
|
||||
virtual void end() {}
|
||||
virtual void printSummary() {}
|
||||
};
|
||||
|
||||
class TestFixture {
|
||||
public:
|
||||
virtual ~TestFixture() {}
|
||||
|
||||
//! \brief Set up context before running a test.
|
||||
virtual void setUp() {}
|
||||
|
||||
//! Clean up after the test run.
|
||||
virtual void tearDown() {}
|
||||
};
|
||||
|
||||
class TestCase : public TestFixture {
|
||||
public:
|
||||
TestCase() { registerTestCase(this); }
|
||||
|
||||
void setUp() { m_failed = false; }
|
||||
static int run(Reporter *in_reporter = 0, const char *in_testName = "", bool invert = false);
|
||||
int numErrors() { return m_numErrors; }
|
||||
static void registerTestCase(TestCase *in_testCase);
|
||||
|
||||
virtual void myRun(const char * /*in_name*/, bool /*invert*/ = false) {}
|
||||
|
||||
virtual void error(const char *in_macroName, const char *in_macro, const char *in_file, int in_line) {
|
||||
m_failed = true;
|
||||
if (m_reporter) {
|
||||
m_reporter->error(in_macroName, in_macro, in_file, in_line);
|
||||
}
|
||||
}
|
||||
|
||||
static void message(const char *msg) {
|
||||
if (m_reporter) {
|
||||
m_reporter->message(msg);
|
||||
}
|
||||
}
|
||||
|
||||
bool equalDoubles(double in_expected, double in_real, double in_maxErr) {
|
||||
double diff = in_expected - in_real;
|
||||
if (diff < 0.) {
|
||||
diff = -diff;
|
||||
}
|
||||
return diff < in_maxErr;
|
||||
}
|
||||
|
||||
virtual void progress(const char *in_className, const char *in_functionName, bool ignored, bool explicitTest) {
|
||||
++m_numTests;
|
||||
if (m_reporter) {
|
||||
m_reporter->progress(in_className, in_functionName, ignored, explicitTest);
|
||||
}
|
||||
}
|
||||
|
||||
bool shouldRunThis(const char *in_desiredTest, const char *in_className, const char *in_functionName,
|
||||
bool invert, bool explicit_test, bool &do_progress) {
|
||||
if ((in_desiredTest) && (in_desiredTest[0] != '\0')) {
|
||||
do_progress = false;
|
||||
const char *ptr = strstr(in_desiredTest, "::");
|
||||
if (ptr) {
|
||||
bool match = (strncmp(in_desiredTest, in_className, strlen(in_className)) == 0) &&
|
||||
(strncmp(ptr + 2, in_functionName, strlen(in_functionName)) == 0);
|
||||
// Invert shall not make explicit test run:
|
||||
return invert ? (match ? !match : !explicit_test)
|
||||
: match;
|
||||
}
|
||||
bool match = (strcmp(in_desiredTest, in_className) == 0);
|
||||
do_progress = match;
|
||||
return !explicit_test && (match == !invert);
|
||||
}
|
||||
do_progress = true;
|
||||
return !explicit_test;
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
if (m_failed)
|
||||
++m_numErrors;
|
||||
m_reporter->end();
|
||||
}
|
||||
|
||||
protected:
|
||||
static int m_numErrors;
|
||||
static int m_numTests;
|
||||
|
||||
private:
|
||||
static TestCase *m_root;
|
||||
TestCase *m_next;
|
||||
bool m_failed;
|
||||
|
||||
static Reporter *m_reporter;
|
||||
};
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined (CPPUNIT_MINI_HIDE_UNUSED_VARIABLE)
|
||||
# if defined (_MSC_VER)
|
||||
# define CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(v) (v);
|
||||
# else
|
||||
# define CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(v)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define CPPUNIT_TEST_SUITE(X) \
|
||||
typedef CPPUNIT_NS::TestCase Base; \
|
||||
virtual void myRun(const char *in_name, bool invert = false) { \
|
||||
const char *className = #X; CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(className) \
|
||||
bool ignoring = false; CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(ignoring)
|
||||
|
||||
#if defined CPPUNIT_MINI_USE_EXCEPTIONS
|
||||
# define CPPUNIT_TEST_BASE(X, Y) \
|
||||
{ \
|
||||
bool do_progress; \
|
||||
bool shouldRun = shouldRunThis(in_name, className, #X, invert, Y, do_progress); \
|
||||
if (shouldRun || do_progress) { \
|
||||
setUp(); \
|
||||
progress(className, #X, ignoring || !shouldRun, !ignoring && Y); \
|
||||
if (shouldRun && !ignoring) { \
|
||||
try { \
|
||||
X(); \
|
||||
} \
|
||||
catch(...) { \
|
||||
Base::error("Test Failed: An Exception was thrown.", #X, __FILE__, __LINE__); \
|
||||
} \
|
||||
} \
|
||||
tearDown(); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
# define CPPUNIT_TEST_BASE(X, Y) \
|
||||
{ \
|
||||
bool do_progress; \
|
||||
bool shouldRun = shouldRunThis(in_name, className, #X, invert, Y, do_progress); \
|
||||
if (shouldRun || do_progress) { \
|
||||
setUp(); \
|
||||
progress(className, #X, ignoring || !shouldRun, !ignoring && Y); \
|
||||
if (shouldRun && !ignoring) \
|
||||
X(); \
|
||||
tearDown(); \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define CPPUNIT_TEST(X) CPPUNIT_TEST_BASE(X, false)
|
||||
#define CPPUNIT_EXPLICIT_TEST(X) CPPUNIT_TEST_BASE(X, true)
|
||||
|
||||
#define CPPUNIT_IGNORE \
|
||||
ignoring = true
|
||||
|
||||
#define CPPUNIT_STOP_IGNORE \
|
||||
ignoring = false
|
||||
|
||||
#define CPPUNIT_TEST_SUITE_END() }
|
||||
|
||||
#define CPPUNIT_TEST_SUITE_REGISTRATION(X) static X local
|
||||
|
||||
#define CPPUNIT_CHECK(X) \
|
||||
if (!(X)) { \
|
||||
Base::error("CPPUNIT_CHECK", #X, __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
#define CPPUNIT_ASSERT(X) \
|
||||
if (!(X)) { \
|
||||
Base::error("CPPUNIT_ASSERT", #X, __FILE__, __LINE__); \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define CPPUNIT_FAIL { \
|
||||
Base::error("CPPUNIT_FAIL", "", __FILE__, __LINE__); \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define CPPUNIT_ASSERT_EQUAL(X, Y) \
|
||||
if ((X) != (Y)) { \
|
||||
Base::error("CPPUNIT_ASSERT_EQUAL", #X","#Y, __FILE__, __LINE__); \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define CPPUNIT_ASSERT_DOUBLES_EQUAL(X, Y, Z) \
|
||||
if (!equalDoubles((X), (Y), (Z))) { \
|
||||
Base::error("CPPUNIT_ASSERT_DOUBLES_EQUAL", #X","#Y","#Z, __FILE__, __LINE__); \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define CPPUNIT_MESSAGE(m) CPPUNIT_NS::TestCase::message(m)
|
||||
|
||||
#endif
|
31
sdk/lib/3rdparty/stlport/test/unit/cppunit/cppunit_proxy.h
vendored
Normal file
31
sdk/lib/3rdparty/stlport/test/unit/cppunit/cppunit_proxy.h
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2004
|
||||
* Zdenek Nemec
|
||||
*
|
||||
* This material is provided "as is", with absolutely no warranty expressed
|
||||
* or implied. Any use is at your own risk.
|
||||
*
|
||||
* Permission to use or copy this software for any purpose is hereby granted
|
||||
* without fee, provided the above notices are retained on all copies.
|
||||
* Permission to modify the code and to distribute modified code is granted,
|
||||
* provided the above notices are retained, and a notice that the code was
|
||||
* modified is included with the above copyright notice.
|
||||
*
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _CPPUNITPROXYINTERFACE_H_
|
||||
#define _CPPUNITPROXYINTERFACE_H_
|
||||
|
||||
/*
|
||||
* STLport specific
|
||||
*/
|
||||
#if !defined (CPPUNIT_MINI_USE_EXCEPTIONS) && \
|
||||
(!defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS))
|
||||
# define CPPUNIT_MINI_USE_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#include "cppunit_mini.h"
|
||||
|
||||
#endif
|
101
sdk/lib/3rdparty/stlport/test/unit/cppunit/cppunit_timer.h
vendored
Normal file
101
sdk/lib/3rdparty/stlport/test/unit/cppunit/cppunit_timer.h
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright (c) 2006
|
||||
* Francois Dumont
|
||||
*
|
||||
* This material is provided "as is", with absolutely no warranty expressed
|
||||
* or implied. Any use is at your own risk.
|
||||
*
|
||||
* Permission to use or copy this software for any purpose is hereby granted
|
||||
* without fee, provided the above notices are retained on all copies.
|
||||
* Permission to modify the code and to distribute modified code is granted,
|
||||
* provided the above notices are retained, and a notice that the code was
|
||||
* modified is included with the above copyright notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CPPUNIT_TIMER_H
|
||||
#define CPPUNIT_TIMER_H
|
||||
|
||||
#if defined (_WIN32)
|
||||
# define CPPUNIT_WIN32_TIMER
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
class Timer {
|
||||
public:
|
||||
Timer() {
|
||||
#if defined (CPPUNIT_WIN32_TIMER)
|
||||
m_start.LowPart = m_restart.LowPart = m_stop.LowPart = 0;
|
||||
m_start.HighPart = m_restart.HighPart = m_stop.HighPart = 0;
|
||||
QueryPerformanceFrequency(&m_frequency);
|
||||
#endif
|
||||
}
|
||||
|
||||
void start() {
|
||||
#if defined (CPPUNIT_WIN32_TIMER)
|
||||
QueryPerformanceCounter(&m_start);
|
||||
#endif
|
||||
}
|
||||
|
||||
void restart() {
|
||||
#if defined (CPPUNIT_WIN32_TIMER)
|
||||
QueryPerformanceCounter(&m_restart);
|
||||
if (m_start.HighPart == 0 && m_start.LowPart == 0) {
|
||||
m_start = m_restart;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void stop() {
|
||||
#if defined (CPPUNIT_WIN32_TIMER)
|
||||
LARGE_INTEGER stop;
|
||||
QueryPerformanceCounter(&stop);
|
||||
if ((m_stop.HighPart != 0 || m_stop.LowPart != 0) &&
|
||||
m_restart.HighPart != 0 && m_restart.LowPart != 0) {
|
||||
m_stop.HighPart += (stop.HighPart - m_restart.HighPart);
|
||||
if (stop.LowPart < m_restart.LowPart) {
|
||||
if (m_restart.LowPart - stop.LowPart > m_stop.LowPart) {
|
||||
m_stop.HighPart -= 1;
|
||||
}
|
||||
m_stop.LowPart -= m_restart.LowPart - stop.LowPart;
|
||||
}
|
||||
else {
|
||||
if (stop.LowPart - m_restart.LowPart > 0xFFFFFFFF - m_stop.LowPart) {
|
||||
m_stop.HighPart += 1;
|
||||
}
|
||||
m_stop.LowPart += stop.LowPart - m_restart.LowPart;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_stop = stop;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
double elapsedMilliseconds() const {
|
||||
#if defined (CPPUNIT_WIN32_TIMER)
|
||||
LARGE_INTEGER elapsed;
|
||||
elapsed.HighPart = m_stop.HighPart - m_start.HighPart;
|
||||
elapsed.LowPart = m_stop.LowPart - m_start.LowPart;
|
||||
return (double)elapsed.QuadPart / (double)m_frequency.QuadPart * 1000;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool supported() {
|
||||
#if defined (CPPUNIT_WIN32_TIMER)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
#if defined (CPPUNIT_WIN32_TIMER)
|
||||
LARGE_INTEGER m_frequency;
|
||||
LARGE_INTEGER m_start, m_stop, m_restart;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
145
sdk/lib/3rdparty/stlport/test/unit/cppunit/file_reporter.h
vendored
Normal file
145
sdk/lib/3rdparty/stlport/test/unit/cppunit/file_reporter.h
vendored
Normal file
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2004
|
||||
* Zdenek Nemec
|
||||
*
|
||||
* This material is provided "as is", with absolutely no warranty expressed
|
||||
* or implied. Any use is at your own risk.
|
||||
*
|
||||
* Permission to use or copy this software for any purpose is hereby granted
|
||||
* without fee, provided the above notices are retained on all copies.
|
||||
* Permission to modify the code and to distribute modified code is granted,
|
||||
* provided the above notices are retained, and a notice that the code was
|
||||
* modified is included with the above copyright notice.
|
||||
*
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _CPPUNITMINIFILEREPORTERINTERFACE_H_
|
||||
#define _CPPUNITMINIFILEREPORTERINTERFACE_H_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cppunit_timer.h"
|
||||
|
||||
//
|
||||
// CppUnit mini file(stream) reporter
|
||||
//
|
||||
class FileReporter : public CPPUNIT_NS::Reporter {
|
||||
private:
|
||||
FileReporter(const FileReporter&);
|
||||
FileReporter& operator=(const FileReporter&);
|
||||
public:
|
||||
// reporting to stderr
|
||||
explicit FileReporter(bool doMonitor = false):
|
||||
m_numErrors(0), m_numIgnored(0), m_numExplicit(0), m_numTests(0), _myStream(false),
|
||||
m_failed(false), m_doMonitor(doMonitor)
|
||||
{ _file = stderr; }
|
||||
|
||||
// reporting to the file with the given name
|
||||
explicit FileReporter(const char* file, bool doMonitor = false):
|
||||
m_numErrors(0), m_numIgnored(0), m_numExplicit(0), m_numTests(0), _myStream(true),
|
||||
m_failed(false), m_doMonitor(doMonitor)
|
||||
{
|
||||
#ifndef _STLP_USE_SAFE_STRING_FUNCTIONS
|
||||
_file = fopen(file, "w");
|
||||
#else
|
||||
fopen_s(&_file, file, "w");
|
||||
#endif
|
||||
}
|
||||
|
||||
// reporting to the given file
|
||||
explicit FileReporter(FILE* stream, bool doMonitor = false):
|
||||
m_numErrors(0), m_numIgnored(0), m_numExplicit(0), m_numTests(0), _myStream(false),
|
||||
m_failed(false), m_doMonitor(doMonitor)
|
||||
{ _file = stream; }
|
||||
|
||||
virtual ~FileReporter() {
|
||||
if (_myStream)
|
||||
fclose(_file);
|
||||
else
|
||||
fflush(_file);
|
||||
}
|
||||
|
||||
virtual void error(const char *in_macroName, const char *in_macro, const char *in_file, int in_line) {
|
||||
// Error might be called several times between 2 progress calls, we shouldn't however consider
|
||||
// that a test failed twice so we simply keep the info that test failed, number of failed tests
|
||||
// is computed later in end method.
|
||||
m_failed = true;
|
||||
fprintf(_file, "\n\n%s(%d) : %s(%s);", in_file, in_line, in_macroName, in_macro);
|
||||
}
|
||||
|
||||
virtual void message( const char *msg )
|
||||
{ fprintf(_file, "\n\t%s", msg ); }
|
||||
|
||||
virtual void progress(const char *in_className, const char *in_shortTestName, bool ignored, bool explicitTest) {
|
||||
if (m_doMonitor) {
|
||||
m_globalTimer.restart();
|
||||
m_testTimer.start();
|
||||
}
|
||||
++m_numTests;
|
||||
m_failed = false;
|
||||
if (ignored)
|
||||
++m_numIgnored;
|
||||
fprintf(_file, "%s::%s", in_className, in_shortTestName);
|
||||
if (ignored) {
|
||||
const char *ignoredReason;
|
||||
if (explicitTest) {
|
||||
++m_numExplicit;
|
||||
ignoredReason = " EXPLICIT";
|
||||
}
|
||||
else
|
||||
ignoredReason = " IGNORED";
|
||||
|
||||
fprintf(_file, "%s", ignoredReason);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void end() {
|
||||
if (m_doMonitor) {
|
||||
m_globalTimer.stop();
|
||||
m_testTimer.stop();
|
||||
fprintf(_file, " %f msec", m_testTimer.elapsedMilliseconds());
|
||||
}
|
||||
if (m_failed) {
|
||||
++m_numErrors;
|
||||
}
|
||||
fprintf(_file, "\n");
|
||||
}
|
||||
|
||||
virtual void printSummary() {
|
||||
if (m_numErrors > 0) {
|
||||
fprintf(_file, "\nThere were errors! %d of %d tests", m_numErrors, m_numTests);
|
||||
}
|
||||
else {
|
||||
fprintf(_file, "\nOK %d tests", m_numTests);
|
||||
}
|
||||
|
||||
if (m_numIgnored > 0) {
|
||||
fprintf(_file, ", %d ignored", m_numIgnored);
|
||||
}
|
||||
|
||||
if (m_numExplicit > 0) {
|
||||
fprintf(_file, " (%d explicit)", m_numExplicit);
|
||||
}
|
||||
|
||||
if (m_doMonitor) {
|
||||
fprintf(_file, " %f msec", m_globalTimer.elapsedMilliseconds());
|
||||
}
|
||||
|
||||
fprintf(_file, "\n\n");
|
||||
}
|
||||
private:
|
||||
int m_numErrors;
|
||||
int m_numIgnored;
|
||||
int m_numExplicit;
|
||||
int m_numTests;
|
||||
// flag whether we own '_file' and are thus responsible for releasing it in the destructor
|
||||
bool _myStream;
|
||||
bool m_failed;
|
||||
bool m_doMonitor;
|
||||
Timer m_globalTimer, m_testTimer;
|
||||
FILE* _file;
|
||||
};
|
||||
|
||||
#endif /*_CPPUNITMINIFILEREPORTERINTERFACE_H_*/
|
140
sdk/lib/3rdparty/stlport/test/unit/cppunit/test_main.cpp
vendored
Normal file
140
sdk/lib/3rdparty/stlport/test/unit/cppunit/test_main.cpp
vendored
Normal file
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2004
|
||||
* Zdenek Nemec
|
||||
*
|
||||
* This material is provided "as is", with absolutely no warranty expressed
|
||||
* or implied. Any use is at your own risk.
|
||||
*
|
||||
* Permission to use or copy this software for any purpose is hereby granted
|
||||
* without fee, provided the above notices are retained on all copies.
|
||||
* Permission to modify the code and to distribute modified code is granted,
|
||||
* provided the above notices are retained, and a notice that the code was
|
||||
* modified is included with the above copyright notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "cppunit_proxy.h"
|
||||
#include "file_reporter.h"
|
||||
#include "cppunit_timer.h"
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
#if 0
|
||||
namespace CPPUNIT_NS
|
||||
{
|
||||
#endif
|
||||
int TestCase::m_numErrors = 0;
|
||||
int TestCase::m_numTests = 0;
|
||||
|
||||
TestCase *TestCase::m_root = 0;
|
||||
Reporter *TestCase::m_reporter = 0;
|
||||
|
||||
void TestCase::registerTestCase(TestCase *in_testCase) {
|
||||
in_testCase->m_next = m_root;
|
||||
m_root = in_testCase;
|
||||
}
|
||||
|
||||
int TestCase::run(Reporter *in_reporter, const char *in_testName, bool invert) {
|
||||
TestCase::m_reporter = in_reporter;
|
||||
|
||||
m_numErrors = 0;
|
||||
m_numTests = 0;
|
||||
|
||||
TestCase *tmp = m_root;
|
||||
while (tmp != 0) {
|
||||
tmp->myRun(in_testName, invert);
|
||||
tmp = tmp->m_next;
|
||||
}
|
||||
return m_numErrors;
|
||||
}
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
|
||||
static void usage(const char* name)
|
||||
{
|
||||
printf("Usage : %s [-t=<class>[::<test>]] [-x=<class>[::<test>]] [-f=<file>]%s\n",
|
||||
name, Timer::supported() ? " [-m]": "");
|
||||
printf("\t[-t=<class>[::<test>]] : test class or class::test to execute;\n");
|
||||
printf("\t[-x=<class>[::<test>]] : test class or class::test to exclude from execution;\n");
|
||||
printf("\t[-f=<file>] : output file");
|
||||
if (Timer::supported())
|
||||
printf(";\n\t[-m] : monitor test execution, display time duration for each test\n");
|
||||
else
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
// CppUnit(mini) test launcher
|
||||
// command line option syntax:
|
||||
// test [OPTIONS]
|
||||
// where OPTIONS are
|
||||
// -t=CLASS[::TEST] run the test class CLASS or member test CLASS::TEST
|
||||
// -x=CLASS[::TEST] run all except the test class CLASS or member test CLASS::TEST
|
||||
// -f=FILE save output in file FILE instead of stdout
|
||||
// -m monitor test(s) execution
|
||||
const char *fileName = 0;
|
||||
const char *testName = "";
|
||||
const char *xtestName = "";
|
||||
bool doMonitoring = false;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (argv[i][0] == '-') {
|
||||
if (!strncmp(argv[i], "-t=", 3)) {
|
||||
testName = argv[i]+3;
|
||||
continue;
|
||||
}
|
||||
else if (!strncmp(argv[i], "-f=", 3)) {
|
||||
fileName = argv[i]+3;
|
||||
continue;
|
||||
}
|
||||
else if (!strncmp(argv[i], "-x=", 3)) {
|
||||
xtestName = argv[i]+3;
|
||||
continue;
|
||||
}
|
||||
else if (Timer::supported() && !strncmp(argv[i], "-m", 2)) {
|
||||
doMonitoring = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// invalid option, we display normal usage.
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
CPPUNIT_NS::Reporter* reporter;
|
||||
if (fileName != 0)
|
||||
reporter = new FileReporter(fileName, doMonitoring);
|
||||
else
|
||||
reporter = new FileReporter(stdout, doMonitoring);
|
||||
|
||||
int num_errors;
|
||||
if (xtestName[0] != 0) {
|
||||
num_errors = CPPUNIT_NS::TestCase::run(reporter, xtestName, true);
|
||||
} else {
|
||||
num_errors = CPPUNIT_NS::TestCase::run(reporter, testName);
|
||||
}
|
||||
|
||||
reporter->printSummary();
|
||||
delete reporter;
|
||||
|
||||
return num_errors;
|
||||
}
|
||||
|
||||
// See doc/README.intel for explanation about this code
|
||||
#if defined (STLPORT) && defined (__ICL) && (__ICL >= 900) && \
|
||||
(_STLP_MSVC_LIB < 1300) && defined (_STLP_USE_DYNAMIC_LIB)
|
||||
# include <exception>
|
||||
|
||||
# undef std
|
||||
namespace std
|
||||
{
|
||||
void _STLP_CALL unexpected() {
|
||||
unexpected_handler hdl;
|
||||
set_unexpected(hdl = set_unexpected((unexpected_handler)0));
|
||||
hdl();
|
||||
}
|
||||
}
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue