aboutsummaryrefslogblamecommitdiffstats
path: root/_test/meowpp.h
blob: 8052f1aa12ee837d30dbe9a1320d28bf5ab721c4 (plain) (tree)
1
2
3
4
5
6
7
8


                      


                                

                                         












































                                                                          
                      
#ifndef   __meowpp_h__
#define   __meowpp_h__

#include "meowpp/geo/Vector2D.h"
#include "meowpp/geo/Vector3D.h"

#include "meowpp/Usage.h"
#include "meowpp/oo/Register_Implement.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;
  public:
    TestFunction(std::string const& __name):
    ImplementInterface(count++), _name("testing code about " + __name){
      tests.regImplement(this, _name);
    }
    virtual ~TestFunction(){ }
    virtual bool run() = 0;
    std::string name() const{ return _name; }
};
////////////////////////

#define concat(a,b) a##b
#define TEST(a) \
class Test_##a: public TestFunction{ \
  public: \
          Test_##a(): TestFunction(#a){ } \
  bool run();\
} __test_##a; bool Test_##a::run()


#endif // __meowpp_h__