Skip to content

Commit

Permalink
Migrate final test case
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwbrei committed Apr 28, 2024
1 parent 66cc351 commit f6f03ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/libraries/JANA/JEventSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ class JEventSource : public jana::omni::JComponent, public jana::omni::JHasOutpu
event->GetJCallGraphRecorder()->SetInsertDataOrigin( previous_origin );

if (result == Result::Success) {
m_event_count += 1;
// We end up here if we read an entry in our file or retrieved a message from our socket,
// and believe we could obtain another one immediately if we wanted to
for (auto* output : m_outputs) {
output->InsertCollection(*event);
}
m_event_count += 1;
if (m_event_count < first_evt_nr) {
if (m_event_count <= first_evt_nr) {
// We immediately throw away this whole event because of nskip
// (although really we should be handling this with Seek())
return Result::FailureTryAgain;
Expand Down
9 changes: 7 additions & 2 deletions src/programs/unit_tests/NEventNSkipTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ struct NEventNSkipBoundedSource : public JEventSource {
std::atomic_int open_count{0};
std::atomic_int close_count{0};

void GetEvent(std::shared_ptr<JEvent>) override {
NEventNSkipBoundedSource() {
SetCallbackStyle(CallbackStyle::ExpertMode);
}

Result Emit(JEvent&) override {
if (event_count >= event_bound) {
throw JEventSource::RETURN_STATUS::kNO_MORE_EVENTS;
return Result::FailureFinished;
}
event_count += 1;
events_emitted.push_back(event_count);
return Result::Success;
}

void Open() override {
Expand Down

0 comments on commit f6f03ca

Please sign in to comment.