@@ -186,25 +186,27 @@ TEST_CASE("attribute_dtype_test", "[core]")
186
186
}
187
187
}
188
188
189
- TEST_CASE ( " myPath" , " [core] " )
189
+ void myPath (std::string const &filename, IterationEncoding ie )
190
190
{
191
+ auto filepath = " ../samples/" + filename + " .json" ;
191
192
#if openPMD_USE_INVASIVE_TESTS
192
193
using vec_t = std::vector<std::string>;
193
- auto pathOf = [](Attributable &attr) {
194
+ auto pathOf = [& ](Attributable &attr) {
194
195
auto res = attr.myPath ();
195
196
#if false
196
197
std::cout << " Directory:\t " << res.directory << " \n Series name:\t "
197
198
<< res.seriesName << " \n Series ext:\t " << res.seriesExtension
198
199
<< std::endl;
199
200
#endif
200
201
REQUIRE (res.directory == " ../samples/" );
201
- REQUIRE (res.seriesName == " myPath " );
202
+ REQUIRE (res.seriesName == filename );
202
203
REQUIRE (res.seriesExtension == " .json" );
203
- REQUIRE (res.filePath () == " ../samples/myPath.json " );
204
+ REQUIRE (res.filePath () == filepath );
204
205
return res.group ;
205
206
};
206
207
207
- Series series (" ../samples/myPath.json" , Access::CREATE);
208
+ Series series (filepath, Access::CREATE);
209
+ series.setIterationEncoding (ie);
208
210
REQUIRE (pathOf (series) == vec_t {});
209
211
auto iteration = series.iterations [1234 ];
210
212
REQUIRE (pathOf (iteration) == vec_t {" data" , " 1234" });
@@ -306,6 +308,13 @@ TEST_CASE("myPath", "[core]")
306
308
#endif
307
309
}
308
310
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
+
309
318
TEST_CASE (" output_default_test" , " [core]" )
310
319
{
311
320
using IE = IterationEncoding;
0 commit comments