@@ -2721,21 +2721,21 @@ TEST_CASE("git_hdf5_sample_structure_test", "[serial][hdf5]")
2721
2721
2722
2722
TEST_CASE (" git_hdf5_sample_attribute_test" , " [serial][hdf5]" )
2723
2723
{
2724
- try
2725
- {
2726
- Series o = Series (" ../samples/git-sample/data%T.h5" , Access::READ_ONLY);
2727
-
2724
+ auto verifySeries = [](Series o, bool this_is_the_original_file) {
2728
2725
REQUIRE (o.openPMD () == " 1.1.0" );
2729
2726
REQUIRE (o.openPMDextension () == 1 );
2730
2727
REQUIRE (o.basePath () == " /data/%T/" );
2731
2728
REQUIRE (o.meshesPath () == " fields/" );
2732
2729
REQUIRE (o.particlesPath () == " particles/" );
2733
- REQUIRE (o.iterationEncoding () == IterationEncoding::fileBased);
2734
- REQUIRE (o.iterationFormat () == " data%T.h5" );
2735
- REQUIRE (o.name () == " data%T" );
2730
+ if (this_is_the_original_file)
2731
+ {
2732
+ REQUIRE (o.iterationEncoding () == IterationEncoding::fileBased);
2733
+ REQUIRE (o.iterationFormat () == " data%T.h5" );
2734
+ REQUIRE (o.name () == " data%T" );
2736
2735
2737
- REQUIRE (o.iterations .size () == 5 );
2738
- REQUIRE (o.iterations .count (100 ) == 1 );
2736
+ REQUIRE (o.iterations .size () == 5 );
2737
+ REQUIRE (o.iterations .count (100 ) == 1 );
2738
+ }
2739
2739
2740
2740
Iteration &iteration_100 = o.iterations [100 ];
2741
2741
REQUIRE (iteration_100.time <double >() == 3.2847121452090077e-14 );
@@ -2965,6 +2965,30 @@ TEST_CASE("git_hdf5_sample_attribute_test", "[serial][hdf5]")
2965
2965
REQUIRE (weighting_scalar.getDatatype () == Datatype::DOUBLE);
2966
2966
REQUIRE (weighting_scalar.getDimensionality () == 1 );
2967
2967
REQUIRE (weighting_scalar.getExtent () == e);
2968
+ };
2969
+
2970
+ try
2971
+ {
2972
+ {
2973
+ Series o =
2974
+ Series (" ../samples/git-sample/data%T.h5" , Access::READ_ONLY);
2975
+ verifySeries (o, true );
2976
+
2977
+ Series fromTemplate (
2978
+ " ../samples/initialized_from_git_sample.json" ,
2979
+ Access::CREATE,
2980
+ R"( json.mode = "template")" );
2981
+ auxiliary::initializeFromTemplate (fromTemplate, o, 100 );
2982
+ fromTemplate.flush ();
2983
+ }
2984
+
2985
+ {
2986
+ Series o (
2987
+ " ../samples/initialized_from_git_sample.json" ,
2988
+ Access::READ_ONLY,
2989
+ R"( json.mode = "template")" );
2990
+ verifySeries (o, false );
2991
+ }
2968
2992
}
2969
2993
catch (no_such_file_error &e)
2970
2994
{
0 commit comments