Skip to content

Commit f3e5c5b

Browse files
committed
Add failing test
1 parent fb0c94d commit f3e5c5b

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

test/CoreTest.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,25 +379,27 @@ TEST_CASE("attribute_dtype_test", "[core]")
379379
}
380380
}
381381

382-
TEST_CASE("myPath", "[core]")
382+
void myPath(std::string const &filename, IterationEncoding ie)
383383
{
384+
auto filepath = "../samples/" + filename + ".json";
384385
#if openPMD_USE_INVASIVE_TESTS
385386
using vec_t = std::vector<std::string>;
386-
auto pathOf = [](Attributable const &attr) {
387+
auto pathOf = [&](Attributable const &attr) {
387388
auto res = attr.myPath();
388389
#if false
389390
std::cout << "Directory:\t" << res.directory << "\nSeries name:\t"
390391
<< res.seriesName << "\nSeries ext:\t" << res.seriesExtension
391392
<< std::endl;
392393
#endif
393394
REQUIRE(res.directory == "../samples/");
394-
REQUIRE(res.seriesName == "myPath");
395+
REQUIRE(res.seriesName == filename);
395396
REQUIRE(res.seriesExtension == ".json");
396-
REQUIRE(res.filePath() == "../samples/myPath.json");
397+
REQUIRE(res.filePath() == filepath);
397398
return res.group;
398399
};
399400

400-
Series series("../samples/myPath.json", Access::CREATE);
401+
Series series(filepath, Access::CREATE);
402+
series.setIterationEncoding(ie);
401403
REQUIRE(pathOf(series) == vec_t{});
402404
REQUIRE(pathOf(series.iterations) == vec_t{"data"});
403405
REQUIRE(pathOf(series.snapshots()) == vec_t{"data"});
@@ -511,6 +513,13 @@ TEST_CASE("myPath", "[core]")
511513
#endif
512514
}
513515

516+
TEST_CASE("myPath", "[core]")
517+
{
518+
myPath("myPath_g", IterationEncoding::groupBased);
519+
myPath("myPath_%T", IterationEncoding::fileBased);
520+
myPath("myPath_v", IterationEncoding::variableBased);
521+
}
522+
514523
TEST_CASE("output_default_test", "[core]")
515524
{
516525
using IE = IterationEncoding;

0 commit comments

Comments
 (0)