File indexing completed on 2024-04-06 12:30:16
0001 #include "SimG4Core/Application/interface/ThreadHandoff.h"
0002 #include "FWCore/Utilities/interface/Exception.h"
0003 #define CATCH_CONFIG_MAIN
0004 #include "catch.hpp"
0005
0006 using namespace omt;
0007 TEST_CASE("Test omt::ThreadHandoff", "[ThreadHandoff]") {
0008 SECTION("Do nothing") { ThreadHandoff th; }
0009 SECTION("Simple") {
0010 ThreadHandoff th;
0011 bool value = false;
0012 th.runAndWait([&value]() { value = true; });
0013 REQUIRE(value == true);
0014 }
0015
0016 SECTION("Exception") {
0017 ThreadHandoff th;
0018 REQUIRE_THROWS_AS(th.runAndWait([]() { throw cms::Exception("Test"); }), cms::Exception);
0019 }
0020 }