Line data Source code
1 : /**
2 : * @file TriggerInhibit_test.cxx TriggerInhibit 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/TriggerInhibit.hpp"
10 :
11 : /**
12 : * @brief Name of this test module
13 : */
14 : #define BOOST_TEST_MODULE TriggerInhibit_test // NOLINT
15 :
16 : #include "TRACE/trace.h"
17 : #include "boost/test/unit_test.hpp"
18 :
19 : #include <string>
20 : #include <vector>
21 :
22 : using namespace dunedaq::dfmessages;
23 :
24 : BOOST_AUTO_TEST_SUITE(TriggerInhibit_test)
25 :
26 : /**
27 : * @brief Check that TriggerInhibits have appropriate Copy/Move semantics
28 : */
29 2 : BOOST_AUTO_TEST_CASE(CopyAndMoveSemantics)
30 : {
31 1 : BOOST_REQUIRE(std::is_copy_constructible_v<TriggerInhibit>);
32 1 : BOOST_REQUIRE(std::is_copy_assignable_v<TriggerInhibit>);
33 1 : BOOST_REQUIRE(std::is_move_constructible_v<TriggerInhibit>);
34 1 : BOOST_REQUIRE(std::is_move_assignable_v<TriggerInhibit>);
35 1 : }
36 :
37 2 : BOOST_AUTO_TEST_CASE(SerDes_MsgPack)
38 : {
39 :
40 1 : TriggerInhibit ti;
41 1 : ti.busy = true;
42 :
43 1 : auto bytes = dunedaq::serialization::serialize(ti, dunedaq::serialization::kMsgPack);
44 3 : TLOG(TLVL_INFO) << "MsgPack message size: " << bytes.size() << " bytes";
45 1 : TriggerInhibit ti_deserialized = dunedaq::serialization::deserialize<TriggerInhibit>(bytes);
46 :
47 1 : BOOST_REQUIRE_EQUAL(ti.busy, ti_deserialized.busy);
48 1 : }
49 :
50 : BOOST_AUTO_TEST_SUITE_END()
|