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/FunctionSpace.h" |
15 |
#include "escript/Data/NullDomain.h" |
16 |
|
17 |
#include "FunctionSpaceTestCase.h" |
18 |
|
19 |
#include <iostream> |
20 |
#include <sstream> |
21 |
|
22 |
using namespace CppUnitTest; |
23 |
using namespace escript; |
24 |
using namespace std; |
25 |
|
26 |
void FunctionSpaceTestCase::setUp() { |
27 |
// |
28 |
// This is called before each test is run |
29 |
|
30 |
} |
31 |
|
32 |
void FunctionSpaceTestCase::tearDown() { |
33 |
// |
34 |
// This is called after each test has been run |
35 |
|
36 |
} |
37 |
|
38 |
void FunctionSpaceTestCase::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 |
// Test Default constructor |
48 |
FunctionSpace testFunctionSpace1; |
49 |
|
50 |
// Test constructor |
51 |
NullDomain nullDomain; |
52 |
int testfunctionSpaceType = nullDomain.getFunctionCode(); |
53 |
|
54 |
FunctionSpace testFunctionSpace2(nullDomain, testfunctionSpaceType); |
55 |
|
56 |
// Test getTypeCode |
57 |
cout << "Test getTypeCode" << endl; |
58 |
assert(testFunctionSpace1.getTypeCode()==1); |
59 |
|
60 |
// Test getDomain |
61 |
cout << "Test getDomain" << endl; |
62 |
assert(testFunctionSpace2.getDomain()==nullDomain); |
63 |
|
64 |
// Test getDim |
65 |
cout << "Test getDim" << endl; |
66 |
assert(testFunctionSpace1.getDim()==1); |
67 |
|
68 |
// Test == operator |
69 |
cout << "Test == operator" << endl; |
70 |
assert(testFunctionSpace1==testFunctionSpace1); |
71 |
assert(!(testFunctionSpace1!=testFunctionSpace1)); |
72 |
|
73 |
// Test = operator |
74 |
cout << "Test = operator" << endl; |
75 |
testFunctionSpace1=testFunctionSpace2; |
76 |
assert(testFunctionSpace1==testFunctionSpace2); |
77 |
|
78 |
} |
79 |
|
80 |
TestSuite* FunctionSpaceTestCase::suite () |
81 |
{ |
82 |
// |
83 |
// create the suite of tests to perform. |
84 |
TestSuite *testSuite = new TestSuite ("FunctionSpaceTestCase"); |
85 |
|
86 |
testSuite->addTest (new TestCaller< FunctionSpaceTestCase>("testAll",&FunctionSpaceTestCase::testAll)); |
87 |
return testSuite; |
88 |
} |
89 |
|