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