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 "Data.h" |
15 |
extern "C" { |
16 |
#include "DataC.h" |
17 |
#include "CompareFuncs.h" |
18 |
} |
19 |
#include "DataCTestCase.h" |
20 |
|
21 |
#include <iostream> |
22 |
|
23 |
using namespace std; |
24 |
using namespace CppUnitTest; |
25 |
using namespace escript; |
26 |
|
27 |
void DataCTestCase::setUp() { |
28 |
// |
29 |
// This is called before each test is run |
30 |
|
31 |
} |
32 |
|
33 |
void DataCTestCase::tearDown() { |
34 |
// |
35 |
// This is called after each test has been run |
36 |
|
37 |
} |
38 |
|
39 |
void DataCTestCase::testAll() { |
40 |
|
41 |
cout << endl; |
42 |
|
43 |
cout << "\tTest C interface to escript::Data object." << endl; |
44 |
|
45 |
Data myData; |
46 |
escriptDataC myDataC=myData.getDataC(); |
47 |
int typeCode=myData.getFunctionSpace().getTypeCode(); |
48 |
|
49 |
cout << "\tData typeCode: " << typeCode << endl; |
50 |
assert(compareTypeCode(&myDataC,typeCode)); |
51 |
|
52 |
cout << "\tData isEmpty: " << myData.isEmpty() << endl; |
53 |
assert(compareIsEmpty(&myDataC,myData.isEmpty())); |
54 |
|
55 |
cout << "\tData isExpanded: " << myData.isExpanded() << endl; |
56 |
assert(compareIsExpanded(&myDataC,myData.isExpanded())); |
57 |
|
58 |
//cout << "Num DataPoints per sample: " << myData.getNumDPPSample() << " num samples: " << myData.getNumSamples() << endl; |
59 |
//assert(compareNumSamples(&myDataC,myData.getNumDPPSample(),myData.getNumSamples())); |
60 |
|
61 |
//DataArrayView::ShapeType tempShape=myData.getPointDataView().getShape(); |
62 |
//cout << "Data rank: " << tempShape.size() << endl; |
63 |
//assert(comparePointShape(&myDataC,tempShape.size(),&tempShape[0])); |
64 |
|
65 |
//cout << "Data value: " << myData.getSampleData(0)[0] << endl; |
66 |
//cout << "Data value: " << myData.getTaggedSampleData(0)[0] << endl; |
67 |
//assert(compareSampleDataWrite(&myDataC,0,myData.getSampleData(0))); |
68 |
} |
69 |
|
70 |
TestSuite* DataCTestCase::suite () |
71 |
{ |
72 |
// |
73 |
// create the suite of tests to perform. |
74 |
TestSuite *testSuite = new TestSuite ("DataCTestCase"); |
75 |
|
76 |
testSuite->addTest (new TestCaller< DataCTestCase>("testAll",&DataCTestCase::testAll)); |
77 |
return testSuite; |
78 |
} |