Go to the documentation of this file.00001
00006
00007
00008
00009
00010 #include <gtest/gtest.h>
00011 #include <iostream>
00012 #include <mm_messages/registry.hpp>
00013
00014
00015
00016
00017
00018 using namespace mm_messages;
00019
00020
00021
00022
00023
00024 enum {
00025 Description = 9990,
00026 UnMatchedBeanCount = 9991,
00027 MatchedBeanCount = 9992,
00028 Reserved = 9993
00029 };
00030
00031 MM_REGISTER_PACKET_INFO(Description, std::string, "Description of the current state of the system.");
00032 MM_REGISTER_PACKET_INFO(UnMatchedBeanCount, int, "Number of beans that went unmatched");
00033
00034
00035
00036
00037
00038
00039 TEST(MessageMuxDemux,registryAdd) {
00040 int result = MessageRegistry::add<MatchedBeanCount, int>("unused_description");
00041 EXPECT_TRUE(result);
00042 result = MessageRegistry::add<UnMatchedBeanCount, unsigned int>();
00043 EXPECT_FALSE(result);
00044 result = MessageRegistry::add<UnMatchedBeanCount, std::string>();
00045 EXPECT_FALSE(result);
00046 }
00047
00048 TEST(MessageMuxDemux,isRegistered) {
00049 EXPECT_TRUE(MessageRegistry::isRegistered(UnMatchedBeanCount));
00050 EXPECT_FALSE(MessageRegistry::isRegistered(Reserved));
00051 }
00052
00053 TEST(MessageMuxDemux,isRegisteredWithType) {
00054 EXPECT_TRUE(MessageRegistry::isRegisteredWithType<int>(UnMatchedBeanCount));
00055 EXPECT_FALSE(MessageRegistry::isRegisteredWithType<std::string>(UnMatchedBeanCount));
00056 }
00057
00058 int main(int argc, char **argv)
00059 {
00060 testing::InitGoogleTest(&argc,argv);
00061 return RUN_ALL_TESTS();
00062 }