@@ -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 << " \n Series name:\t "
390391 << res.seriesName << " \n Series 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+
514523TEST_CASE (" output_default_test" , " [core]" )
515524{
516525 using IE = IterationEncoding;
0 commit comments