1 |
/* |
2 |
***************************************************************************** |
3 |
* * |
4 |
* COPYRIGHT ACcESS - All Rights Reserved * |
5 |
* * |
6 |
* This software is the property of ACcESS. No part of this code * |
7 |
* may be copied in any form or by any means without the expressed written * |
8 |
* consent of ACcESS. Copying, use or modification of this software * |
9 |
* by any unauthorised person is illegal unless that person has a software * |
10 |
* license agreement with ACcESS. * |
11 |
* * |
12 |
***************************************************************************** |
13 |
*/ |
14 |
|
15 |
|
16 |
#include "escript/AbstractContinuousDomain.h" |
17 |
|
18 |
#include "bruce/BruceFactory.h" |
19 |
|
20 |
#include "BruceFactoryTestCase.h" |
21 |
|
22 |
#include <iostream> |
23 |
|
24 |
using namespace CppUnitTest; |
25 |
|
26 |
using namespace escript; |
27 |
using namespace bruce; |
28 |
|
29 |
using namespace std; |
30 |
|
31 |
void BruceFactoryTestCase::setUp() { |
32 |
// |
33 |
// This is called before each test is run |
34 |
|
35 |
} |
36 |
|
37 |
void BruceFactoryTestCase::tearDown() { |
38 |
// |
39 |
// This is called after each test has been run |
40 |
|
41 |
} |
42 |
|
43 |
void BruceFactoryTestCase::testAll() { |
44 |
|
45 |
cout << endl; |
46 |
|
47 |
cout << "\tTest brick factory." << endl; |
48 |
|
49 |
AbstractContinuousDomain* b = brick(); |
50 |
|
51 |
assert(b->getDim()==3); |
52 |
|
53 |
std::pair<int,int> b_shape = b->getDataShape(0); |
54 |
|
55 |
assert(b_shape.first==1); |
56 |
assert(b_shape.second==8); |
57 |
|
58 |
delete b; |
59 |
|
60 |
b = brick(11,11,11,10,10,10); |
61 |
|
62 |
assert(b->getDim()==3); |
63 |
|
64 |
b_shape = b->getDataShape(0); |
65 |
|
66 |
assert(b_shape.first==1); |
67 |
assert(b_shape.second==1331); |
68 |
|
69 |
delete b; |
70 |
|
71 |
|
72 |
cout << "\tTest rectangle factory." << endl; |
73 |
|
74 |
AbstractContinuousDomain* r = rectangle(); |
75 |
|
76 |
assert(r->getDim()==2); |
77 |
|
78 |
std::pair<int,int> r_shape = r->getDataShape(0); |
79 |
|
80 |
assert(r_shape.first==1); |
81 |
assert(r_shape.second==4); |
82 |
|
83 |
delete r; |
84 |
|
85 |
r = rectangle(11,11,10,10); |
86 |
|
87 |
assert(r->getDim()==2); |
88 |
|
89 |
r_shape = r->getDataShape(0); |
90 |
|
91 |
assert(r_shape.first==1); |
92 |
assert(r_shape.second==121); |
93 |
|
94 |
delete r; |
95 |
|
96 |
} |
97 |
|
98 |
TestSuite* BruceFactoryTestCase::suite () |
99 |
{ |
100 |
// |
101 |
// create the suite of tests to perform. |
102 |
TestSuite *testSuite = new TestSuite ("BruceFactoryTestCase"); |
103 |
|
104 |
testSuite->addTest (new TestCaller< BruceFactoryTestCase>("testAll",&BruceFactoryTestCase::testAll)); |
105 |
return testSuite; |
106 |
} |