/[escript]/trunk/bruce/test/BruceFactory/BruceFactoryTestCase.cpp
ViewVC logotype

Contents of /trunk/bruce/test/BruceFactory/BruceFactoryTestCase.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 474 - (show annotations)
Mon Jan 30 04:23:44 2006 UTC (15 years, 10 months ago) by jgs
File size: 2429 byte(s)
restructure escript source tree
move src/Data/* -> src
remove inc
modify #includes and cpppath settings accordingly

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 #include "AbstractContinuousDomain.h"
16
17 #include "BruceFactory.h"
18
19 #include "BruceFactoryTestCase.h"
20
21 using namespace CppUnitTest;
22
23 using namespace escript;
24 using namespace bruce;
25
26 using namespace std;
27
28 void BruceFactoryTestCase::setUp() {
29 //
30 // This is called before each test is run
31
32 }
33
34 void BruceFactoryTestCase::tearDown() {
35 //
36 // This is called after each test has been run
37
38 }
39
40 void BruceFactoryTestCase::testAll() {
41
42 cout << endl;
43
44 cout << "\tTest brick factory." << endl;
45
46 AbstractContinuousDomain* b = brick();
47
48 assert(b->getDim()==3);
49
50 std::pair<int,int> b_shape = b->getDataShape(0);
51
52 assert(b_shape.first==1);
53 assert(b_shape.second==8);
54
55 delete b;
56
57 b = brick(11,11,11,10,10,10);
58
59 assert(b->getDim()==3);
60
61 b_shape = b->getDataShape(0);
62
63 assert(b_shape.first==1);
64 assert(b_shape.second==1331);
65
66 delete b;
67
68
69 cout << "\tTest rectangle factory." << endl;
70
71 AbstractContinuousDomain* r = rectangle();
72
73 assert(r->getDim()==2);
74
75 std::pair<int,int> r_shape = r->getDataShape(0);
76
77 assert(r_shape.first==1);
78 assert(r_shape.second==4);
79
80 delete r;
81
82 r = rectangle(11,11,10,10);
83
84 assert(r->getDim()==2);
85
86 r_shape = r->getDataShape(0);
87
88 assert(r_shape.first==1);
89 assert(r_shape.second==121);
90
91 delete r;
92
93 }
94
95 TestSuite* BruceFactoryTestCase::suite ()
96 {
97 //
98 // create the suite of tests to perform.
99 TestSuite *testSuite = new TestSuite ("BruceFactoryTestCase");
100
101 testSuite->addTest (new TestCaller< BruceFactoryTestCase>("testAll",&BruceFactoryTestCase::testAll));
102 return testSuite;
103 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26