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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 636 - (show annotations)
Thu Mar 23 09:46:31 2006 UTC (13 years, 7 months ago) by robwdcock
Original Path: branches/ROBW_XPLATFORM/escript/test/DataCachedTestCase.cpp
File size: 3226 byte(s)
Clean up test into single test suite and only one SConscript file so it is easier to maintain.
Note:
+ Use the command line options on tests in order to run only one of them if you need to
+ THIS DOESN'T WORK YET: I've not merged the tests, that will follow shortly
+ I do hope this merges with the changes on the trunk!

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 "DataCached.h"
16 #include "FunctionSpace.h"
17 #include "EsysException.h"
18
19 #include "DataCachedTestCase.h"
20
21 using namespace CppUnitTest;
22 using namespace escript;
23 using namespace std;
24 using namespace esysUtils;
25
26 void DataCachedTestCase::setUp() {
27 //
28 // This is called before each test is run
29
30 }
31
32 void DataCachedTestCase::tearDown() {
33 //
34 // This is called after each test has been run
35
36 }
37
38 void DataCachedTestCase::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 DataCached testData;
49
50 cout << "\tTest toString method." << endl;
51 assert(testData.toString() == "(Cached 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 getDataPoint." << endl;
65 // this function also returns a DataArrayView object - should check that
66 testData.getDataPoint(0,0);
67 assert(false);
68 }
69 catch (EsysException& e) {
70 //cout << e.toString() << endl;
71 assert(true);
72 }
73
74 cout << "\tTest getLength." << endl;
75 assert(testData.getLength() == 0);
76
77 DataArrayView::RegionType region;
78
79 try {
80 cout << "\tTest getSlice." << endl;
81 assert(testData.getSlice(region) == 0);
82 assert(false);
83 }
84 catch (EsysException& e) {
85 //cout << e.toString() << endl;
86 assert(true);
87 }
88
89 try {
90 cout << "\tTest setSlice." << endl;
91 testData.setSlice(0,region);
92 assert(false);
93 }
94 catch (EsysException& e) {
95 //cout << e.toString() << endl;
96 assert(true);
97 }
98
99 DataArrayView::ShapeType shape;
100
101 try {
102 cout << "\tTest reshapeDataPoint." << endl;
103 testData.reshapeDataPoint(shape);
104 assert(false);
105 }
106 catch (EsysException& e) {
107 //cout << e.toString() << endl;
108 assert(true);
109 }
110
111 }
112
113 TestSuite* DataCachedTestCase::suite ()
114 {
115 //
116 // create the suite of tests to perform.
117 TestSuite *testSuite = new TestSuite ("DataCachedTestCase");
118
119 testSuite->addTest (new TestCaller< DataCachedTestCase>("testAll",&DataCachedTestCase::testAll));
120 return testSuite;
121 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26