class TestCase : public TestFixture {
public:
- TestCase() { registerTestCase(this); }
+ TestCase()
+ {
+ registerTestCase(this);
+ }
void setUp() { m_failed = false; }
static int run(Reporter *in_reporter = 0, const char *in_testName = "", bool invert = false);
m_reporter->error(in_macroName, in_macro, in_file, in_line);
}
}
+ virtual char const * test_name() const = 0;
static void message(const char *msg) {
if (m_reporter) {
static void print_gc_state();
- static std::vector<std::string> const& getTestStrings();
+ static std::vector<std::string> const& getTestStrings();
template <typename RandomIt>
static void shuffle( RandomIt first, RandomIt last )
std::shuffle( first, last, m_RandomGen );
}
+ static void print_test_list();
+
protected:
static std::vector<std::string> m_arrStrings ; // array of test strings
#define CPPUNIT_TEST_SUITE_(X, cfgBranchName) \
typedef CppUnitMini::TestCase Base; \
+ virtual char const * test_name() const { return #X; } \
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) \
setUpParams( m_Cfg.get( cfgBranchName ));
-#define CPPUNIT_TEST_SUITE_PART(X, func) \
- void X::func(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)
-
#define CPPUNIT_TEST_SUITE(X) CPPUNIT_TEST_SUITE_(X, #X)
#if defined CPPUNIT_MINI_USE_EXCEPTIONS
#define CPPUNIT_TEST_SUITE_END() endTestCase(); }
#define CPPUNIT_TEST_SUITE_END_PART() }
-#define CPPUNIT_TEST_SUITE_REGISTRATION(X) static X local
#define CPPUNIT_TEST_SUITE_REGISTRATION_(X, NAME) static X NAME
+#define CPPUNIT_TEST_SUITE_REGISTRATION(X) CPPUNIT_TEST_SUITE_REGISTRATION_(X, local)
#define CPPUNIT_CHECK(X) \
if (!(X)) { \
return !explicit_test && (match == !invert);
}
do_progress = true;
+
return !explicit_test;
}
}
}
+ void TestCase::print_test_list()
+ {
+ TestCase *tmp = m_root;
+ std::cout << "Test list:\n";
+ while (tmp != 0) {
+ std::cout << "\t" << tmp->test_name() << "\n";
+ tmp = tmp->m_next;
+ }
+ }
+
void Config::load( const char * fileName )
{
std::ifstream s;
s.close();
}
- std::vector<std::string> const & TestCase::getTestStrings()
+ std::vector<std::string> const & TestCase::getTestStrings()
{
if ( m_arrStrings.empty() ) {
std::string strTestDir = m_strTestDataDir;
static void usage(const char* name)
{
- printf("Usage : %s [-t=<class>[::<test>]] [-x=<class>[::<test>]] [-f=<file>] [-m]\n", name);
- 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[-d=dir] : test data directory (default is .)\n");
- printf( "\t[-f=<file>] : output file\n" );
- //printf(";\n\t[-m] : monitor test execution, display time duration for each test\n");
- printf( "\t[-exact-match] : class::test should be exactly matched to existing test\n" );
- printf("\t[-gc_state] : print gc state after each test\n");
- printf("\t[-cfg=<file>] : config file name for tests\n");
+ std::cout << "Usage: " << name << " [options] [-t=<class>[::<test>]] [-x=<class>[::<test>]] [-f=<file>]\n"
+ "\t[-t=<class>[::<test>]] : test class or class::test to execute\n"
+ "\t[-d=dir] : test data directory (default is .)\n"
+ "\t[-f=<file>] : output file\n"
+ "Options:\n"
+ "\t-exact-match - class::test should be exactly matched to existing test\n"
+ "\t-gc_state - print gc state after each test\n"
+ "\t-cfg=<file> - config file name for tests\n"
+ "\t-list - list all tests\n"
+ "\t"
+ << std::endl;
}
int main(int argc, char** argv)
CppUnitMini::TestCase::m_bExactMatch = true;
continue;
}
+ else if (strncmp(argv[i], "-list", 5) == 0) {
+ CppUnitMini::TestCase::print_test_list();
+ return 0;
+ }
else if ( strncmp(argv[i], "-gc_state", 9) == 0 ) {
CppUnitMini::TestCase::m_bPrintGCState = true;
continue;
{
std::cout
<< "System topology:\n"
- << " Logical processor count: " << cds::OS::topology::processor_count() << "\n";
+ << " Logical processor count: " << std::thread::hardware_concurrency() << "\n";
std::cout << std::endl;
}
};
template <typename GC, typename K, typename T, typename Traits >
- static inline void print_stat( cc::MultiLevelHashMap< GC, K, T, Traits > const& m )
+ static inline void print_stat( MultiLevelHashMap< GC, K, T, Traits > const& m )
{
CPPUNIT_MSG( m.statistics() );
}
};
template <typename GC, typename T, typename Traits >
- static inline void print_stat( cc::MultiLevelHashSet< GC, T, Traits > const& s )
+ static inline void print_stat( MultiLevelHashSet< GC, T, Traits > const& s )
{
CPPUNIT_MSG( s.statistics() );
}