Skip to content

Commit

Permalink
Update close_iteration_test
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Oct 29, 2024
1 parent 688da80 commit ebc02cc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/Files_SerialIO/close_iteration_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "SerialIOTests.hpp"
#include "openPMD/IO/ADIOS/macros.hpp"
#include "openPMD/IO/Access.hpp"
#include "openPMD/Series.hpp"
#include "openPMD/auxiliary/Filesystem.hpp"

#include <catch2/catch.hpp>
Expand Down Expand Up @@ -80,15 +81,14 @@ auto run_test_filebased(
series = Series(filename, Access::READ_WRITE, write_cfg);

{
// @todo proper support for READ_WRITE in snapshots()
auto it = series.iterations[0].open();
auto it = series.snapshots()[0].open();
std::vector<int> data(5);
it.meshes["E"]["x"].loadChunkRaw(data.data(), {0}, {5});
it.close();
REQUIRE((data == std::vector<int>{0, 1, 2, 3, 4}));
}
{
auto it = series.iterations[2].open();
auto it = series.snapshots()[2].open();
std::vector<int> data(5);
it.meshes["E"]["x"].loadChunkRaw(data.data(), {0}, {5});
it.close();
Expand All @@ -98,7 +98,7 @@ auto run_test_filebased(
}

{
auto it = series.iterations[3].open();
auto it = series.snapshots()[3].open();
auto E_x = it.meshes["E"]["x"];
E_x.resetDataset({Datatype::INT, {5}});
std::vector<int> data{0, 1, 2, 3, 4};
Expand Down Expand Up @@ -274,6 +274,12 @@ auto close_and_reopen_test() -> void
run_test_filebased([](Series &s) { return s.iterations; }, "bp");
run_test_filebased([](Series &s) { return s.writeIterations(); }, "bp");
run_test_filebased([](Series &s) { return s.snapshots(); }, "bp");
run_test_filebased(
[](Series &s) { return s.snapshots(SnapshotWorkflow::Synchronous); },
"bp");
run_test_filebased(
[](Series &s) { return s.snapshots(SnapshotWorkflow::RandomAccess); },
"bp");
run_test_filebased([](Series &s) { return s.snapshots(); }, "json");
#if openPMD_HAVE_HDF5
run_test_filebased([](Series &s) { return s.snapshots(); }, "h5");
Expand Down

0 comments on commit ebc02cc

Please sign in to comment.