@@ -3044,21 +3044,21 @@ TEST_CASE("git_hdf5_legacy_picongpu", "[serial][hdf5]")
30443044
30453045TEST_CASE (" git_hdf5_sample_attribute_test" , " [serial][hdf5]" )
30463046{
3047- try
3048- {
3049- Series o = Series (" ../samples/git-sample/data%T.h5" , Access::READ_ONLY);
3050-
3047+ auto verifySeries = [](Series o, bool this_is_the_original_file) {
30513048 REQUIRE (o.openPMD () == " 1.1.0" );
30523049 REQUIRE (o.openPMDextension () == 1 );
30533050 REQUIRE (o.basePath () == " /data/%T/" );
30543051 REQUIRE (o.meshesPath () == " fields/" );
30553052 REQUIRE (o.particlesPath () == " particles/" );
3056- REQUIRE (o.iterationEncoding () == IterationEncoding::fileBased);
3057- REQUIRE (o.iterationFormat () == " data%T.h5" );
3058- REQUIRE (o.name () == " data%T" );
3053+ if (this_is_the_original_file)
3054+ {
3055+ REQUIRE (o.iterationEncoding () == IterationEncoding::fileBased);
3056+ REQUIRE (o.iterationFormat () == " data%T.h5" );
3057+ REQUIRE (o.name () == " data%T" );
30593058
3060- REQUIRE (o.iterations .size () == 5 );
3061- REQUIRE (o.iterations .count (100 ) == 1 );
3059+ REQUIRE (o.iterations .size () == 5 );
3060+ REQUIRE (o.iterations .count (100 ) == 1 );
3061+ }
30623062
30633063 Iteration &iteration_100 = o.iterations [100 ];
30643064 REQUIRE (iteration_100.time <double >() == 3.2847121452090077e-14 );
@@ -3288,6 +3288,30 @@ TEST_CASE("git_hdf5_sample_attribute_test", "[serial][hdf5]")
32883288 REQUIRE (weighting_scalar.getDatatype () == Datatype::DOUBLE);
32893289 REQUIRE (weighting_scalar.getDimensionality () == 1 );
32903290 REQUIRE (weighting_scalar.getExtent () == e);
3291+ };
3292+
3293+ try
3294+ {
3295+ {
3296+ Series o =
3297+ Series (" ../samples/git-sample/data%T.h5" , Access::READ_ONLY);
3298+ verifySeries (o, true );
3299+
3300+ Series fromTemplate (
3301+ " ../samples/initialized_from_git_sample.json" ,
3302+ Access::CREATE,
3303+ R"( json.mode = "template")" );
3304+ auxiliary::initializeFromTemplate (fromTemplate, o, 100 );
3305+ fromTemplate.flush ();
3306+ }
3307+
3308+ {
3309+ Series o (
3310+ " ../samples/initialized_from_git_sample.json" ,
3311+ Access::READ_ONLY,
3312+ R"( json.mode = "template")" );
3313+ verifySeries (o, false );
3314+ }
32913315 }
32923316 catch (error::ReadError &e)
32933317 {
0 commit comments