Line data Source code
1 : /**
2 : * @file ComponentRequest_serialization_test.cxx ComponentRequest class Unit Tests
3 : *
4 : * This is part of the DUNE DAQ Application Framework, copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 :
9 : #include "dfmessages/ComponentRequest_serialization.hpp"
10 :
11 : /**
12 : * @brief Name of this test module
13 : */
14 : #define BOOST_TEST_MODULE ComponentRequest_serialization_test // NOLINT
15 :
16 : #include "boost/test/unit_test.hpp"
17 :
18 : #include <string>
19 : #include <utility>
20 : #include <vector>
21 :
22 : using namespace dunedaq::daqdataformats;
23 :
24 : BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
25 :
26 2 : BOOST_AUTO_TEST_CASE(SerDes_MsgPack)
27 : {
28 1 : ComponentRequest component_request;
29 1 : component_request.component = SourceID{ SourceID::Subsystem::kDetectorReadout, 1 };
30 1 : component_request.window_begin = 12345;
31 1 : component_request.window_end = 45678;
32 1 : auto bytes = dunedaq::serialization::serialize(component_request, dunedaq::serialization::kMsgPack);
33 :
34 1 : ComponentRequest cr_deserialized = dunedaq::serialization::deserialize<ComponentRequest>(bytes);
35 :
36 1 : BOOST_REQUIRE_EQUAL(component_request.window_begin, cr_deserialized.window_begin);
37 1 : BOOST_REQUIRE_EQUAL(component_request.window_end, cr_deserialized.window_end);
38 1 : BOOST_REQUIRE_EQUAL(component_request.component.subsystem, cr_deserialized.component.subsystem);
39 1 : BOOST_REQUIRE_EQUAL(component_request.component.id, cr_deserialized.component.id);
40 1 : }
41 :
42 : BOOST_AUTO_TEST_SUITE_END()
|