/[escript]/branches/RW_WIN32/bruce/test/BruceFactoryTestCase.cpp
ViewVC logotype

Contents of /branches/RW_WIN32/bruce/test/BruceFactoryTestCase.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 218 - (show annotations)
Thu Nov 24 07:42:12 2005 UTC (13 years, 9 months ago) by robwdcock
File size: 2446 byte(s)
All C++/C Unit tests now build (using scons) and pass on win32
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 "escript/Data/AbstractContinuousDomain.h"
16 #include "Bruce/BruceFactory.h"
17 #include "BruceFactoryTestCase.h"
18
19 using namespace CppUnitTest;
20
21 using namespace escript;
22 using namespace bruce;
23
24 using namespace std;
25
26 void BruceFactoryTestCase::setUp() {
27 //
28 // This is called before each test is run
29
30 }
31
32 void BruceFactoryTestCase::tearDown() {
33 //
34 // This is called after each test has been run
35
36 }
37
38 void BruceFactoryTestCase::testAll() {
39
40 cout << endl;
41
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 ()
94 {
95 //
96 // create the suite of tests to perform.
97 TestSuite *testSuite = new TestSuite ("BruceFactoryTestCase");
98
99 testSuite->addTest (new TestCaller< BruceFactoryTestCase>("testAll",&BruceFactoryTestCase::testAll));
100 return testSuite;
101 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26