@@ -40,7 +40,8 @@ using namespace splash;
40
40
41
41
SimpleDataTest::SimpleDataTest () :
42
42
ctUInt32(),
43
- ctUInt64()
43
+ ctUInt64(),
44
+ ctBool()
44
45
{
45
46
dataCollector = new SerialDataCollector (10 );
46
47
srand (time (NULL ));
@@ -74,9 +75,13 @@ bool SimpleDataTest::subtestWriteRead(Dimensions gridSize, Dimensions borderSize
74
75
// initial part of the test: data is written to the file, once with and once
75
76
// without borders
76
77
uint64_t *dataWrite = new uint64_t [bufferSize];
78
+ bool *boolWrite = new bool [bufferSize];
77
79
78
80
for (uint64_t i = 0 ; i < bufferSize; i++)
81
+ {
79
82
dataWrite[i] = i;
83
+ boolWrite[i] = ( i%2 == 0 );
84
+ }
80
85
81
86
dataCollector->write (10 , ctUInt64, dimensions, Selection (gridSize), " deep/folders/data" , dataWrite);
82
87
datasetNames.insert (" deep/folders/data" );
@@ -85,6 +90,13 @@ bool SimpleDataTest::subtestWriteRead(Dimensions gridSize, Dimensions borderSize
85
90
borderSize), " deep/folders/data_without_borders" , dataWrite);
86
91
datasetNames.insert (" deep/folders/data_without_borders" );
87
92
93
+ dataCollector->write (10 , ctBool, dimensions, Selection (gridSize), " deep/folders/data_bool" , boolWrite);
94
+ datasetNames.insert (" deep/folders/data_bool" );
95
+
96
+ dataCollector->write (20 , ctBool, dimensions, Selection (gridSize, smallGridSize,
97
+ borderSize), " deep/folders/data_bool_without_borders" , boolWrite);
98
+ datasetNames.insert (" deep/folders/data_bool_without_borders" );
99
+
88
100
dataCollector->close ();
89
101
90
102
// first part of the test: read data with borders to a cleared
@@ -103,14 +115,16 @@ bool SimpleDataTest::subtestWriteRead(Dimensions gridSize, Dimensions borderSize
103
115
int32_t *ids = NULL ;
104
116
size_t numIDs = 0 ;
105
117
dataCollector->getEntryIDs (NULL , &numIDs);
118
+ printf (" number of entry IDs=%d\n " , numIDs);
106
119
CPPUNIT_ASSERT (numIDs == 2 );
107
120
ids = new int32_t [numIDs];
108
121
dataCollector->getEntryIDs (ids, NULL );
109
122
110
123
for (uint32_t j = 0 ; j < numIDs; ++j)
111
124
{
112
125
dataCollector->getEntriesForID (ids[j], NULL , &numEntries);
113
- CPPUNIT_ASSERT (numEntries == 1 );
126
+ printf (" numEntries=%d\n " , numEntries);
127
+ CPPUNIT_ASSERT (numEntries == 2 );
114
128
entries = new DataCollector::DCEntry[numEntries];
115
129
dataCollector->getEntriesForID (ids[j], entries, NULL );
116
130
@@ -129,6 +143,7 @@ bool SimpleDataTest::subtestWriteRead(Dimensions gridSize, Dimensions borderSize
129
143
delete[] ids;
130
144
131
145
uint64_t *dataRead = new uint64_t [bufferSize];
146
+ bool *boolRead = NULL ;
132
147
for (uint64_t i = 0 ; i < bufferSize; i++)
133
148
dataRead[i] = UINT64_MAX;
134
149
@@ -157,8 +172,12 @@ bool SimpleDataTest::subtestWriteRead(Dimensions gridSize, Dimensions borderSize
157
172
// locations in a cleared array (-1)
158
173
159
174
dataRead = new uint64_t [bufferSize];
175
+ boolRead = new bool [bufferSize];
160
176
for (uint64_t i = 0 ; i < bufferSize; i++)
177
+ {
161
178
dataRead[i] = UINT64_MAX;
179
+ boolRead[i] = false ;
180
+ }
162
181
163
182
dataCollector->read (20 , " deep/folders/data_without_borders" , gridSize, borderSize,
164
183
resultSize, NULL );
@@ -169,6 +188,20 @@ bool SimpleDataTest::subtestWriteRead(Dimensions gridSize, Dimensions borderSize
169
188
dataCollector->read (20 , " deep/folders/data_without_borders" , gridSize, borderSize,
170
189
resultSize, dataRead);
171
190
191
+ /*
192
+ dataCollector->read(20, "deep/folders/data_bool", gridSize, borderSize,
193
+ resultSize, boolRead);
194
+
195
+ for (uint64_t i = 0; i < bufferSize; i++)
196
+ {
197
+ if (boolRead[i] % 2 != 0)
198
+ {
199
+ resultsCorrect = false;
200
+ break;
201
+ }
202
+ }
203
+ */
204
+
172
205
// print out read and written data for debugging purposes
173
206
#if defined TESTS_DEBUG
174
207
for (size_t k = 0 ; k < gridSize[2 ]; k++)
@@ -228,7 +261,9 @@ bool SimpleDataTest::subtestWriteRead(Dimensions gridSize, Dimensions borderSize
228
261
}
229
262
230
263
delete[] dataRead;
264
+ delete[] boolRead;
231
265
delete[] dataWrite;
266
+ delete[] boolWrite;
232
267
233
268
dataCollector->close ();
234
269
0 commit comments