@@ -1144,8 +1144,10 @@ TEST_CASE("wrapper_test", "[core]")
11441144 std::shared_ptr<double > storeData = std::make_shared<double >(44 );
11451145 o.iterations [5 ].meshes [" E" ][" y" ].storeChunk (storeData, {0 }, {1 });
11461146#if openPMD_USE_INVASIVE_TESTS
1147- REQUIRE (o.iterations [5 ].meshes [" E" ][" y" ].get ().m_chunks .size () == 1 );
1148- REQUIRE (mrc3.get ().m_chunks .size () == 1 );
1147+ size_t num_chunks = o.IOHandler ()->m_flush_immediately ? 0 : 1 ;
1148+ REQUIRE (
1149+ o.iterations [5 ].meshes [" E" ][" y" ].get ().m_chunks .size () == num_chunks);
1150+ REQUIRE (mrc3.get ().m_chunks .size () == num_chunks);
11491151#endif
11501152 o.flush ();
11511153#if openPMD_USE_INVASIVE_TESTS
@@ -1198,9 +1200,10 @@ TEST_CASE("wrapper_test", "[core]")
11981200 .particles [" electrons" ]
11991201 .particlePatches [" numParticles" ][RecordComponent::SCALAR]
12001202 .get ()
1201- .m_chunks .size () == 1 );
1203+ .m_chunks .size () == num_chunks );
12021204 REQUIRE (
1203- pp[" numParticles" ][RecordComponent::SCALAR].get ().m_chunks .size () == 1 );
1205+ pp[" numParticles" ][RecordComponent::SCALAR].get ().m_chunks .size () ==
1206+ num_chunks);
12041207#endif
12051208 std::stringstream u64str;
12061209 u64str << determineDatatype<uint64_t >();
@@ -1222,9 +1225,10 @@ TEST_CASE("wrapper_test", "[core]")
12221225 .particles [" electrons" ]
12231226 .particlePatches [" numParticles" ][RecordComponent::SCALAR]
12241227 .get ()
1225- .m_chunks .size () == 2 );
1228+ .m_chunks .size () == num_chunks * 2 );
12261229 REQUIRE (
1227- pp[" numParticles" ][RecordComponent::SCALAR].get ().m_chunks .size () == 2 );
1230+ pp[" numParticles" ][RecordComponent::SCALAR].get ().m_chunks .size () ==
1231+ num_chunks * 2 );
12281232#endif
12291233 o.flush ();
12301234#if openPMD_USE_INVASIVE_TESTS
@@ -1267,11 +1271,13 @@ TEST_CASE("use_count_test", "[core]")
12671271 std::shared_ptr<uint16_t > storeData = std::make_shared<uint16_t >(44 );
12681272 REQUIRE (storeData.use_count () == 1 );
12691273 mrc.storeChunk (storeData, {0 }, {1 });
1270- REQUIRE (storeData.use_count () == 2 );
1274+ #if openPMD_USE_INVASIVE_TESTS
1275+ long additional_internal_use_count =
1276+ o.IOHandler ()->m_flush_immediately ? 0 : 1 ;
1277+ REQUIRE (storeData.use_count () == (1 + additional_internal_use_count));
12711278 o.flush ();
12721279 REQUIRE (storeData.use_count () == 1 );
12731280
1274- #if openPMD_USE_INVASIVE_TESTS
12751281 PatchRecordComponent pprc =
12761282 o.iterations [6 ]
12771283 .particles [" electrons" ]
@@ -1285,12 +1291,19 @@ TEST_CASE("use_count_test", "[core]")
12851291 .resetDataset (dset);
12861292 pprc.resetDataset (Dataset (determineDatatype<uint64_t >(), {4 }));
12871293 pprc.store (0 , static_cast <uint64_t >(1 ));
1288- REQUIRE (
1289- std::get<std::shared_ptr<void >>(
1290- static_cast <Parameter<Operation::WRITE_DATASET> *>(
1291- pprc.get ().m_chunks .front ().parameter .get ())
1292- ->data .as_variant <auxiliary::WriteBufferTypes>())
1293- .use_count () == 1 );
1294+ if (o.IOHandler ()->m_flush_immediately )
1295+ {
1296+ REQUIRE (pprc.get ().m_chunks .empty ());
1297+ }
1298+ else
1299+ {
1300+ REQUIRE (
1301+ std::get<std::shared_ptr<void >>(
1302+ static_cast <Parameter<Operation::WRITE_DATASET> *>(
1303+ pprc.get ().m_chunks .front ().parameter .get ())
1304+ ->data .as_variant <auxiliary::WriteBufferTypes>())
1305+ .use_count () == 1 );
1306+ }
12941307#endif
12951308}
12961309
0 commit comments