21 |
using namespace escript; |
using namespace escript; |
22 |
using namespace bruce; |
using namespace bruce; |
23 |
|
|
24 |
|
using namespace std; |
25 |
|
|
26 |
void BruceFactoryTestCase::setUp() { |
void BruceFactoryTestCase::setUp() { |
27 |
// |
// |
28 |
// This is called before each test is run |
// This is called before each test is run |
36 |
} |
} |
37 |
|
|
38 |
void BruceFactoryTestCase::testAll() { |
void BruceFactoryTestCase::testAll() { |
|
// |
|
|
// The test code may be entered here |
|
|
// There is nothing special about the function name, it may be renamed to |
|
|
// something more suitable. |
|
|
// As many test methods as desired may be added. |
|
39 |
|
|
40 |
AbstractContinuousDomain* brick; |
cout << endl; |
41 |
AbstractContinuousDomain* rectangle; |
|
42 |
|
cout << "\tTest brick factory." << endl; |
43 |
|
|
44 |
|
AbstractContinuousDomain* b = brick(); |
45 |
|
|
46 |
|
assert(b->getDim()==3); |
47 |
|
|
48 |
|
std::pair<int,int> b_shape = b->getDataShape(0); |
49 |
|
|
50 |
|
assert(b_shape.first==1); |
51 |
|
assert(b_shape.second==8); |
52 |
|
|
53 |
|
delete b; |
54 |
|
|
55 |
|
b = brick(11,11,11,10,10,10); |
56 |
|
|
57 |
|
assert(b->getDim()==3); |
58 |
|
|
59 |
|
b_shape = b->getDataShape(0); |
60 |
|
|
61 |
|
assert(b_shape.first==1); |
62 |
|
assert(b_shape.second==1331); |
63 |
|
|
64 |
|
delete b; |
65 |
|
|
66 |
|
|
67 |
|
cout << "\tTest rectangle factory." << endl; |
68 |
|
|
69 |
|
AbstractContinuousDomain* r = rectangle(); |
70 |
|
|
71 |
|
assert(r->getDim()==2); |
72 |
|
|
73 |
|
std::pair<int,int> r_shape = r->getDataShape(0); |
74 |
|
|
75 |
|
assert(r_shape.first==1); |
76 |
|
assert(r_shape.second==4); |
77 |
|
|
78 |
|
delete r; |
79 |
|
|
80 |
|
r = rectangle(11,11,10,10); |
81 |
|
|
82 |
|
assert(r->getDim()==2); |
83 |
|
|
84 |
|
r_shape = r->getDataShape(0); |
85 |
|
|
86 |
|
assert(r_shape.first==1); |
87 |
|
assert(r_shape.second==121); |
88 |
|
|
89 |
|
delete r; |
90 |
|
|
91 |
} |
} |
92 |
|
|
93 |
TestSuite* BruceFactoryTestCase::suite () |
TestSuite* BruceFactoryTestCase::suite () |