@@ -6332,34 +6332,56 @@ void unfinished_iteration_test(
63326332 auto electron_mass =
63336333 it10.particles [" e" ][" mass" ][RecordComponent::SCALAR];
63346334 }
6335- auto tryReading = [&config,
6336- file](std::string const &additionalConfig = " {}" ) {
6337- Series read (
6338- file, Access::READ_ONLY, json::merge (config, additionalConfig));
6339-
6340- std::vector<decltype (Series::iterations)::key_type> iterations;
6341- std::cout << " Going to list iterations in " << file << " :" << std::endl;
6342- for (auto iteration : read.readIterations ())
6335+ auto tryReading = [&config, file, filebased](
6336+ std::string const &additionalConfig = " {}" ) {
63436337 {
6344- std::cout << " Seeing iteration " << iteration.iterationIndex
6338+ Series read (
6339+ file, Access::READ_ONLY, json::merge (config, additionalConfig));
6340+
6341+ std::vector<decltype (Series::iterations)::key_type> iterations;
6342+ std::cout << " Going to list iterations in " << file << " :"
63456343 << std::endl;
6346- iterations.push_back (iteration.iterationIndex );
6344+ for (auto iteration : read.readIterations ())
6345+ {
6346+ std::cout << " Seeing iteration " << iteration.iterationIndex
6347+ << std::endl;
6348+ iterations.push_back (iteration.iterationIndex );
63476349
6348- Parameter<Operation::READ_ATT> readAttribute;
6349- readAttribute.name = " this_does_definitely_not_exist" ;
6350- read.IOHandler ()->enqueue (IOTask (&iteration, readAttribute));
6351- // enqueue a second time to check that the queue is cleared upon
6352- // exception
6353- read.IOHandler ()->enqueue (IOTask (&iteration, readAttribute));
6350+ Parameter<Operation::READ_ATT> readAttribute;
6351+ readAttribute.name = " this_does_definitely_not_exist" ;
6352+ read.IOHandler ()->enqueue (IOTask (&iteration, readAttribute));
6353+ // enqueue a second time to check that the queue is cleared upon
6354+ // exception
6355+ read.IOHandler ()->enqueue (IOTask (&iteration, readAttribute));
63546356
6355- REQUIRE_THROWS_AS (
6356- read.IOHandler ()->flush ({FlushLevel::InternalFlush}),
6357- error::ReadError);
6358- REQUIRE (read.IOHandler ()->m_work .empty ());
6357+ REQUIRE_THROWS_AS (
6358+ read.IOHandler ()->flush ({FlushLevel::InternalFlush}),
6359+ error::ReadError);
6360+ REQUIRE (read.IOHandler ()->m_work .empty ());
6361+ }
6362+ REQUIRE (
6363+ (iterations ==
6364+ std::vector<decltype (Series::iterations)::key_type>{0 , 10 }));
6365+ }
6366+
6367+ if (filebased)
6368+ {
6369+ Series read (
6370+ file, Access::READ_ONLY, json::merge (config, additionalConfig));
6371+ if (additionalConfig == " {}" )
6372+ {
6373+ // Eager parsing, defective iteration has already been removed
6374+ REQUIRE (!read.iterations .contains (5 ));
6375+ read.iterations [0 ].open ();
6376+ read.iterations [10 ].open ();
6377+ }
6378+ else
6379+ {
6380+ REQUIRE_THROWS_AS (read.iterations [5 ].open (), error::ReadError);
6381+ read.iterations [0 ].open ();
6382+ read.iterations [10 ].open ();
6383+ }
63596384 }
6360- REQUIRE (
6361- (iterations ==
6362- std::vector<decltype (Series::iterations)::key_type>{0 , 10 }));
63636385 };
63646386
63656387 tryReading ();
0 commit comments