-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test case show-casing the failure
- Loading branch information
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef PODIO_TESTS_READ_AND_WRITE_FRAME_H // NOLINT(llvm-header-guard): folder structure not suitable | ||
#define PODIO_TESTS_READ_AND_WRITE_FRAME_H // NOLINT(llvm-header-guard): folder structure not suitable | ||
|
||
#include "read_frame.h" | ||
|
||
#include <string> | ||
|
||
template <typename ReaderT, typename WriterT> | ||
int rewrite_frames(const std::string& inputFile, const std::string& newOutput) { | ||
auto reader = ReaderT(); | ||
reader.openFile(inputFile); | ||
|
||
auto writer = WriterT(newOutput); | ||
|
||
const auto frame = podio::Frame(reader.readEntry(podio::Category::Event, 0)); | ||
writer.writeFrame(frame, podio::Category::Event); | ||
|
||
const auto otherFrame = podio::Frame(reader.readEntry("other_events", 0)); | ||
writer.writeFrame(otherFrame, "other_events"); | ||
|
||
return 0; | ||
} | ||
|
||
template <typename ReaderT> | ||
int read_rewritten_frames(const std::string& inputName) { | ||
auto reader = ReaderT(); | ||
reader.openFile(inputName); | ||
|
||
const auto frame = podio::Frame(reader.readEntry(podio::Category::Event, 0)); | ||
|
||
processEvent(frame, 0, reader.currentFileVersion()); | ||
|
||
return 0; | ||
} | ||
|
||
#endif // PODIO_TESTS_READ_AND_WRITE_FRAME_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "read_and_write_frame.h" | ||
|
||
#include "podio/ROOTFrameReader.h" | ||
#include "podio/ROOTFrameWriter.h" | ||
|
||
int main() { | ||
return rewrite_frames<podio::ROOTFrameReader, podio::ROOTFrameWriter>("example_frame.root", "rewritten_frame.root") + | ||
read_rewritten_frames<podio::ROOTFrameReader>("rewritten_frame.root"); | ||
} |