Skip to content

Commit

Permalink
Fix and actually run I/O tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Dec 5, 2023
1 parent e195928 commit 52c969d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions tests/read_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ void checkVecMemSubsetColl(const podio::Frame& event) {
ASSERT(subsetColl[0] == origColl[0], "subset coll does not have the right contents");
}

void checkComponentUserDataColl(const podio::Frame& event) {
void checkComponentUserDataColl(const podio::Frame& event, int i) {
const auto& coll = event.get<podio::UserDataCollection<ex2::NamespaceStruct>>("componentUserData");
ASSERT(coll.isValid(), "componentUserData should be present");
ASSERT(coll.size() == 2, "componentUserData should have two elements");
ASSERT(coll[1].x == 42 && coll[1].y == 123, "componentUserData contents are not as expected");
ASSERT(coll[1].x == 42 && coll[1].y == i, "componentUserData contents are not as expected");
}

template <typename ReaderT>
Expand Down Expand Up @@ -134,6 +134,9 @@ int read_frames(const std::string& filename, bool assertBuildVersion = true) {
if (reader.currentFileVersion() >= podio::version::Version{0, 16, 99}) {
checkVecMemSubsetColl(otherFrame);
}
if (reader.currentFileVersion() >= podio::version::Version{0, 17, 99}) {
checkComponentUserDataColl(otherFrame, i + 100);
}
}

if (reader.readNextEntry(podio::Category::Event)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/write_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ auto createComponentUserDataCollection(int i) {

auto val = ex2::NamespaceStruct{};
val.x = 42;
val.y = 123;
val.y = i;
coll.push_back(val);

return coll;
Expand Down

0 comments on commit 52c969d

Please sign in to comment.