Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:43

0001 
0002 #include "JANA/JApplicationFwd.h"
0003 #include "JANA/Services/JComponentManager.h"
0004 #include <catch.hpp>
0005 #include <JANA/Topology/JEventPool.h>
0006 
0007 namespace jana {
0008 namespace jpooltests {
0009 
0010 
0011 TEST_CASE("JPoolTests_SingleLocationLimitEvents") {
0012     JApplication app;
0013     app.Initialize();
0014     auto jcm = app.GetService<JComponentManager>();
0015 
0016     JEventPool pool(jcm, 3, 1);
0017 
0018     auto* e = pool.Pop(0);
0019     REQUIRE(e != nullptr);
0020     REQUIRE(e->GetEventNumber() == 0); // Will segfault if not initialized
0021 
0022     auto* f = pool.Pop(0);
0023     REQUIRE(f != nullptr);
0024     REQUIRE(f->GetEventNumber() == 0);
0025 
0026     auto* g = pool.Pop(0);
0027     REQUIRE(g != nullptr);
0028     REQUIRE(g->GetEventNumber() == 0);
0029 
0030     auto* h = pool.Pop(0);
0031     REQUIRE(h == nullptr);
0032 
0033     f->SetEventNumber(5);
0034     pool.Push(f, 0);
0035 
0036     h = pool.Pop(0);
0037     REQUIRE(h != nullptr);
0038     REQUIRE(h->GetEventNumber() == 5);
0039 }
0040 
0041 
0042 
0043 } // namespace jana
0044 } // namespace jpooltests
0045 
0046