/[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 480 - (show annotations)
Wed Feb 1 05:15:12 2006 UTC (14 years, 10 months ago) by jgs
File size: 2450 byte(s)
rationalise #includes and forward declarations

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26