registry.cpp
Go to the documentation of this file.
1 
6 /*****************************************************************************
7 ** Includes
8 *****************************************************************************/
9 
10 #include <gtest/gtest.h>
11 #include <iostream>
12 #include <mm_messages/registry.hpp>
13 
14 /*****************************************************************************
15  ** Namespace
16  *****************************************************************************/
17 
18 using namespace mm_messages;
19 
20 /*****************************************************************************
21 ** Registrations
22 *****************************************************************************/
23 
24 enum {
25  Description = 9990,
28  Reserved = 9993
29 };
30 
31 MM_REGISTER_PACKET_INFO(Description, std::string, "Description of the current state of the system.");
32 MM_REGISTER_PACKET_INFO(UnMatchedBeanCount, int, "Number of beans that went unmatched");
33 //MM_REGISTER_PACKET_INFO(1, int); // creates a compile time error
34 
35 /*****************************************************************************
36 ** Tests
37 *****************************************************************************/
38 
39 TEST(MessageMuxDemux,registryAdd) {
40  int result = MessageRegistry::add<MatchedBeanCount, int>("unused_description");
41  EXPECT_TRUE(result);
42  result = MessageRegistry::add<UnMatchedBeanCount, unsigned int>();
43  EXPECT_FALSE(result);
44  result = MessageRegistry::add<UnMatchedBeanCount, std::string>();
45  EXPECT_FALSE(result);
46 }
47 
48 TEST(MessageMuxDemux,isRegistered) {
51 }
52 
53 TEST(MessageMuxDemux,isRegisteredWithType) {
54  EXPECT_TRUE(MessageRegistry::isRegisteredWithType<int>(UnMatchedBeanCount));
55  EXPECT_FALSE(MessageRegistry::isRegisteredWithType<std::string>(UnMatchedBeanCount));
56 }
57 
58 int main(int argc, char **argv)
59 {
60  testing::InitGoogleTest(&argc,argv);
61  return RUN_ALL_TESTS();
62 }
MM_REGISTER_PACKET_INFO(Description, std::string,"Description of the current state of the system.")
static bool isRegistered(const int &id)
TEST(MessageMuxDemux, registryAdd)
Definition: registry.cpp:39
int main(int argc, char **argv)
Definition: registry.cpp:58


mm_mux_demux
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:52:14