/[escript]/trunk/escript/test/DataFactoryTestCase.cpp
ViewVC logotype

Contents of /trunk/escript/test/DataFactoryTestCase.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 682 - (show annotations)
Mon Mar 27 02:43:09 2006 UTC (13 years, 8 months ago) by robwdcock
File size: 5210 byte(s)
+ NEW BUILD SYSTEM

This commit contains the new build system with cross-platform support.
Most things work are before though you can have more control.

ENVIRONMENT settings have changed:
+ You no longer require LD_LIBRARY_PATH or PYTHONPATH to point to the
esysroot for building and testing performed via scons
+ ACcESS altix users: It is recommended you change your modules to load
the latest intel compiler and other libraries required by boost to match
the setup in svn (you can override). The correct modules are as follows

module load intel_cc.9.0.026
export
MODULEPATH=${MODULEPATH}:/data/raid2/toolspp4/modulefiles/gcc-3.3.6
module load boost/1.33.0/python-2.4.1
module load python/2.4.1
module load numarray/1.3.3


1 // $Id$
2 /*
3 *****************************************************************************
4 * *
5 * COPYRIGHT ACcESS - All Rights Reserved *
6 * *
7 * This software is the property of ACcESS. No part of this code *
8 * may be copied in any form or by any means without the expressed written *
9 * consent of ACcESS. Copying, use or modification of this software *
10 * by any unauthorised person is illegal unless that person has a software *
11 * license agreement with ACcESS. *
12 * *
13 *****************************************************************************
14 */
15 #include "escript/DataFactory.h"
16 #include "escript/Data.h"
17
18 #include "DataFactoryTestCase.h"
19
20 #include <iostream>
21
22 using namespace CppUnitTest;
23 using namespace escript;
24 using namespace std;
25
26 void DataFactoryTestCase::setUp() {
27 //
28 // This is called before each test is run
29
30 }
31
32 void DataFactoryTestCase::tearDown() {
33 //
34 // This is called after each test has been run
35
36 }
37
38 void DataFactoryTestCase::testAll() {
39
40 cout << endl;
41
42 cout << "\tUse DataFactory functions to create some Data objects:" << endl;
43
44 {
45 cout << "\tCreate Data (DataConstant) object with Scalar data points." << endl;
46 Data scalar=Scalar(1.3);
47 //cout << scalar.toString() << endl;
48 assert(scalar.isConstant());
49 assert(scalar.getDataPointRank()==0);
50 assert(scalar.getDataPointShape().empty());
51 }
52
53 {
54 cout << "\tCreate DataExpanded object with Scalar data points." << endl;
55 Data scalar=Scalar(1.5,FunctionSpace(),true);
56 //cout << scalar.toString() << endl;
57 assert(scalar.isExpanded());
58 assert(scalar.getDataPointRank()==0);
59 assert(scalar.getDataPointShape().empty());
60 }
61
62 {
63 cout << "\tCreate Data (DataConstant) object with Vector data points." << endl;
64 Data vector=Vector(1.3);
65 //cout << vector.toString() << endl;
66 assert(vector.isConstant());
67 assert(vector.getDataPointRank()==1);
68 assert(vector.getDataPointShape()[0]==1);;
69 }
70
71 {
72 cout << "\tCreate Data Expanded object with Vector data points." << endl;
73 Data vector=Vector(1.5,FunctionSpace(),true);
74 //cout << vector.toString() << endl;
75 assert(vector.isExpanded());
76 assert(vector.getDataPointRank()==1);
77 assert(vector.getDataPointShape()[0]==1);;
78 }
79
80 {
81 cout << "\tCreate Data (DataConstant) object with Tensor data points." << endl;
82 Data tensor=Tensor(1.3);
83 //cout << tensor.toString() << endl;
84 assert(tensor.isConstant());
85 assert(tensor.getDataPointRank()==2);
86 assert(tensor.getDataPointShape()[0]==1);;
87 assert(tensor.getDataPointShape()[1]==1);;
88 }
89
90 {
91 cout << "\tCreate Data Expanded object with Tensor data points." << endl;
92 Data tensor=Tensor(1.5,FunctionSpace(),true);
93 //cout << tensor.toString() << endl;
94 assert(tensor.isExpanded());
95 assert(tensor.getDataPointRank()==2);
96 assert(tensor.getDataPointShape()[0]==1);;
97 assert(tensor.getDataPointShape()[1]==1);;
98 }
99
100 {
101 cout << "\tCreate Data (DataConstant) object with Tensor3 data points." << endl;
102 Data tensor3=Tensor3(1.3);
103 //cout << tensor3.toString() << endl;
104 assert(tensor3.isConstant());
105 assert(tensor3.getDataPointRank()==3);
106 assert(tensor3.getDataPointShape()[0]==1);;
107 assert(tensor3.getDataPointShape()[1]==1);;
108 assert(tensor3.getDataPointShape()[2]==1);;
109 }
110
111 {
112 cout << "\tCreate Data Expanded object with Tensor3 data points." << endl;
113 Data tensor3=Tensor3(1.5,FunctionSpace(),true);
114 //cout << tensor3.toString() << endl;
115 assert(tensor3.isExpanded());
116 assert(tensor3.getDataPointRank()==3);
117 assert(tensor3.getDataPointShape()[0]==1);;
118 assert(tensor3.getDataPointShape()[1]==1);;
119 assert(tensor3.getDataPointShape()[2]==1);;
120 }
121
122 {
123 cout << "\tCreate Data (DataConstant) object with Tensor4 data points." << endl;
124 Data tensor4=Tensor4(1.3);
125 //cout << tensor4.toString() << endl;
126 assert(tensor4.isConstant());
127 assert(tensor4.getDataPointRank()==4);
128 assert(tensor4.getDataPointShape()[0]==1);;
129 assert(tensor4.getDataPointShape()[1]==1);;
130 assert(tensor4.getDataPointShape()[2]==1);;
131 assert(tensor4.getDataPointShape()[3]==1);;
132 }
133
134 {
135 cout << "\tCreate Data Expanded object with Tensor4 data points." << endl;
136 Data tensor4=Tensor4(1.5,FunctionSpace(),true);
137 //cout << tensor4.toString() << endl;
138 assert(tensor4.isExpanded());
139 assert(tensor4.getDataPointRank()==4);
140 assert(tensor4.getDataPointShape()[0]==1);;
141 assert(tensor4.getDataPointShape()[1]==1);;
142 assert(tensor4.getDataPointShape()[2]==1);;
143 assert(tensor4.getDataPointShape()[3]==1);;
144 }
145
146 }
147
148 TestSuite* DataFactoryTestCase::suite ()
149 {
150 //
151 // create the suite of tests to perform.
152 TestSuite *testSuite = new TestSuite ("DataFactoryTestCase");
153
154 testSuite->addTest (new TestCaller< DataFactoryTestCase>("testAll",&DataFactoryTestCase::testAll));
155 return testSuite;
156 }
157

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26