Skip to content

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Dec 18, 2024
1 parent 67c82cf commit 492d9af
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions test/CoreTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,25 +185,27 @@ TEST_CASE("attribute_dtype_test", "[core]")
}
}

TEST_CASE("myPath", "[core]")
void myPath(std::string const &filename, IterationEncoding ie)
{
auto filepath = "../samples/" + filename + ".json";
#if openPMD_USE_INVASIVE_TESTS
using vec_t = std::vector<std::string>;
auto pathOf = [](Attributable &attr) {
auto pathOf = [&](Attributable &attr) {
auto res = attr.myPath();
#if false
std::cout << "Directory:\t" << res.directory << "\nSeries name:\t"
<< res.seriesName << "\nSeries ext:\t" << res.seriesExtension
<< std::endl;
#endif
REQUIRE(res.directory == "../samples/");
REQUIRE(res.seriesName == "myPath");
REQUIRE(res.seriesName == filename);
REQUIRE(res.seriesExtension == ".json");
REQUIRE(res.filePath() == "../samples/myPath.json");
REQUIRE(res.filePath() == filepath);
return res.group;
};

Series series("../samples/myPath.json", Access::CREATE);
Series series(filepath, Access::CREATE);
series.setIterationEncoding(ie);
REQUIRE(pathOf(series) == vec_t{});
auto iteration = series.iterations[1234];
REQUIRE(pathOf(iteration) == vec_t{"iterations", "1234"});
Expand Down Expand Up @@ -313,6 +315,13 @@ TEST_CASE("myPath", "[core]")
#endif
}

TEST_CASE("myPath", "[core]")
{
myPath("myPath_g", IterationEncoding::groupBased);
myPath("myPath_%T", IterationEncoding::fileBased);
myPath("myPath_v", IterationEncoding::variableBased);
}

TEST_CASE("output_default_test", "[core]")
{
using IE = IterationEncoding;
Expand Down

0 comments on commit 492d9af

Please sign in to comment.