Skip to content

Commit 492d9af

Browse files
committed
Add failing test
1 parent 67c82cf commit 492d9af

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

test/CoreTest.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,25 +185,27 @@ TEST_CASE("attribute_dtype_test", "[core]")
185185
}
186186
}
187187

188-
TEST_CASE("myPath", "[core]")
188+
void myPath(std::string const &filename, IterationEncoding ie)
189189
{
190+
auto filepath = "../samples/" + filename + ".json";
190191
#if openPMD_USE_INVASIVE_TESTS
191192
using vec_t = std::vector<std::string>;
192-
auto pathOf = [](Attributable &attr) {
193+
auto pathOf = [&](Attributable &attr) {
193194
auto res = attr.myPath();
194195
#if false
195196
std::cout << "Directory:\t" << res.directory << "\nSeries name:\t"
196197
<< res.seriesName << "\nSeries ext:\t" << res.seriesExtension
197198
<< std::endl;
198199
#endif
199200
REQUIRE(res.directory == "../samples/");
200-
REQUIRE(res.seriesName == "myPath");
201+
REQUIRE(res.seriesName == filename);
201202
REQUIRE(res.seriesExtension == ".json");
202-
REQUIRE(res.filePath() == "../samples/myPath.json");
203+
REQUIRE(res.filePath() == filepath);
203204
return res.group;
204205
};
205206

206-
Series series("../samples/myPath.json", Access::CREATE);
207+
Series series(filepath, Access::CREATE);
208+
series.setIterationEncoding(ie);
207209
REQUIRE(pathOf(series) == vec_t{});
208210
auto iteration = series.iterations[1234];
209211
REQUIRE(pathOf(iteration) == vec_t{"iterations", "1234"});
@@ -313,6 +315,13 @@ TEST_CASE("myPath", "[core]")
313315
#endif
314316
}
315317

318+
TEST_CASE("myPath", "[core]")
319+
{
320+
myPath("myPath_g", IterationEncoding::groupBased);
321+
myPath("myPath_%T", IterationEncoding::fileBased);
322+
myPath("myPath_v", IterationEncoding::variableBased);
323+
}
324+
316325
TEST_CASE("output_default_test", "[core]")
317326
{
318327
using IE = IterationEncoding;

0 commit comments

Comments
 (0)