1 #ifndef MASSTREE_TESTRUNNER_HH
2 #define MASSTREE_TESTRUNNER_HH
6 class testrunner_base {
8 testrunner_base(const lcdf::String& name)
9 : name_(name), next_(0) {
10 thehead ? thetail->next_ = this : thehead = this;
13 virtual ~testrunner_base() {
15 const lcdf::String& name() const {
18 static testrunner_base* first() {
21 static testrunner_base* find(const lcdf::String& name) {
22 testrunner_base* t = thehead;
23 while (t && t->name_ != name)
27 static void print_names(FILE* stream, int maxcol);
29 static testrunner_base* thehead;
30 static testrunner_base* thetail;
32 testrunner_base* next_;
35 #ifdef TESTRUNNER_CLIENT_TYPE
37 class testrunner : public testrunner_base {
39 inline testrunner(const lcdf::String& name)
40 : testrunner_base(name) {
42 static testrunner* first() {
43 return static_cast<testrunner*>(testrunner_base::first());
45 static testrunner* find(const lcdf::String& name) {
46 return static_cast<testrunner*>(testrunner_base::find(name));
48 virtual void run(TESTRUNNER_CLIENT_TYPE) = 0;
51 #define MAKE_TESTRUNNER(name, text) \
53 class testrunner_##name : public testrunner { \
55 testrunner_##name() : testrunner(#name) {} \
56 void run(TESTRUNNER_CLIENT_TYPE client) { text; client.finish(); } \
57 }; static testrunner_##name testrunner_##name##_instance; }