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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26