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 <iostream> |
16 |
|
17 |
#include "escript/Data/DataProf.h" |
18 |
#include "esysUtils/EsysException.h" |
19 |
|
20 |
#include "DataProfTestCase.h" |
21 |
|
22 |
using namespace std; |
23 |
using namespace CppUnitTest; |
24 |
using namespace escript; |
25 |
using namespace esysUtils; |
26 |
|
27 |
void DataProfTestCase::setUp() { |
28 |
// |
29 |
// This is called before each test is run |
30 |
|
31 |
} |
32 |
|
33 |
void DataProfTestCase::tearDown() { |
34 |
// |
35 |
// This is called after each test has been run |
36 |
|
37 |
} |
38 |
|
39 |
void DataProfTestCase::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 |
DataProf dataProf; |
47 |
|
48 |
profDataEntry* newEntry1 = dataProf.newData(); |
49 |
profDataEntry* newEntry2 = dataProf.newData(); |
50 |
|
51 |
assert(newEntry1->interpolate == 0); |
52 |
assert(newEntry1->grad == 0); |
53 |
assert(newEntry1->integrate == 0); |
54 |
assert(newEntry1->where == 0); |
55 |
assert(newEntry1->unary == 0); |
56 |
assert(newEntry1->binary == 0); |
57 |
assert(newEntry1->reduction1 == 0); |
58 |
assert(newEntry1->reduction2 == 0); |
59 |
assert(newEntry1->slicing == 0); |
60 |
|
61 |
assert(newEntry2->interpolate == 0); |
62 |
assert(newEntry2->grad == 0); |
63 |
assert(newEntry2->integrate == 0); |
64 |
assert(newEntry2->where == 0); |
65 |
assert(newEntry2->unary == 0); |
66 |
assert(newEntry2->binary == 0); |
67 |
assert(newEntry2->reduction1 == 0); |
68 |
assert(newEntry2->reduction2 == 0); |
69 |
assert(newEntry2->slicing == 0); |
70 |
|
71 |
newEntry1->interpolate = 1; |
72 |
newEntry1->grad = 1; |
73 |
newEntry1->integrate = 1; |
74 |
newEntry1->where = 1; |
75 |
newEntry1->unary = 1; |
76 |
newEntry1->binary = 1; |
77 |
newEntry1->reduction1 = 1; |
78 |
newEntry1->reduction2 = 1; |
79 |
newEntry1->slicing = 1; |
80 |
|
81 |
newEntry2->interpolate = 2; |
82 |
newEntry2->grad = 2; |
83 |
newEntry2->integrate = 2; |
84 |
newEntry2->where = 2; |
85 |
newEntry2->unary = 2; |
86 |
newEntry2->binary = 2; |
87 |
newEntry2->reduction1 = 2; |
88 |
newEntry2->reduction2 = 2; |
89 |
newEntry2->slicing = 2; |
90 |
|
91 |
assert(newEntry1->interpolate == 1); |
92 |
assert(newEntry1->grad == 1); |
93 |
assert(newEntry1->integrate == 1); |
94 |
assert(newEntry1->where == 1); |
95 |
assert(newEntry1->unary == 1); |
96 |
assert(newEntry1->binary == 1); |
97 |
assert(newEntry1->reduction1 == 1); |
98 |
assert(newEntry1->reduction2 == 1); |
99 |
assert(newEntry1->slicing == 1); |
100 |
|
101 |
assert(newEntry2->interpolate == 2); |
102 |
assert(newEntry2->grad == 2); |
103 |
assert(newEntry2->integrate == 2); |
104 |
assert(newEntry2->where == 2); |
105 |
assert(newEntry2->unary == 2); |
106 |
assert(newEntry2->binary == 2); |
107 |
assert(newEntry2->reduction1 == 2); |
108 |
assert(newEntry2->reduction2 == 2); |
109 |
assert(newEntry2->slicing == 2); |
110 |
|
111 |
profDataEntry* newEntry3 = dataProf.newData(); |
112 |
profDataEntry* newEntry4 = dataProf.newData(); |
113 |
|
114 |
cout << endl; |
115 |
|
116 |
} |
117 |
|
118 |
TestSuite* DataProfTestCase::suite () |
119 |
{ |
120 |
// |
121 |
// create the suite of tests to perform. |
122 |
TestSuite *testSuite = new TestSuite ("DataProfTestCase"); |
123 |
|
124 |
testSuite->addTest (new TestCaller< DataProfTestCase>("testAll",&DataProfTestCase::testAll)); |
125 |
return testSuite; |
126 |
} |
127 |
|