Skip to content

Commit

Permalink
Fix invasive tests
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Sep 30, 2021
1 parent 67cb606 commit c43cfa8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
2 changes: 2 additions & 0 deletions include/openPMD/RecordComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ namespace internal
RecordComponentData & operator=( RecordComponentData const & ) = delete;
RecordComponentData & operator=( RecordComponentData && ) = delete;

OPENPMD_private:

std::queue< IOTask > m_chunks;
Attribute m_constantValue{ -1 };
/**
Expand Down
2 changes: 1 addition & 1 deletion include/openPMD/backend/Container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ class Container : public AttributableInterface
flushAttributes();
}

private:
OPENPMD_private:
Container() : AttributableInterface{ nullptr }
{
AttributableInterface::setData( m_containerData.get() );
Expand Down
4 changes: 3 additions & 1 deletion include/openPMD/backend/PatchRecordComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace internal
friend class openPMD::PatchRecordComponent;
friend class openPMD::PatchRecordComponent;

OPENPMD_private:

std::queue< IOTask > m_chunks;

PatchRecordComponentData( PatchRecordComponentData const & ) = delete;
Expand Down Expand Up @@ -112,7 +114,7 @@ class PatchRecordComponent : public BaseRecordComponent

PatchRecordComponent();

protected:
OPENPMD_protected:
PatchRecordComponent(
std::shared_ptr< internal::PatchRecordComponentData > );

Expand Down
32 changes: 16 additions & 16 deletions test/CoreTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ TEST_CASE( "myPath", "[core]" )
{
#if openPMD_USE_INVASIVE_TESTS
using vec_t = std::vector< std::string >;
auto pathOf = []( AttributableInterface & attr )
auto pathOf = []( Attributable & attr )
{
auto res = attr.myPath();
#if false
Expand Down Expand Up @@ -748,8 +748,8 @@ TEST_CASE( "wrapper_test", "[core]" )
o.flush();
REQUIRE(all_data.get()[0] == value);
#if openPMD_USE_INVASIVE_TESTS
REQUIRE(o.iterations[4].meshes["E"]["y"].m_chunks->empty());
REQUIRE(mrc2.m_chunks->empty());
REQUIRE(o.iterations[4].meshes["E"]["y"].get().m_chunks.empty());
REQUIRE(mrc2.get().m_chunks.empty());
#endif

MeshRecordComponent mrc3 = o.iterations[5].meshes["E"]["y"];
Expand All @@ -760,13 +760,13 @@ TEST_CASE( "wrapper_test", "[core]" )
std::shared_ptr< double > storeData = std::make_shared< double >(44);
o.iterations[5].meshes["E"]["y"].storeChunk(storeData, {0}, {1});
#if openPMD_USE_INVASIVE_TESTS
REQUIRE(o.iterations[5].meshes["E"]["y"].m_chunks->size() == 1);
REQUIRE(mrc3.m_chunks->size() == 1);
REQUIRE(o.iterations[5].meshes["E"]["y"].get().m_chunks.size() == 1);
REQUIRE(mrc3.get().m_chunks.size() == 1);
#endif
o.flush();
#if openPMD_USE_INVASIVE_TESTS
REQUIRE(o.iterations[5].meshes["E"]["y"].m_chunks->empty());
REQUIRE(mrc3.m_chunks->empty());
REQUIRE(o.iterations[5].meshes["E"]["y"].get().m_chunks.empty());
REQUIRE(mrc3.get().m_chunks.empty());
#endif

o.iterations[6].particles["electrons"].particlePatches["numParticles"][RecordComponent::SCALAR].resetDataset(Dataset(determineDatatype< uint64_t >(), {4}));
Expand All @@ -782,27 +782,27 @@ TEST_CASE( "wrapper_test", "[core]" )
size_t idx = 0;
uint64_t val = 10;
#if openPMD_USE_INVASIVE_TESTS
REQUIRE(o.iterations[6].particles["electrons"].particlePatches["numParticles"][RecordComponent::SCALAR].m_chunks->empty());
REQUIRE(pp["numParticles"][RecordComponent::SCALAR].m_chunks->empty());
REQUIRE(o.iterations[6].particles["electrons"].particlePatches["numParticles"][RecordComponent::SCALAR].get().m_chunks.empty());
REQUIRE(pp["numParticles"][RecordComponent::SCALAR].get().m_chunks.empty());
#endif
pp["numParticles"][RecordComponent::SCALAR].store(idx, val);
#if openPMD_USE_INVASIVE_TESTS
REQUIRE(o.iterations[6].particles["electrons"].particlePatches["numParticles"][RecordComponent::SCALAR].m_chunks->size() == 1);
REQUIRE(pp["numParticles"][RecordComponent::SCALAR].m_chunks->size() == 1);
REQUIRE(o.iterations[6].particles["electrons"].particlePatches["numParticles"][RecordComponent::SCALAR].get().m_chunks.size() == 1);
REQUIRE(pp["numParticles"][RecordComponent::SCALAR].get().m_chunks.size() == 1);
#endif
std::stringstream u64str;
u64str << determineDatatype<uint64_t>();
REQUIRE_THROWS_WITH(o.iterations[6].particles["electrons"].particlePatches["numParticles"][RecordComponent::SCALAR].store(idx+1, 42.),
Catch::Equals("Datatypes of patch data (DOUBLE) and dataset (" + u64str.str() + ") do not match."));
o.iterations[6].particles["electrons"].particlePatches["numParticles"][RecordComponent::SCALAR].store(idx+1, val+1);
#if openPMD_USE_INVASIVE_TESTS
REQUIRE(o.iterations[6].particles["electrons"].particlePatches["numParticles"][RecordComponent::SCALAR].m_chunks->size() == 2);
REQUIRE(pp["numParticles"][RecordComponent::SCALAR].m_chunks->size() == 2);
REQUIRE(o.iterations[6].particles["electrons"].particlePatches["numParticles"][RecordComponent::SCALAR].get().m_chunks.size() == 2);
REQUIRE(pp["numParticles"][RecordComponent::SCALAR].get().m_chunks.size() == 2);
#endif
o.flush();
#if openPMD_USE_INVASIVE_TESTS
REQUIRE(o.iterations[6].particles["electrons"].particlePatches["numParticles"][RecordComponent::SCALAR].m_chunks->empty());
REQUIRE(pp["numParticles"][RecordComponent::SCALAR].m_chunks->empty());
REQUIRE(o.iterations[6].particles["electrons"].particlePatches["numParticles"][RecordComponent::SCALAR].get().m_chunks.empty());
REQUIRE(pp["numParticles"][RecordComponent::SCALAR].get().m_chunks.empty());
#endif
}

Expand All @@ -826,7 +826,7 @@ TEST_CASE( "use_count_test", "[core]" )
o.iterations[6].particles["electrons"]["positionOffset"][RecordComponent::SCALAR].resetDataset(dset);
pprc.resetDataset(Dataset(determineDatatype<uint64_t>(), {4}));
pprc.store(0, static_cast< uint64_t >(1));
REQUIRE(static_cast< Parameter< Operation::WRITE_DATASET >* >(pprc.m_chunks->front().parameter.get())->data.use_count() == 1);
REQUIRE(static_cast< Parameter< Operation::WRITE_DATASET >* >(pprc.get().m_chunks.front().parameter.get())->data.use_count() == 1);
#endif
}

Expand Down

0 comments on commit c43cfa8

Please sign in to comment.