14#include <fairmq/TransportFactory.h>
16#include <catch_amalgamated.hpp>
23 std::string m_expected;
24 mutable std::string m_actual;
31 m_actual = std::string(e.what);
32 return std::string(e.what) == m_expected;
36 std::ostringstream ss;
37 ss <<
" special exception has value of " << m_expected <<
" but got " << m_actual;
45 const char* testname =
"testname";
46 const char* testtitle =
"testtitle";
51 array.Add(
new TNamed(testname, testtitle));
53 auto transport = fair::mq::TransportFactory::CreateTransportFactory(
"zeromq");
54 auto msg = transport->CreateMessage(4096);
62 auto* outarr =
dynamic_cast<TObjArray*
>(out.get());
63 REQUIRE(out.get() == outarr);
64 auto* named =
dynamic_cast<TNamed*
>(outarr->At(0));
65 REQUIRE(
static_cast<void*
>(named) ==
static_cast<void*
>(outarr->At(0)));
66 REQUIRE(named->GetName() == std::string(testname));
67 REQUIRE(named->GetTitle() == std::string(testtitle));
73 ExceptionMatcher(
"can not convert serialized class TObjArray into target class TNamed"));
79 std::string
expected(
"can not convert serialized class vector<o2::test::Polymorphic> into target class TObject");
86 std::vector<o2::test::Polymorphic>
data{{0xaffe}, {0xd00f}};
88 TClass* cl = TClass::GetClass(
"std::vector<o2::test::Polymorphic>");
89 REQUIRE(cl !=
nullptr);
91 auto transport = fair::mq::TransportFactory::CreateTransportFactory(
"zeromq");
92 auto msg = transport->CreateMessage(4096);
94 char* in =
reinterpret_cast<char*
>(&
data);
98 auto out = TMessageSerializer::deserialize<std::vector<o2::test::Polymorphic>>(msg2);
100 REQUIRE((*out.get()).size() == 2);
110 const char*
buffer =
"this is for sure not a serialized ROOT object";
111 auto transport = fair::mq::TransportFactory::CreateTransportFactory(
"zeromq");
112 auto msg = transport->CreateMessage(strlen(
buffer) + 8);
128 auto matcher =
ExceptionMatcher(
"class is not ROOT-serializable: ZL22CATCH2_INTERNAL_TEST_4vE5Dummy");
135 const char*
buffer =
"this is for sure not a serialized ROOT object";
136 auto transport = fair::mq::TransportFactory::CreateTransportFactory(
"zeromq");
137 auto msg = transport->CreateMessage(strlen(
buffer) + 8);
140 REQUIRE(msg2.Buffer() == (
char*)
msg->GetData() + 8);
142 REQUIRE(*(fair::mq::Message**)
msg->GetData() ==
msg.get());
145 REQUIRE(msg2.BufferSize() == (
msg->GetSize() - 16));
uint64_t exp(uint64_t base, uint8_t exp) noexcept
ExceptionMatcher(std::string exp)
bool match(RuntimeErrorRef const &ref) const override
std::string describe() const override
Defining PrimaryVertex explicitly as messageable.
TEST_CASE("test_prepareArguments")
void clean_all_runtime_errors()
RuntimeError & error_from_ref(RuntimeErrorRef)
Defining DataPointCompositeObject explicitly as copiable.
static void serialize(o2::framework::FairOutputTBuffer &msg, const TObject *input)
static std::unique_ptr< T > deserialize(FairInputTBuffer &buffer)
std::map< std::string, ID > expected
bool check_expected(RuntimeErrorRef const &ref)
uint64_t const void const *restrict const msg