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

Contents of /branches/escript3047_with_pastix2995/escript/test/DataEmptyTestCase.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3048 - (show annotations)
Fri Jun 25 03:46:37 2010 UTC (9 years, 3 months ago) by lgao
File size: 2512 byte(s)
Creating a branch of trunk r3047 with pastix 2995.
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 #include "escript/DataEmpty.h"
16 #include "escript/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&) {
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.getPointOffset(0,0);
67 assert(false);
68 }
69 catch (EsysException&) {
70 //cout << e.toString() << endl;
71 assert(true);
72 }
73
74 cout << "\tTest getLength." << endl;
75 assert(testData.getLength() == 0);
76
77 DataTypes::RegionType region;
78
79 try {
80 cout << "\tTest getSlice." << endl;
81 assert(testData.getSlice(region) == 0);
82 assert(false);
83 }
84 catch (EsysException&) {
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&) {
95 //cout << e.toString() << endl;
96 assert(true);
97 }
98
99
100 }
101
102 TestSuite* DataEmptyTestCase::suite ()
103 {
104 //
105 // create the suite of tests to perform.
106 TestSuite *testSuite = new TestSuite ("DataEmptyTestCase");
107
108 testSuite->addTest (new TestCaller< DataEmptyTestCase>("testAll",&DataEmptyTestCase::testAll));
109 return testSuite;
110 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26