Skip to content

Commit 98b3c66

Browse files
committed
Combined test: append mode and weird iteration order
1 parent 2b6a1e2 commit 98b3c66

1 file changed

Lines changed: 30 additions & 10 deletions

File tree

test/SerialIOTest.cpp

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5069,7 +5069,25 @@ void append_mode(
50695069
}
50705070

50715071
writeSomeIterations(
5072-
write.writeIterations(), std::vector< uint64_t >{ 4, 3 } );
5072+
write.writeIterations(), std::vector< uint64_t >{ 4, 3, 10 } );
5073+
write.flush();
5074+
}
5075+
{
5076+
Series write( filename, Access::APPEND, jsonConfig );
5077+
if( variableBased )
5078+
{
5079+
write.setIterationEncoding( IterationEncoding::variableBased );
5080+
}
5081+
if( write.backend() == "ADIOS1" )
5082+
{
5083+
REQUIRE_THROWS_AS(
5084+
write.flush(), error::OperationUnsupportedInBackend );
5085+
// destructor will be noisy now
5086+
return;
5087+
}
5088+
5089+
writeSomeIterations(
5090+
write.writeIterations(), std::vector< uint64_t >{ 7, 1, 11 } );
50735091
write.flush();
50745092
}
50755093
{
@@ -5079,26 +5097,28 @@ void append_mode(
50795097
// in variable-based encodings, iterations are not parsed ahead of
50805098
// time but as they go
50815099
unsigned counter = 0;
5100+
uint64_t iterationOrder[] = { 0, 1, 2, 3, 4, 10, 7, 11 };
50825101
for( auto iteration : read.readIterations() )
50835102
{
5084-
REQUIRE( iteration.iterationIndex == counter );
5103+
REQUIRE(
5104+
iteration.iterationIndex == iterationOrder[ counter ] );
50855105
++counter;
50865106
}
5087-
REQUIRE( counter == 5 );
5107+
REQUIRE( counter == 8 );
50885108
// Cannot do listSeries here because the Series is already drained
50895109
REQUIRE_THROWS_AS(
50905110
helper::listSeries( read ), error::WrongAPIUsage );
50915111
}
50925112
else
50935113
{
5094-
REQUIRE( read.iterations.size() == 5 );
5114+
REQUIRE( read.iterations.size() == 8 );
50955115
/*
5096-
* Roadmap: for now, reading this should work by ignoring the last
5097-
* duplicate iteration.
5098-
* After merging https://github.com/openPMD/openPMD-api/pull/949, we
5099-
* should see both instances when reading.
5100-
* Final goal: Read only the last instance.
5101-
*/
5116+
* Roadmap: for now, reading this should work by ignoring the last
5117+
* duplicate iteration.
5118+
* After merging https://github.com/openPMD/openPMD-api/pull/949, we
5119+
* should see both instances when reading.
5120+
* Final goal: Read only the last instance.
5121+
*/
51025122
helper::listSeries( read );
51035123
}
51045124
}

0 commit comments

Comments
 (0)