Skip to content

Commit

Permalink
Remove unnecessary semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Sep 8, 2024
1 parent 1cee4b5 commit 062520d
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion include/podio/CollectionIDTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CollectionIDTable {
/// return registered names
const std::vector<std::string>& names() const {
return m_names;
};
}

/// return the ids
const std::vector<uint32_t>& ids() const {
Expand Down
2 changes: 1 addition & 1 deletion include/podio/Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion include/podio/UserDataCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion podioVersion.in.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct Version {
std::stringstream ss;
ss << *this;
return ss.str();
};
}

friend std::ostream& operator<<(std::ostream&, const Version& v);
};
Expand Down
2 changes: 1 addition & 1 deletion python/templates/Collection.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public:
);
}
m_isValid = true;
};
}

uint32_t getID() const final {
return m_collectionID;
Expand Down
6 changes: 3 additions & 3 deletions src/MurmurHash3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
72 changes: 36 additions & 36 deletions tests/read_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,59 +20,59 @@

void processExtensions(const podio::Frame& event, int iEvent, podio::version::Version) {
const auto& extColl = event.get<extension::ContainedTypeCollection>("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::ExternalComponentTypeCollection>("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::ExternalRelationTypeCollection>("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<ExampleHitCollection>("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<ExampleClusterCollection>("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<ExampleWithVectorMemberCollection>("VectorMemberSubsetColl");
const auto& origColl = event.get<ExampleWithVectorMemberCollection>("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<ExampleWithInterfaceRelationCollection>("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<ExampleHitCollection>("hits");
const auto& particles = event.get<ExampleMCCollection>("mcparticles");
Expand All @@ -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 <typename ReaderT>
Expand Down
48 changes: 24 additions & 24 deletions tests/root_io/relation_range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,77 +60,77 @@ 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<int> 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++;
}

// Check indexed access
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++;
}

// Indexed access with range check
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 {
const auto parent [[maybe_unused]] = parents.at(3);
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")
}
}

Expand All @@ -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<int> 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++;
}
}
Expand All @@ -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() {
Expand All @@ -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<ExampleMCCollection>("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);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/schema_evolution/read_new_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int readExampleWithARelation(const podio::Frame& event) {
const auto& coll = event.get<ex42::ExampleWithARelationCollection>("floatToDoubleMemberTest");
auto elem = coll[0];

ASSERT_EQUAL(elem.number(), static_cast<double>(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;
}
Expand Down

0 comments on commit 062520d

Please sign in to comment.