@@ -186,25 +186,27 @@ TEST_CASE("attribute_dtype_test", "[core]")
186186 }
187187}
188188
189- TEST_CASE ( " myPath" , " [core] " )
189+ void myPath (std::string const &filename, IterationEncoding ie )
190190{
191+ auto filepath = " ../samples/" + filename + " .json" ;
191192#if openPMD_USE_INVASIVE_TESTS
192193 using vec_t = std::vector<std::string>;
193- auto pathOf = [](Attributable &attr) {
194+ auto pathOf = [& ](Attributable &attr) {
194195 auto res = attr.myPath ();
195196#if false
196197 std::cout << " Directory:\t " << res.directory << " \n Series name:\t "
197198 << res.seriesName << " \n Series ext:\t " << res.seriesExtension
198199 << std::endl;
199200#endif
200201 REQUIRE (res.directory == " ../samples/" );
201- REQUIRE (res.seriesName == " myPath " );
202+ REQUIRE (res.seriesName == filename );
202203 REQUIRE (res.seriesExtension == " .json" );
203- REQUIRE (res.filePath () == " ../samples/myPath.json " );
204+ REQUIRE (res.filePath () == filepath );
204205 return res.group ;
205206 };
206207
207- Series series (" ../samples/myPath.json" , Access::CREATE);
208+ Series series (filepath, Access::CREATE);
209+ series.setIterationEncoding (ie);
208210 REQUIRE (pathOf (series) == vec_t {});
209211 auto iteration = series.iterations [1234 ];
210212 REQUIRE (pathOf (iteration) == vec_t {" data" , " 1234" });
@@ -306,6 +308,13 @@ TEST_CASE("myPath", "[core]")
306308#endif
307309}
308310
311+ TEST_CASE (" myPath" , " [core]" )
312+ {
313+ myPath (" myPath_g" , IterationEncoding::groupBased);
314+ myPath (" myPath_%T" , IterationEncoding::fileBased);
315+ myPath (" myPath_v" , IterationEncoding::variableBased);
316+ }
317+
309318TEST_CASE (" output_default_test" , " [core]" )
310319{
311320 using IE = IterationEncoding;
0 commit comments