/[escript]/branches/escript3047_with_pastix2995/escript/test/DataFactoryTestCase.cpp
ViewVC logotype

Annotation of /branches/escript3047_with_pastix2995/escript/test/DataFactoryTestCase.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1384 - (hide annotations)
Fri Jan 11 02:29:38 2008 UTC (11 years, 10 months ago) by phornby
Original Path: temp_trunk_copy/escript/test/DataFactoryTestCase.cpp
File size: 4766 byte(s)
Make a temp copy of the trunk before checking in the windows changes


1 ksteube 1312
2     /* $Id$ */
3    
4     /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16 robwdcock 670 #include "escript/DataFactory.h"
17     #include "escript/Data.h"
18 jgs 82
19     #include "DataFactoryTestCase.h"
20    
21     #include <iostream>
22    
23     using namespace CppUnitTest;
24     using namespace escript;
25     using namespace std;
26    
27     void DataFactoryTestCase::setUp() {
28     //
29     // This is called before each test is run
30    
31     }
32    
33     void DataFactoryTestCase::tearDown() {
34     //
35     // This is called after each test has been run
36    
37     }
38    
39     void DataFactoryTestCase::testAll() {
40    
41     cout << endl;
42    
43     cout << "\tUse DataFactory functions to create some Data objects:" << endl;
44    
45     {
46     cout << "\tCreate Data (DataConstant) object with Scalar data points." << endl;
47     Data scalar=Scalar(1.3);
48     //cout << scalar.toString() << endl;
49     assert(scalar.isConstant());
50     assert(scalar.getDataPointRank()==0);
51     assert(scalar.getDataPointShape().empty());
52     }
53    
54     {
55     cout << "\tCreate DataExpanded object with Scalar data points." << endl;
56     Data scalar=Scalar(1.5,FunctionSpace(),true);
57     //cout << scalar.toString() << endl;
58     assert(scalar.isExpanded());
59     assert(scalar.getDataPointRank()==0);
60     assert(scalar.getDataPointShape().empty());
61     }
62    
63     {
64     cout << "\tCreate Data (DataConstant) object with Vector data points." << endl;
65     Data vector=Vector(1.3);
66     //cout << vector.toString() << endl;
67     assert(vector.isConstant());
68     assert(vector.getDataPointRank()==1);
69     assert(vector.getDataPointShape()[0]==1);;
70     }
71    
72     {
73     cout << "\tCreate Data Expanded object with Vector data points." << endl;
74     Data vector=Vector(1.5,FunctionSpace(),true);
75     //cout << vector.toString() << endl;
76     assert(vector.isExpanded());
77     assert(vector.getDataPointRank()==1);
78     assert(vector.getDataPointShape()[0]==1);;
79     }
80    
81     {
82     cout << "\tCreate Data (DataConstant) object with Tensor data points." << endl;
83     Data tensor=Tensor(1.3);
84     //cout << tensor.toString() << endl;
85     assert(tensor.isConstant());
86     assert(tensor.getDataPointRank()==2);
87     assert(tensor.getDataPointShape()[0]==1);;
88     assert(tensor.getDataPointShape()[1]==1);;
89     }
90    
91     {
92     cout << "\tCreate Data Expanded object with Tensor data points." << endl;
93     Data tensor=Tensor(1.5,FunctionSpace(),true);
94     //cout << tensor.toString() << endl;
95     assert(tensor.isExpanded());
96     assert(tensor.getDataPointRank()==2);
97     assert(tensor.getDataPointShape()[0]==1);;
98     assert(tensor.getDataPointShape()[1]==1);;
99     }
100    
101     {
102     cout << "\tCreate Data (DataConstant) object with Tensor3 data points." << endl;
103     Data tensor3=Tensor3(1.3);
104     //cout << tensor3.toString() << endl;
105     assert(tensor3.isConstant());
106     assert(tensor3.getDataPointRank()==3);
107     assert(tensor3.getDataPointShape()[0]==1);;
108     assert(tensor3.getDataPointShape()[1]==1);;
109     assert(tensor3.getDataPointShape()[2]==1);;
110     }
111    
112     {
113     cout << "\tCreate Data Expanded object with Tensor3 data points." << endl;
114     Data tensor3=Tensor3(1.5,FunctionSpace(),true);
115     //cout << tensor3.toString() << endl;
116     assert(tensor3.isExpanded());
117     assert(tensor3.getDataPointRank()==3);
118     assert(tensor3.getDataPointShape()[0]==1);;
119     assert(tensor3.getDataPointShape()[1]==1);;
120     assert(tensor3.getDataPointShape()[2]==1);;
121     }
122    
123     {
124     cout << "\tCreate Data (DataConstant) object with Tensor4 data points." << endl;
125     Data tensor4=Tensor4(1.3);
126     //cout << tensor4.toString() << endl;
127     assert(tensor4.isConstant());
128     assert(tensor4.getDataPointRank()==4);
129     assert(tensor4.getDataPointShape()[0]==1);;
130     assert(tensor4.getDataPointShape()[1]==1);;
131     assert(tensor4.getDataPointShape()[2]==1);;
132     assert(tensor4.getDataPointShape()[3]==1);;
133     }
134    
135     {
136     cout << "\tCreate Data Expanded object with Tensor4 data points." << endl;
137     Data tensor4=Tensor4(1.5,FunctionSpace(),true);
138     //cout << tensor4.toString() << endl;
139     assert(tensor4.isExpanded());
140     assert(tensor4.getDataPointRank()==4);
141     assert(tensor4.getDataPointShape()[0]==1);;
142     assert(tensor4.getDataPointShape()[1]==1);;
143     assert(tensor4.getDataPointShape()[2]==1);;
144     assert(tensor4.getDataPointShape()[3]==1);;
145     }
146    
147     }
148    
149     TestSuite* DataFactoryTestCase::suite ()
150     {
151     //
152     // create the suite of tests to perform.
153     TestSuite *testSuite = new TestSuite ("DataFactoryTestCase");
154    
155     testSuite->addTest (new TestCaller< DataFactoryTestCase>("testAll",&DataFactoryTestCase::testAll));
156     return testSuite;
157     }
158    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26