Skip to content

Commit

Permalink
Fix MultiLevelTopologyTests
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwbrei committed Aug 19, 2024
1 parent c6d03a1 commit c53705a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
15 changes: 12 additions & 3 deletions src/programs/unit_tests/Topology/MultiLevelTopologyTests.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#include <catch.hpp>
#include "MultiLevelTopologyTests.h"
#include "JANA/JException.h"

#include <iostream>
#include <map>
#include "MultiLevelTopologyTests.h"

namespace jana {
namespace timeslice_tests {

enum class Level { None, Timeslice, Event, Subevent };
enum class ComponentType { None, Source, Filter, Map, Split, Merge, Reduce };
Expand Down Expand Up @@ -442,7 +445,13 @@ TEST_CASE("TimeslicesTests") {
app.Add(new JFactoryGeneratorT<MyProtoClusterFactory>);
app.Add(new JFactoryGeneratorT<MyClusterFactory>);
app.SetTicker(true);
app.Run();
try {
app.Run();
}
catch (JException& e) {
std::cout << e << std::endl;
throw e;
}
}


Expand Down
10 changes: 7 additions & 3 deletions src/programs/unit_tests/Topology/MultiLevelTopologyTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <JANA/JEventSource.h>
#include <JANA/JEventUnfolder.h>
#include <JANA/JEventProcessor.h>
#include <catch.hpp>

namespace jana {
namespace timeslice_tests {
Expand Down Expand Up @@ -94,9 +95,9 @@ struct MyEventProcessor : public JEventProcessor {

void Process(const JEvent& event) override {
process_called_count++;
// TODO: Trigger cluster factory
// TODO: Validate that the clusters make sense
jout << "MyEventProcessor: Processing " << event.GetEventNumber() << jendl;
auto clusters = event.Get<MyCluster>("evt");
// TODO: Validate that the clusters make sense
REQUIRE(init_called_count == 1);
REQUIRE(finish_called_count == 0);
}
Expand All @@ -116,6 +117,7 @@ struct MyProtoClusterFactory : public JFactoryT<MyCluster> {

MyProtoClusterFactory() {
SetLevel(JEventLevel::Timeslice);
SetTag("ts");
}

void Init() override {
Expand All @@ -142,6 +144,7 @@ struct MyClusterFactory : public JFactoryT<MyCluster> {

MyClusterFactory() {
SetLevel(JEventLevel::PhysicsEvent);
SetTag("evt");
}

void Init() override {
Expand All @@ -159,4 +162,5 @@ struct MyClusterFactory : public JFactoryT<MyCluster> {
}
};


} // namespace timeslice_tests
} // namespace jana

0 comments on commit c53705a

Please sign in to comment.