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
|
#include <meowpp/utility/operation.h>
#include <meowpp/utility/operation.h>
#include <meowpp/utility/operation.h>
#include <meowpp/debug/assert.h>
namespace meow {
class OperationTest {
private:
class States : public State {
public:
static const int CASE1 = 1;
static const int CASE2 = 1;
};
class Oper1 : public Operation {
public:
int id;
Oper1(int k) : Operation(3, 5), id(k) {}
Object* Copy() const { return new Oper1(id); }
State Operate(Pointer<Object const> const * inputs,
Pointer<Object> const* outputs) const {
return States::CASE1;
}
};
class Oper2 : public Operation {
public:
Oper2() : Operation(2, 7) {}
State Operate(Pointer<Object const> const * inputs,
Pointer<Object> const* outputs) const {
return States::CASE2;
}
};
public:
OperationTest() {
Oper1 op1(30);
Oper2 op2;
Assert(op1.inputs_size() == 3, "");
Assert(op1.outputs_size() == 5, "");
Assert(op2.inputs_size() == 2, "");
Assert(op2.outputs_size() == 7, "");
Oper1* nw = dynamic_cast<Oper1*>(op1.Copy());
Assert(nw->id == op1.id, "");
Assert(nw->inputs_size() == 3, "");
Assert(nw->outputs_size() == 5, "");
Assert(op1.Operate(NULL, NULL) == States::CASE1, "");
Assert(op2.Operate(NULL, NULL) == States::CASE2, "");
}
} _;
}
int main() {
return 0;
}
|