Improved REGISTER_TEST() macro to support several occurrences within a single file

This commit is contained in:
PKEuS 2015-10-07 14:30:01 +02:00
parent 07b661ef62
commit 93dbfb72d1
3 changed files with 10 additions and 17 deletions

View File

@ -1262,4 +1262,5 @@ private:
"[test.c:1]: (error) Mismatching allocation and deallocation: MyHeap\n[test.c:1]: (error) Memory leak: b\n", errout.str());
}
};
static TestLeakAutoVarWindows testLeakAutoVarWindows;
REGISTER_TEST(TestLeakAutoVarWindows)

View File

@ -107,7 +107,7 @@ private:
}
};
static TestMemleak testMemleak;
REGISTER_TEST(TestMemleak)
@ -4288,15 +4288,7 @@ private:
}
};
static TestMemleakInFunction testMemleakInFunction;
REGISTER_TEST(TestMemleakInFunction)
@ -5558,7 +5550,7 @@ private:
}
};
static TestMemleakInClass testMemleakInClass;
REGISTER_TEST(TestMemleakInClass)
@ -6180,8 +6172,7 @@ private:
}
};
static TestMemleakStructMember testMemleakStructMember;
REGISTER_TEST(TestMemleakStructMember)
@ -6505,7 +6496,7 @@ private:
ASSERT_EQUALS("[test.c:1]: (error) Memory leak: a\n", errout.str());
}
};
static TestMemleakGLib testMemleakGLib;
REGISTER_TEST(TestMemleakGLib)
@ -6555,4 +6546,5 @@ private:
TODO_ASSERT_EQUALS("", "[test.c:1]: (error) Resource leak: hFile\n", errout.str());
}
};
static TestMemleakWindows testMemleakWindows;
REGISTER_TEST(TestMemleakWindows)

View File

@ -90,7 +90,7 @@ extern std::ostringstream warnings;
#define ASSERT_THROW( CMD, EXCEPTION ) try { CMD ; assertThrowFail(__FILE__, __LINE__); } catch (const EXCEPTION&) { } catch (...) { assertThrowFail(__FILE__, __LINE__); }
#define TODO_ASSERT( CONDITION ) { bool condition=CONDITION; todoAssertEquals(__FILE__, __LINE__, true, false, condition); }
#define TODO_ASSERT_EQUALS( WANTED , CURRENT , ACTUAL ) todoAssertEquals(__FILE__, __LINE__, WANTED, CURRENT, ACTUAL)
#define REGISTER_TEST( CLASSNAME ) namespace { CLASSNAME instance; }
#define REGISTER_TEST( CLASSNAME ) namespace { CLASSNAME instance_##CLASSNAME; }
#ifdef _WIN32
#define LOAD_LIB_2( LIB, NAME ) { if (((LIB).load("./testrunner", "../cfg/" NAME).errorcode != Library::OK) && ((LIB).load("./testrunner", "cfg/" NAME).errorcode != Library::OK)) { complainMissingLib(NAME); return; } }