@@ -2885,21 +2885,21 @@ TEST_CASE("git_hdf5_legacy_picongpu", "[serial][hdf5]")
28852885
28862886TEST_CASE (" git_hdf5_sample_attribute_test" , " [serial][hdf5]" )
28872887{
2888- try
2889- {
2890- Series o = Series (" ../samples/git-sample/data%T.h5" , Access::READ_ONLY);
2891-
2888+ auto verifySeries = [](Series o, bool this_is_the_original_file) {
28922889 REQUIRE (o.openPMD () == " 1.1.0" );
28932890 REQUIRE (o.openPMDextension () == 1 );
28942891 REQUIRE (o.basePath () == " /data/%T/" );
28952892 REQUIRE (o.meshesPath () == " fields/" );
28962893 REQUIRE (o.particlesPath () == " particles/" );
2897- REQUIRE (o.iterationEncoding () == IterationEncoding::fileBased);
2898- REQUIRE (o.iterationFormat () == " data%T.h5" );
2899- REQUIRE (o.name () == " data%T" );
2894+ if (this_is_the_original_file)
2895+ {
2896+ REQUIRE (o.iterationEncoding () == IterationEncoding::fileBased);
2897+ REQUIRE (o.iterationFormat () == " data%T.h5" );
2898+ REQUIRE (o.name () == " data%T" );
29002899
2901- REQUIRE (o.iterations .size () == 5 );
2902- REQUIRE (o.iterations .count (100 ) == 1 );
2900+ REQUIRE (o.iterations .size () == 5 );
2901+ REQUIRE (o.iterations .count (100 ) == 1 );
2902+ }
29032903
29042904 Iteration &iteration_100 = o.iterations [100 ];
29052905 REQUIRE (iteration_100.time <double >() == 3.2847121452090077e-14 );
@@ -3129,6 +3129,30 @@ TEST_CASE("git_hdf5_sample_attribute_test", "[serial][hdf5]")
31293129 REQUIRE (weighting_scalar.getDatatype () == Datatype::DOUBLE);
31303130 REQUIRE (weighting_scalar.getDimensionality () == 1 );
31313131 REQUIRE (weighting_scalar.getExtent () == e);
3132+ };
3133+
3134+ try
3135+ {
3136+ {
3137+ Series o =
3138+ Series (" ../samples/git-sample/data%T.h5" , Access::READ_ONLY);
3139+ verifySeries (o, true );
3140+
3141+ Series fromTemplate (
3142+ " ../samples/initialized_from_git_sample.json" ,
3143+ Access::CREATE,
3144+ R"( json.mode = "template")" );
3145+ auxiliary::initializeFromTemplate (fromTemplate, o, 100 );
3146+ fromTemplate.flush ();
3147+ }
3148+
3149+ {
3150+ Series o (
3151+ " ../samples/initialized_from_git_sample.json" ,
3152+ Access::READ_ONLY,
3153+ R"( json.mode = "template")" );
3154+ verifySeries (o, false );
3155+ }
31323156 }
31333157 catch (error::ReadError &e)
31343158 {
0 commit comments