diff --git a/include/podio/CollectionIDTable.h b/include/podio/CollectionIDTable.h index 90d35c5ed..3cb2986d5 100644 --- a/include/podio/CollectionIDTable.h +++ b/include/podio/CollectionIDTable.h @@ -41,7 +41,7 @@ class CollectionIDTable { /// return registered names const std::vector& names() const { return m_names; - }; + } /// return the ids const std::vector& ids() const { diff --git a/include/podio/Frame.h b/include/podio/Frame.h index 6c0c30bd9..82a399052 100644 --- a/include/podio/Frame.h +++ b/include/podio/Frame.h @@ -114,7 +114,7 @@ class Frame { /// Get a const reference to the internally used GenericParameters const podio::GenericParameters& parameters() const override { return *m_parameters; - }; + } bool get(uint32_t collectionID, podio::CollectionBase*& collection) const override; diff --git a/include/podio/UserDataCollection.h b/include/podio/UserDataCollection.h index 63660a72f..226d412fe 100644 --- a/include/podio/UserDataCollection.h +++ b/include/podio/UserDataCollection.h @@ -161,7 +161,7 @@ class UserDataCollection : public CollectionBase { /// clear the collection and all internal states void clear() override { _vec.clear(); - }; + } /// check if this collection is a subset collection - no subset possible bool isSubsetCollection() const override { diff --git a/podioVersion.in.h b/podioVersion.in.h index bf41dc575..3348e9d5e 100644 --- a/podioVersion.in.h +++ b/podioVersion.in.h @@ -64,7 +64,7 @@ struct Version { std::stringstream ss; ss << *this; return ss.str(); - }; + } friend std::ostream& operator<<(std::ostream&, const Version& v); }; diff --git a/python/templates/Collection.h.jinja2 b/python/templates/Collection.h.jinja2 index bd2cdbd29..baa916773 100644 --- a/python/templates/Collection.h.jinja2 +++ b/python/templates/Collection.h.jinja2 @@ -136,7 +136,7 @@ public: ); } m_isValid = true; - }; + } uint32_t getID() const final { return m_collectionID; diff --git a/src/MurmurHash3.cpp b/src/MurmurHash3.cpp index a782eeeaa..189b1a089 100644 --- a/src/MurmurHash3.cpp +++ b/src/MurmurHash3.cpp @@ -131,7 +131,7 @@ void MurmurHash3_x86_32(const void* key, int len, uint32_t seed, void* out) { k1 = ROTL32(k1, 15); k1 *= c2; h1 ^= k1; - }; + } //---------- // finalization @@ -281,7 +281,7 @@ void MurmurHash3_x86_128(const void* key, const int len, uint32_t seed, void* ou k1 = ROTL32(k1, 15); k1 *= c2; h1 ^= k1; - }; + } //---------- // finalization @@ -418,7 +418,7 @@ void MurmurHash3_x64_128(const void* key, const int len, const uint32_t seed, vo k1 = ROTL64(k1, 31); k1 *= c2; h1 ^= k1; - }; + } //---------- // finalization diff --git a/tests/read_frame.h b/tests/read_frame.h index 0103afea1..5bb45ba3e 100644 --- a/tests/read_frame.h +++ b/tests/read_frame.h @@ -20,59 +20,59 @@ void processExtensions(const podio::Frame& event, int iEvent, podio::version::Version) { const auto& extColl = event.get("extension_Contained"); - ASSERT(extColl.isValid(), "extension_Contained collection should be present"); - ASSERT(extColl.size() == 1, "extension_Contained collection should have one element"); + ASSERT(extColl.isValid(), "extension_Contained collection should be present") + ASSERT(extColl.size() == 1, "extension_Contained collection should have one element") auto extElem = extColl[0]; const auto& polVec = extElem.getAVector(); - ASSERT(polVec.r == iEvent * 123.f, "polVec.r value not as expected"); - ASSERT(polVec.phi == 0.15f, "polVec.phi value not as expected"); - ASSERT(polVec.rho == 3.14f, "polVec.phi value not as expected"); + ASSERT(polVec.r == iEvent * 123.f, "polVec.r value not as expected") + ASSERT(polVec.phi == 0.15f, "polVec.phi value not as expected") + ASSERT(polVec.rho == 3.14f, "polVec.phi value not as expected") const auto& extCompColl = event.get("extension_ExternalComponent"); - ASSERT(extCompColl.isValid(), "extension_ExternalComponent collection should be present"); - ASSERT(extCompColl.size() == 1, "extension_ExternalComponent should have one element"); + ASSERT(extCompColl.isValid(), "extension_ExternalComponent collection should be present") + ASSERT(extCompColl.size() == 1, "extension_ExternalComponent should have one element") auto extCompElem = extCompColl[0]; ASSERT((extCompElem.getAStruct().p == std::array{iEvent, iEvent - 2, iEvent + 4, iEvent * 8}), - "aStruct.p value not as expected"); - ASSERT(extCompElem.getAComponent().aStruct.data.x == 42 * iEvent, "aComponent.aStruct.x value not as expected"); - ASSERT(extCompElem.getAComponent().nspStruct.x == iEvent, "aComponent.nspStruct.x value not as expected"); - ASSERT(extCompElem.getAComponent().nspStruct.y == iEvent * 2, "aComponent.nspStruct.y value not as expected"); + "aStruct.p value not as expected") + ASSERT(extCompElem.getAComponent().aStruct.data.x == 42 * iEvent, "aComponent.aStruct.x value not as expected") + ASSERT(extCompElem.getAComponent().nspStruct.x == iEvent, "aComponent.nspStruct.x value not as expected") + ASSERT(extCompElem.getAComponent().nspStruct.y == iEvent * 2, "aComponent.nspStruct.y value not as expected") const auto& extRelColl = event.get("extension_ExternalRelation"); - ASSERT(extRelColl.isValid(), "extension_ExternalRelation collection should be present"); - ASSERT(extRelColl.size() == 3, "extension_ExternalRelation collection should contain 3 elements"); + ASSERT(extRelColl.isValid(), "extension_ExternalRelation collection should be present") + ASSERT(extRelColl.size() == 3, "extension_ExternalRelation collection should contain 3 elements") const auto& hits = event.get("hits"); auto elem0 = extRelColl[0]; - ASSERT(elem0.getWeight() == iEvent * 100.f, "weight of first element not as expected"); - ASSERT(elem0.getSingleHit() == hits[0], "single hit relation not as expected"); + ASSERT(elem0.getWeight() == iEvent * 100.f, "weight of first element not as expected") + ASSERT(elem0.getSingleHit() == hits[0], "single hit relation not as expected") const auto& clusters = event.get("clusters"); auto elem1 = extRelColl[1]; const auto relClusters = elem1.getClusters(); - ASSERT(relClusters.size() == 2, "element should have two related clusters"); - ASSERT(relClusters[0] == clusters[1], "first related cluster not as expected"); - ASSERT(relClusters[1] == clusters[0], "first related cluster not as expected"); + ASSERT(relClusters.size() == 2, "element should have two related clusters") + ASSERT(relClusters[0] == clusters[1], "first related cluster not as expected") + ASSERT(relClusters[1] == clusters[0], "first related cluster not as expected") auto elem2 = extRelColl[2]; const auto& structs = elem2.getSomeStructs(); - ASSERT(structs.size() == 3, "element should have 3 struct vector members"); - ASSERT(structs[0].y == 0, "struct value not as expected"); - ASSERT(structs[1].y == iEvent, "struct value not as expected"); - ASSERT(structs[2].y == 2 * iEvent, "struct value not as expected"); + ASSERT(structs.size() == 3, "element should have 3 struct vector members") + ASSERT(structs[0].y == 0, "struct value not as expected") + ASSERT(structs[1].y == iEvent, "struct value not as expected") + ASSERT(structs[2].y == 2 * iEvent, "struct value not as expected") } void checkVecMemSubsetColl(const podio::Frame& event) { const auto& subsetColl = event.get("VectorMemberSubsetColl"); const auto& origColl = event.get("WithVectorMember"); - ASSERT(subsetColl.isSubsetCollection(), "subset collection not read back as a subset collection"); - ASSERT(subsetColl.size() == 1, "subset collection should have size 1"); - ASSERT(subsetColl[0] == origColl[0], "subset coll does not have the right contents"); + ASSERT(subsetColl.isSubsetCollection(), "subset collection not read back as a subset collection") + ASSERT(subsetColl.size() == 1, "subset collection should have size 1") + ASSERT(subsetColl[0] == origColl[0], "subset coll does not have the right contents") } void checkInterfaceCollection(const podio::Frame& event) { const auto& interfaceColl = event.get("interface_examples"); - ASSERT(interfaceColl.size() == 2, "interface_examples should have two elements"); + ASSERT(interfaceColl.size() == 2, "interface_examples should have two elements") const auto& hits = event.get("hits"); const auto& particles = event.get("mcparticles"); @@ -81,22 +81,22 @@ void checkInterfaceCollection(const podio::Frame& event) { const auto iface0 = interfaceColl[0]; const auto iface1 = interfaceColl[1]; - ASSERT(iface0.aSingleEnergyType() == hits[0], "OneToOneRelation aSingleEnergy not persisted as expected"); - ASSERT(iface1.aSingleEnergyType() == clusters[0], "OneToOneRelation aSingleEnergy not persisted as expected"); + ASSERT(iface0.aSingleEnergyType() == hits[0], "OneToOneRelation aSingleEnergy not persisted as expected") + ASSERT(iface1.aSingleEnergyType() == clusters[0], "OneToOneRelation aSingleEnergy not persisted as expected") const auto iface0Rels = iface0.manyEnergies(); ASSERT(iface0Rels.size() == 3, - "OneToManyRelation to interface does not have the expected number of related elements"); - ASSERT(iface0Rels[0] == hits[0], "OneToManyRelations to interface not persisted correctly"); - ASSERT(iface0Rels[1] == clusters[0], "OneToManyRelations to interface not persisted correctly"); - ASSERT(iface0Rels[2] == particles[0], "OneToManyRelations to interface not persisted correctly"); + "OneToManyRelation to interface does not have the expected number of related elements") + ASSERT(iface0Rels[0] == hits[0], "OneToManyRelations to interface not persisted correctly") + ASSERT(iface0Rels[1] == clusters[0], "OneToManyRelations to interface not persisted correctly") + ASSERT(iface0Rels[2] == particles[0], "OneToManyRelations to interface not persisted correctly") const auto iface1Rels = iface1.manyEnergies(); ASSERT(iface1Rels.size() == 3, - "OneToManyRelation to interface does not have the expected number of related elements"); - ASSERT(iface1Rels[0] == particles[0], "OneToManyRelations to interface not persisted correctly"); - ASSERT(iface1Rels[1] == hits[0], "OneToManyRelations to interface not persisted correctly"); - ASSERT(iface1Rels[2] == clusters[0], "OneToManyRelations to interface not persisted correctly"); + "OneToManyRelation to interface does not have the expected number of related elements") + ASSERT(iface1Rels[0] == particles[0], "OneToManyRelations to interface not persisted correctly") + ASSERT(iface1Rels[1] == hits[0], "OneToManyRelations to interface not persisted correctly") + ASSERT(iface1Rels[2] == clusters[0], "OneToManyRelations to interface not persisted correctly") } template diff --git a/tests/root_io/relation_range.cpp b/tests/root_io/relation_range.cpp index 6159e8cdc..9c48de573 100644 --- a/tests/root_io/relation_range.cpp +++ b/tests/root_io/relation_range.cpp @@ -60,22 +60,22 @@ void fillExampleMCCollection(ExampleMCCollection& collection) { void doTestExampleMC(ExampleMCCollection const& collection) { // Empty ASSERT_CONDITION(collection[7].daughters().empty() && collection[7].parents().empty(), - "RelationRange of empty collection is not empty"); + "RelationRange of empty collection is not empty") // Equivalent but potentially quicker way of checking an empty collection ASSERT_CONDITION(collection[7].daughters().empty() && collection[7].parents().empty(), - "RelationRange of empty collection is not empty"); + "RelationRange of empty collection is not empty") // alternatively check if a loop is entered for (const auto& p [[maybe_unused]] : collection[7].daughters()) { throw std::runtime_error("Range based for loop entered on a supposedly empty range"); } - ASSERT_EQUAL(collection[0].daughters().size(), 3, "Range has wrong size"); + ASSERT_EQUAL(collection[0].daughters().size(), 3, "Range has wrong size") // check daughter relations are OK std::vector expectedPDG = {1, 5, 4}; int index = 0; for (const auto& p : collection[0].daughters()) { - ASSERT_EQUAL(p.PDG(), expectedPDG[index], "ExampleMC daughters range points to wrong particle (by PDG)"); + ASSERT_EQUAL(p.PDG(), expectedPDG[index], "ExampleMC daughters range points to wrong particle (by PDG)") index++; } @@ -83,23 +83,23 @@ void doTestExampleMC(ExampleMCCollection const& collection) { const auto daughters = collection[0].daughters(); for (size_t i = 0; i < expectedPDG.size(); ++i) { const auto daughter = daughters[i]; - ASSERT_EQUAL(daughter.PDG(), expectedPDG[i], "ExampleMC daughter points to the wrong particle (by PDG)"); + ASSERT_EQUAL(daughter.PDG(), expectedPDG[i], "ExampleMC daughter points to the wrong particle (by PDG)") } // mothers and daughters - ASSERT_EQUAL(collection[2].daughters().size(), 2, "Range has wrong size"); - ASSERT_EQUAL(collection[2].parents().size(), 2, "Range has wrong size"); + ASSERT_EQUAL(collection[2].daughters().size(), 2, "Range has wrong size") + ASSERT_EQUAL(collection[2].parents().size(), 2, "Range has wrong size") expectedPDG = {1, 9}; index = 0; for (const auto& p : collection[2].daughters()) { - ASSERT_EQUAL(p.PDG(), expectedPDG[index], "ExampleMC daughters range points to wrong particle (by PDG)"); + ASSERT_EQUAL(p.PDG(), expectedPDG[index], "ExampleMC daughters range points to wrong particle (by PDG)") index++; } expectedPDG = {8, 6}; index = 0; for (const auto& p : collection[2].parents()) { - ASSERT_EQUAL(p.PDG(), expectedPDG[index], "ExampleMC parents range points to wrong particle (by PDG)"); + ASSERT_EQUAL(p.PDG(), expectedPDG[index], "ExampleMC parents range points to wrong particle (by PDG)") index++; } @@ -107,7 +107,7 @@ void doTestExampleMC(ExampleMCCollection const& collection) { const auto parents = collection[2].parents(); for (size_t i = 0; i < expectedPDG.size(); ++i) { const auto parent = parents.at(i); - ASSERT_EQUAL(parent.PDG(), expectedPDG[i], "ExampleMC parents points to the wrong particle (by PDG)"); + ASSERT_EQUAL(parent.PDG(), expectedPDG[i], "ExampleMC parents points to the wrong particle (by PDG)") } try { @@ -115,22 +115,22 @@ void doTestExampleMC(ExampleMCCollection const& collection) { throw std::runtime_error("Trying to access out of bounds in a RelationRange::at should throw"); } catch (const std::out_of_range& err) { ASSERT_EQUAL(err.what(), std::string("index out of bounds for RelationRange"), - "Access out of bounds throws wrong exception"); + "Access out of bounds throws wrong exception") } // realistic case auto mcp6 = collection[6]; - ASSERT_EQUAL(mcp6.daughters().size(), 1, "Wrong number of daughters"); + ASSERT_EQUAL(mcp6.daughters().size(), 1, "Wrong number of daughters") auto parent = mcp6.parents(0); - ASSERT_EQUAL(parent.daughters().size(), 1, "Wrong number of daughters"); + ASSERT_EQUAL(parent.daughters().size(), 1, "Wrong number of daughters") for (const auto& p : mcp6.parents()) { // loop will only run once as per the above assertion - ASSERT_EQUAL(p, parent, "parent-daughter relation is not as expected"); + ASSERT_EQUAL(p, parent, "parent-daughter relation is not as expected") } for (const auto& p : parent.daughters()) { // loop will only run once as per the above assertion - ASSERT_EQUAL(p, mcp6, "daughter-parent relation is not as expected"); + ASSERT_EQUAL(p, mcp6, "daughter-parent relation is not as expected") } } @@ -146,12 +146,12 @@ void testExampleWithVectorMember() { ex.addcount(2); ex.addcount(10); - ASSERT_EQUAL(ex.count().size(), 3, "vector member range has wrong size"); + ASSERT_EQUAL(ex.count().size(), 3, "vector member range has wrong size") std::vector expected = {1, 2, 10}; int index = 0; for (const int c : ex.count()) { - ASSERT_EQUAL(c, expected[index], "wrong content in range-based for loop"); + ASSERT_EQUAL(c, expected[index], "wrong content in range-based for loop") index++; } } @@ -164,21 +164,21 @@ void testExampleReferencingType() { ex.addRefs(ex1); ex.addRefs(ex2); - ASSERT_EQUAL(ex.Refs().size(), 2, "Wrong number of references"); + ASSERT_EQUAL(ex.Refs().size(), 2, "Wrong number of references") int index = 0; for (const auto& e : ex.Refs()) { if (index == 0) { - ASSERT_EQUAL(e, ex1, "First element of range is not as expected"); + ASSERT_EQUAL(e, ex1, "First element of range is not as expected") } else { - ASSERT_EQUAL(e, ex2, "Second element of range is not as expected"); + ASSERT_EQUAL(e, ex2, "Second element of range is not as expected") } index++; } - ASSERT_CONDITION(!ex.Refs().empty(), "Relation range of element with relations should not be empty"); - ASSERT_CONDITION(ex1.Refs().empty(), "Relation range of element with no relations should be empty"); + ASSERT_CONDITION(!ex.Refs().empty(), "Relation range of element with relations should not be empty") + ASSERT_CONDITION(ex1.Refs().empty(), "Relation range of element with no relations should be empty") } void testWithIO() { @@ -200,8 +200,8 @@ void testWithIO() { for (int i = 0; i < 10; ++i) { const auto event = podio::Frame(reader.readNextEntry(podio::Category::Event)); auto& readColl = event.get("mcparticles"); - ASSERT_CONDITION(readColl.isValid(), "Collection 'mcparticles' should be present"); - ASSERT_EQUAL(readColl.size(), 10, "'mcparticles' should have 10 entries"); + ASSERT_CONDITION(readColl.isValid(), "Collection 'mcparticles' should be present") + ASSERT_EQUAL(readColl.size(), 10, "'mcparticles' should have 10 entries") doTestExampleMC(readColl); } diff --git a/tests/schema_evolution/read_new_data.h b/tests/schema_evolution/read_new_data.h index eddbe57d8..82a92f688 100644 --- a/tests/schema_evolution/read_new_data.h +++ b/tests/schema_evolution/read_new_data.h @@ -57,7 +57,7 @@ int readExampleWithARelation(const podio::Frame& event) { const auto& coll = event.get("floatToDoubleMemberTest"); auto elem = coll[0]; - ASSERT_EQUAL(elem.number(), static_cast(3.14), "Conversion from float to double member does not work as expected") + ASSERT_EQUAL(elem.number(), (double)3.14f, "Conversion from float to double member does not work as expected") return 0; }