Skip to content

Commit

Permalink
Podio v0.99 breaks JFactoryPodioT::Insert()
Browse files Browse the repository at this point in the history
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
1 parent 32249d1 commit 54e1b1e
Showing 1 changed file with 2 additions and 35 deletions.
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

0 comments on commit 54e1b1e

Please sign in to comment.