aboutsummaryrefslogtreecommitdiffstats
path: root/_test/meowpp.h
blob: ca6c22472d793b20e0783238eb204ebf962a3ffd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef   __meowpp_h__
#define   __meowpp_h__

#include "Usage.h"
#include "utility.h"
#include "colors/RGB.h"
#include "colors/YUV.h"
#include "colors/HSL.h"
#include "colors/HSV.h"
#include "dsa/DisjointSet.h"
#include "dsa/KD_Tree.h"
#include "dsa/VP_Tree.h"
#include "dsa/SegmentTree.h"
#include "dsa/BinaryIndexTree.h"
#include "dsa/MergeableHeap.h"
#include "dsa/SplayTree.h"
#include "dsa/SplayTree_Range.h"
#include "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__