Skip to content

Commit

Permalink
Further testing (@todo: cleanup)
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Nov 15, 2023
1 parent cc89024 commit 770c67e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion test/ParallelIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ std::vector<std::string> testedFileExtensions()
// sst and ssc need a receiver for testing
// bp4 is already tested via bp
return ext == "sst" || ext == "ssc" || ext == "bp4" ||
ext == "toml" || ext == "json";
ext == "json" || ext == "toml";
});
return {allExtensions.begin(), newEnd};
}
Expand Down
42 changes: 33 additions & 9 deletions test/SerialIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2935,21 +2935,21 @@ TEST_CASE("git_hdf5_legacy_picongpu", "[serial][hdf5]")

TEST_CASE("git_hdf5_sample_attribute_test", "[serial][hdf5]")
{
try
{
Series o = Series("../samples/git-sample/data%T.h5", Access::READ_ONLY);

auto verifySeries = [](Series o, bool this_is_the_original_file) {
REQUIRE(o.openPMD() == "1.1.0");
REQUIRE(o.openPMDextension() == 1);
REQUIRE(o.basePath() == "/data/%T/");
REQUIRE(o.meshesPath() == "fields/");
REQUIRE(o.particlesPath() == "particles/");
REQUIRE(o.iterationEncoding() == IterationEncoding::fileBased);
REQUIRE(o.iterationFormat() == "data%T.h5");
REQUIRE(o.name() == "data%T");
if (this_is_the_original_file)
{
REQUIRE(o.iterationEncoding() == IterationEncoding::fileBased);
REQUIRE(o.iterationFormat() == "data%T.h5");
REQUIRE(o.name() == "data%T");

REQUIRE(o.iterations.size() == 5);
REQUIRE(o.iterations.count(100) == 1);
REQUIRE(o.iterations.size() == 5);
REQUIRE(o.iterations.count(100) == 1);
}

Iteration &iteration_100 = o.iterations[100];
REQUIRE(iteration_100.time<double>() == 3.2847121452090077e-14);
Expand Down Expand Up @@ -3179,6 +3179,30 @@ TEST_CASE("git_hdf5_sample_attribute_test", "[serial][hdf5]")
REQUIRE(weighting_scalar.getDatatype() == Datatype::DOUBLE);
REQUIRE(weighting_scalar.getDimensionality() == 1);
REQUIRE(weighting_scalar.getExtent() == e);
};

try
{
{
Series o =
Series("../samples/git-sample/data%T.h5", Access::READ_ONLY);
verifySeries(o, true);

Series fromTemplate(
"../samples/initialized_from_git_sample.json",
Access::CREATE,
R"(json.mode = "template")");
auxiliary::initializeFromTemplate(fromTemplate, o, 100);
fromTemplate.flush();
}

{
Series o(
"../samples/initialized_from_git_sample.json",
Access::READ_ONLY,
R"(json.mode = "template")");
verifySeries(o, false);
}
}
catch (error::ReadError &e)
{
Expand Down

0 comments on commit 770c67e

Please sign in to comment.