Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI coverage #300

Merged
merged 15 commits into from
May 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Podio v0.99 breaks JFactoryPodioT::Insert()
Luckily, this ended up being a feature that we didn't need, and I won't particularly miss. It is another small push towards getting rid of JFactoryPodioT completely...
  • Loading branch information
nathanwbrei committed May 2, 2024
commit 54e1b1ef07cc0ab6cb552bee32c5b433ee6b7280
37 changes: 2 additions & 35 deletions src/programs/unit_tests/Components/PodioTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ struct TestFac : public JFactoryPodioT<ExampleCluster> {
}
void Process(const std::shared_ptr<const JEvent>&) override {
ExampleClusterCollection c;
c.push_back(ExampleCluster(16.0));
c.push_back(MutableExampleCluster(16.0));
SetCollection(std::move(c));
}
};
Expand All @@ -181,38 +181,5 @@ TEST_CASE("JFactoryPodioT::Init gets called") {
REQUIRE(fac != nullptr);
REQUIRE(fac->init_called == true);
}

namespace jana2_tests_podiotests_insert {

struct TestFac : public JFactoryPodioT<ExampleCluster> {
TestFac() {
SetTag("clusters");
}
void Process(const std::shared_ptr<const JEvent>&) override {
Insert(new MutableExampleCluster(16.0));
}
};
}

TEST_CASE("JFactoryPodioT::Insert() and retrieval") {

JApplication app;
auto event = std::make_shared<JEvent>(&app);
auto fs = new JFactorySet;
fs->Add(new jana2_tests_podiotests_insert::TestFac);
event->SetFactorySet(fs);
event->GetFactorySet()->Release(); // Simulate a trip to the JEventPool

// Retrieve as vector<ExampleCluster*> (Goes through mData)
auto vcp = event->Get<ExampleCluster>("clusters");
REQUIRE(vcp.size() == 1);
REQUIRE(vcp[0]->energy() == 16.0);

// Retrieve as ExampleClusterCollection (Goes through Frame)
auto r = event->GetCollection<ExampleCluster>("clusters");
REQUIRE(r != nullptr);
REQUIRE(r->size() == 1);
REQUIRE((*r)[0].energy() == 16.0);
}

} // namespace podiotests

Loading