subscriber_test.cpp
Go to the documentation of this file.
2 #include <gtest/gtest.h>
3 
4 
6 unsigned char buffer[1];
7 
8 class DummyMsg
9 {
10 public:
11  int serialize(unsigned char *outbuffer) const
12  {
13  return 0;
14  }
15  int deserialize(unsigned char *inbuffer)
16  {
17  return 0;
18  }
19  const char * getType()
20  {
21  return "";
22  }
23  const char * getMD5()
24  {
25  return "";
26  }
27 };
28 
30 {
31 public:
32  static void staticCallback(const DummyMsg& msg)
33  {
34  callbackCalled = true;
35  }
36  void memberCallback(const DummyMsg& msg)
37  {
38  callbackCalled = true;
39  }
40 };
41 
42 
43 TEST(TestSubscriber, testStaticCallback)
44 {
46 
47  callbackCalled = false;
48  sub.callback(buffer);
49  ASSERT_TRUE(callbackCalled);
50 }
51 
52 TEST(TestSubscriber, testMemberCallback)
53 {
54  DummyClass cl;
56 
57  callbackCalled = false;
58  sub.callback(buffer);
59  ASSERT_TRUE(callbackCalled);
60 }
61 
62 
63 int main(int argc, char **argv)
64 {
65  testing::InitGoogleTest(&argc, argv);
66  return RUN_ALL_TESTS();
67 }
int serialize(unsigned char *outbuffer) const
const char * getType()
int deserialize(unsigned char *inbuffer)
TEST(TestSubscriber, testStaticCallback)
int main(int argc, char **argv)
unsigned char buffer[1]
bool callbackCalled
void memberCallback(const DummyMsg &msg)
static void staticCallback(const DummyMsg &msg)
const char * getMD5()


rosserial_client
Author(s): Michael Ferguson, Adam Stambler
autogenerated on Mon Jun 10 2019 14:53:19