@@ -2929,21 +2929,21 @@ TEST_CASE("git_hdf5_legacy_picongpu", "[serial][hdf5]")
29292929
29302930TEST_CASE (" git_hdf5_sample_attribute_test" , " [serial][hdf5]" )
29312931{
2932- try
2933- {
2934- Series o = Series (" ../samples/git-sample/data%T.h5" , Access::READ_ONLY);
2935-
2932+ auto verifySeries = [](Series o, bool this_is_the_original_file) {
29362933 REQUIRE (o.openPMD () == " 1.1.0" );
29372934 REQUIRE (o.openPMDextension () == 1 );
29382935 REQUIRE (o.basePath () == " /data/%T/" );
29392936 REQUIRE (o.meshesPath () == " fields/" );
29402937 REQUIRE (o.particlesPath () == " particles/" );
2941- REQUIRE (o.iterationEncoding () == IterationEncoding::fileBased);
2942- REQUIRE (o.iterationFormat () == " data%T.h5" );
2943- REQUIRE (o.name () == " data%T" );
2938+ if (this_is_the_original_file)
2939+ {
2940+ REQUIRE (o.iterationEncoding () == IterationEncoding::fileBased);
2941+ REQUIRE (o.iterationFormat () == " data%T.h5" );
2942+ REQUIRE (o.name () == " data%T" );
29442943
2945- REQUIRE (o.iterations .size () == 5 );
2946- REQUIRE (o.iterations .count (100 ) == 1 );
2944+ REQUIRE (o.iterations .size () == 5 );
2945+ REQUIRE (o.iterations .count (100 ) == 1 );
2946+ }
29472947
29482948 Iteration &iteration_100 = o.iterations [100 ];
29492949 REQUIRE (iteration_100.time <double >() == 3.2847121452090077e-14 );
@@ -3173,6 +3173,30 @@ TEST_CASE("git_hdf5_sample_attribute_test", "[serial][hdf5]")
31733173 REQUIRE (weighting_scalar.getDatatype () == Datatype::DOUBLE);
31743174 REQUIRE (weighting_scalar.getDimensionality () == 1 );
31753175 REQUIRE (weighting_scalar.getExtent () == e);
3176+ };
3177+
3178+ try
3179+ {
3180+ {
3181+ Series o =
3182+ Series (" ../samples/git-sample/data%T.h5" , Access::READ_ONLY);
3183+ verifySeries (o, true );
3184+
3185+ Series fromTemplate (
3186+ " ../samples/initialized_from_git_sample.json" ,
3187+ Access::CREATE,
3188+ R"( json.mode = "template")" );
3189+ auxiliary::initializeFromTemplate (fromTemplate, o, 100 );
3190+ fromTemplate.flush ();
3191+ }
3192+
3193+ {
3194+ Series o (
3195+ " ../samples/initialized_from_git_sample.json" ,
3196+ Access::READ_ONLY,
3197+ R"( json.mode = "template")" );
3198+ verifySeries (o, false );
3199+ }
31763200 }
31773201 catch (error::ReadError &e)
31783202 {
0 commit comments