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 |
|
15 |
#include "escript/Data/DataVariable.h" |
16 |
#include "esysUtils/EsysException.h" |
17 |
|
18 |
#include "DataVariableTestCase.h" |
19 |
|
20 |
using namespace std; |
21 |
using namespace CppUnitTest; |
22 |
using namespace escript; |
23 |
using namespace esysUtils; |
24 |
|
25 |
void DataVariableTestCase::setUp() { |
26 |
// |
27 |
// This is called before each test is run |
28 |
} |
29 |
|
30 |
void DataVariableTestCase::tearDown() { |
31 |
// |
32 |
// This is called after each test has been run |
33 |
} |
34 |
|
35 |
void DataVariableTestCase::testAll() { |
36 |
// |
37 |
// The test code may be entered here |
38 |
// There is nothing special about the function name, it may be renamed to |
39 |
// something more suitable. |
40 |
// As many test methods as desired may be added. |
41 |
|
42 |
DataArrayView::ShapeType viewShape; |
43 |
viewShape.push_back(2); |
44 |
viewShape.push_back(2); |
45 |
|
46 |
Data d1(1.0,viewShape,FunctionSpace(),false); |
47 |
Data d2(2.0,viewShape,FunctionSpace(),false); |
48 |
Data d3(3.0,viewShape,FunctionSpace(),false); |
49 |
Data d4(4.0,viewShape,FunctionSpace(),false); |
50 |
|
51 |
DataVariable dv1(&d1); |
52 |
DataVariable dv2(&d2); |
53 |
DataVariable dv3(&d3); |
54 |
DataVariable dv4(&d4); |
55 |
|
56 |
dv3.sum(&dv4); |
57 |
dv2.diff(&dv3); |
58 |
dv1.sum(&dv2); |
59 |
|
60 |
Data d5 = dv1.evaluate(); |
61 |
|
62 |
cout << d5.toString() << endl; |
63 |
|
64 |
} |
65 |
|
66 |
TestSuite* DataVariableTestCase::suite () |
67 |
{ |
68 |
// |
69 |
// create the suite of tests to perform. |
70 |
TestSuite *testSuite = new TestSuite ("DataVariableTestCase"); |
71 |
|
72 |
testSuite->addTest (new TestCaller< DataVariableTestCase>("testAll",&DataVariableTestCase::testAll)); |
73 |
return testSuite; |
74 |
} |