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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 100 - (show annotations)
Wed Dec 15 03:48:48 2004 UTC (14 years, 10 months ago) by jgs
Original Path: trunk/esys2/escript/test/DataEmpty/DataEmptyTestCase.cpp
File size: 3475 byte(s)
*** empty log message ***

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 #include "escript/Data/DataEmpty.h"
15 #include "escript/Data/FunctionSpace.h"
16 #include "esysUtils/EsysException.h"
17
18 #include "DataEmptyTestCase.h"
19
20 using namespace CppUnitTest;
21 using namespace escript;
22 using namespace std;
23 using namespace esysUtils;
24
25 void DataEmptyTestCase::setUp() {
26 //
27 // This is called before each test is run
28
29 }
30
31 void DataEmptyTestCase::tearDown() {
32 //
33 // This is called after each test has been run
34
35 }
36
37 void DataEmptyTestCase::testAll() {
38 //
39 // The test code may be entered here
40 // There is nothing special about the function name, it may be renamed to
41 // something more suitable.
42 // As many test methods as desired may be added.
43
44 cout << endl;
45
46 cout << "Test default constructor:" << endl;
47
48 DataEmpty testData;
49
50 cout << "Test toString method:" << endl;
51
52 cout << testData.toString() << endl;
53 assert(testData.toString() == "Empty Data.");
54
55 try {
56 cout << "Test getPointOffset:" << endl;
57 assert(testData.getPointOffset(0,0) == 0);
58 assert(false);
59 }
60 catch (EsysException& e) {
61 cout << e.toString() << endl;
62 assert(true);
63 }
64
65 try {
66 cout << "Test getSampleDataByTag:" << endl;
67 assert(testData.getSampleDataByTag(0) == 0);
68 assert(false);
69 }
70 catch (EsysException& e) {
71 cout << e.toString() << endl;
72 assert(true);
73 }
74
75 try {
76 cout << "Test getDataPoint:" << endl;
77 // this function also returns a DataArrayView object - should check that
78 testData.getDataPoint(0,0);
79 assert(false);
80 }
81 catch (EsysException& e) {
82 cout << e.toString() << endl;
83 assert(true);
84 }
85
86 cout << "Test getLength." << endl;
87 assert(testData.getLength() == 0);
88
89 DataArrayView::RegionType region;
90
91 try {
92 cout << "Test getSlice:" << endl;
93 assert(testData.getSlice(region) == 0);
94 assert(false);
95 }
96 catch (EsysException& e) {
97 cout << e.toString() << endl;
98 assert(true);
99 }
100
101 try {
102 cout << "Test setSlice:" << endl;
103 testData.setSlice(0,region);
104 assert(false);
105 }
106 catch (EsysException& e) {
107 cout << e.toString() << endl;
108 assert(true);
109 }
110
111 DataArrayView::ShapeType shape;
112
113 try {
114 cout << "Test reshapeDataPoint:" << endl;
115 testData.reshapeDataPoint(shape);
116 assert(false);
117 }
118 catch (EsysException& e) {
119 cout << e.toString() << endl;
120 assert(true);
121 }
122
123 }
124
125 TestSuite* DataEmptyTestCase::suite ()
126 {
127 //
128 // create the suite of tests to perform.
129 TestSuite *testSuite = new TestSuite ("DataEmptyTestCase");
130
131 testSuite->addTest (new TestCaller< DataEmptyTestCase>("testAll",&DataEmptyTestCase::testAll));
132 return testSuite;
133 }
134

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26