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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1796 - (show annotations)
Wed Sep 17 01:45:46 2008 UTC (11 years, 1 month ago) by jfenwick
File size: 2547 byte(s)
Merged noarrayview branch onto trunk.


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26