diff options
Diffstat (limited to '_test/meowpp.h')
-rw-r--r-- | _test/meowpp.h | 55 |
1 files changed, 17 insertions, 38 deletions
diff --git a/_test/meowpp.h b/_test/meowpp.h index 94ff3ec..8e6e181 100644 --- a/_test/meowpp.h +++ b/_test/meowpp.h @@ -5,51 +5,30 @@ #include "meowpp/geo/Vector3D.h" #include "meowpp/Usage.h" -#include "meowpp/oo/Register_Implement.h" #include "meowpp/oo/Properties.h" +#include "meowpp/oo/ObjBase.h" +#include "meowpp/oo/ObjSelector.h" -extern meow::Usage usg, usg2; extern int count; -////////////////////////////////// -class TestFunctions: public meow::RegisterInterface<int>{ - public: - TestFunctions(): RegisterInterface(){ - usg2.addOption('t', - "Specify which part of the template to test", - "name", "", - false); - } - bool regImplement(meow::ImplementInterface<int>* imp, - std::string const& str){ - usg2.addOptionValueAccept('t', - meow::stringPrintf("%d", imp->identify()), - str); - return RegisterInterface::regImplement(imp); - } -}; -extern TestFunctions tests; -//////////////////////// -class TestFunction: public meow::ImplementInterface<int>{ - private: - std::string _name; + +class TestFunction: public meow::ObjBase{ public: - TestFunction(std::string const& __name): - ImplementInterface(count++), _name("testing code about " + __name){ - tests.regImplement(this, _name); - } - virtual ~TestFunction(){ } + virtual ~TestFunction(){ }; virtual bool run() = 0; - std::string name() const{ return _name; } + virtual std::string name () const = 0; + virtual std::string description() const = 0; }; -//////////////////////// -#define concat(a,b) a##b -#define TEST(a) \ -class Test_##a: public TestFunction{ \ +#define TEST(__A,__B) \ +class Test##__A: public TestFunction{ \ public: \ - Test_##a(): TestFunction(#a){ } \ - bool run();\ -} __test_##a; bool Test_##a::run() - + \ + meow::ObjBase* create() const{ return new Test##__A(); } \ + bool run(); \ + std::string name() const{ return #__A; } \ + std::string description() const{ return __B; } \ +}; \ +static meow::ObjSelector<0> _(meow::stringPrintf("%d", count++), new Test##__A()); \ +inline bool Test##__A::run() #endif // __meowpp_h__ |