@@ -2544,48 +2544,61 @@ TEST_CASE("patch_test", "[serial]")
25442544
25452545inline void deletion_test (const std::string &backend)
25462546{
2547- Series o = Series (" ../samples/serial_deletion." + backend, Access::CREATE);
2547+ {
2548+ Series o =
2549+ Series (" ../samples/serial_deletion." + backend, Access::CREATE);
25482550
2549- o.setAttribute (
2550- " removed" ,
2551- " this attribute will be removed after being written to disk" );
2552- o.flush ();
2551+ o.setAttribute (
2552+ " removed" ,
2553+ " this attribute will be removed after being written to disk" );
2554+ o.flush ();
25532555
2554- o.deleteAttribute (" removed" );
2555- o.flush ();
2556+ o.deleteAttribute (" removed" );
2557+ o.flush ();
25562558
2557- ParticleSpecies &e = o.iterations [1 ].particles [" e" ];
2558- auto dset = Dataset (Datatype::DOUBLE, {1 });
2559- e[" position" ][RecordComponent::SCALAR].resetDataset (dset);
2560- e[" position" ][RecordComponent::SCALAR].makeConstant (20.0 );
2561- e[" positionOffset" ][RecordComponent::SCALAR].resetDataset (dset);
2562- e[" positionOffset" ][RecordComponent::SCALAR].makeConstant (22.0 );
2563- e.erase (" deletion" );
2564- e.seriesFlush ();
2559+ ParticleSpecies &e = o.iterations [1 ].particles [" e" ];
2560+ auto dset = Dataset (Datatype::DOUBLE, {1 });
2561+ e[" position" ][RecordComponent::SCALAR].resetDataset (dset);
2562+ e[" position" ][RecordComponent::SCALAR].makeConstant (20.0 );
2563+ e[" positionOffset" ][RecordComponent::SCALAR].resetDataset (dset);
2564+ e[" positionOffset" ][RecordComponent::SCALAR].makeConstant (22.0 );
2565+ e.erase (" deletion" );
2566+ e.seriesFlush ();
25652567
2566- e[" deletion_scalar" ][RecordComponent::SCALAR].resetDataset (dset);
2567- o.flush ();
2568+ e[" deletion_scalar" ][RecordComponent::SCALAR].resetDataset (dset);
2569+ o.flush ();
25682570
2569- e[" deletion_scalar" ].erase (RecordComponent::SCALAR);
2570- e.erase (" deletion_scalar" );
2571- o.flush ();
2571+ e[" deletion_scalar" ].erase (RecordComponent::SCALAR);
2572+ e.erase (" deletion_scalar" );
2573+ o.flush ();
25722574
2573- e[" deletion_scalar_two" ][RecordComponent::SCALAR].resetDataset (dset);
2574- o.flush ();
2575+ e[" deletion_scalar_two" ][RecordComponent::SCALAR].resetDataset (dset);
2576+ o.flush ();
25752577
2576- e[" deletion_scalar_two" ].erase (
2577- e[" deletion_scalar_two" ].find (RecordComponent::SCALAR));
2578- e.erase (e.find (" deletion_scalar_two" ));
2579- o.flush ();
2578+ e[" deletion_scalar_two" ].erase (
2579+ e[" deletion_scalar_two" ].find (RecordComponent::SCALAR));
2580+ e.erase (e.find (" deletion_scalar_two" ));
2581+ o.flush ();
25802582
2581- double value = 0 .;
2582- e[" deletion_scalar_constant" ][RecordComponent::SCALAR].resetDataset (dset);
2583- e[" deletion_scalar_constant" ][RecordComponent::SCALAR].makeConstant (value);
2584- o.flush ();
2583+ double value = 0 .;
2584+ e[" deletion_scalar_constant" ][RecordComponent::SCALAR].resetDataset (
2585+ dset);
2586+ e[" deletion_scalar_constant" ][RecordComponent::SCALAR].makeConstant (
2587+ value);
2588+ o.flush ();
25852589
2586- e[" deletion_scalar_constant" ].erase (RecordComponent::SCALAR);
2587- e.erase (" deletion_scalar_constant" );
2588- o.flush ();
2590+ e[" deletion_scalar_constant" ].erase (RecordComponent::SCALAR);
2591+ e.erase (" deletion_scalar_constant" );
2592+ o.flush ();
2593+ o.close ();
2594+ }
2595+ {
2596+ Series i (" ../samples/serial_deletion." + backend, Access::READ_ONLY);
2597+ ParticleSpecies &e = i.snapshots ()[1 ].particles [" e" ];
2598+ REQUIRE (!e.contains (" deletion_scalar" ));
2599+ REQUIRE (!e.contains (" deletion_scalar_two" ));
2600+ REQUIRE (!e.contains (" deletion_scalar_constant" ));
2601+ }
25892602}
25902603
25912604TEST_CASE (" deletion_test" , " [serial]" )
0 commit comments