3 #include <gtest/gtest.h>
9 #include <ros/duration.h>
13 class SHM :
public testing::Test
36 ros::Duration(0.01).sleep();
48 EXPECT_FALSE(ros::isShuttingDown());
49 EXPECT_FALSE(client.initialized());
50 EXPECT_FALSE(client.initialize(test_server_name, 1.));
51 EXPECT_FALSE(client.initialized());
52 EXPECT_FALSE(ros::isShuttingDown());
57 EXPECT_FALSE(ros::isShuttingDown());
59 ros::Duration(0.01).sleep();
60 EXPECT_FALSE(client.initialized());
61 EXPECT_TRUE(client.initialize(test_server_name));
62 EXPECT_TRUE(client.initialized());
63 EXPECT_FALSE(ros::isShuttingDown());
68 EXPECT_FALSE(ros::isShuttingDown());
70 ros::Duration(0.01).sleep();
71 EXPECT_FALSE(client.initialized());
72 EXPECT_TRUE(client.initialize(test_server_name));
73 EXPECT_TRUE(client.initialized());
74 EXPECT_TRUE(client.deinitialize());
75 EXPECT_FALSE(client.initialized());
76 EXPECT_FALSE(ros::isShuttingDown());
81 EXPECT_FALSE(ros::isShuttingDown());
83 ros::Duration(0.01).sleep();
85 EXPECT_TRUE(client.nextImage(image2));
86 EXPECT_EQ(image, image2);
87 EXPECT_FALSE(ros::isShuttingDown());
92 EXPECT_FALSE(ros::isShuttingDown());
94 ros::Duration(0.01).sleep();
99 EXPECT_EQ(image, *image2);
101 EXPECT_FALSE(ros::isShuttingDown());
106 EXPECT_FALSE(ros::isShuttingDown());
108 ros::Duration(0.01).sleep();
110 EXPECT_TRUE(client.nextImage(image2));
111 EXPECT_EQ(image, image2);
112 EXPECT_FALSE(ros::isShuttingDown());
113 image.setTimestamp(image.getTimestamp()+10.);
115 ros::Duration(0.01).sleep();
116 EXPECT_TRUE(client.nextImage(image2));
117 EXPECT_EQ(image, image2);
118 EXPECT_FALSE(ros::isShuttingDown());
123 EXPECT_FALSE(ros::isShuttingDown());
125 ros::Duration(0.01).sleep();
127 EXPECT_TRUE(client.nextImage(image2));
128 EXPECT_EQ(image, image2);
129 EXPECT_FALSE(ros::isShuttingDown());
130 EXPECT_FALSE(client.nextImage(image2));
131 EXPECT_FALSE(ros::isShuttingDown());
136 EXPECT_FALSE(ros::isShuttingDown());
138 ros::Duration(0.01).sleep();
143 EXPECT_EQ(image, *image2);
145 EXPECT_FALSE(ros::isShuttingDown());
146 image.setTimestamp(image.getTimestamp()+10.);
149 ros::Duration(0.01).sleep();
150 image2 = client.nextImage();
154 EXPECT_EQ(image, *image2);
156 EXPECT_FALSE(ros::isShuttingDown());
161 EXPECT_FALSE(ros::isShuttingDown());
163 ros::Duration(0.01).sleep();
168 EXPECT_EQ(image, *image2);
170 EXPECT_FALSE(ros::isShuttingDown());
172 image2 = client.nextImage();
173 EXPECT_FALSE(image2);
174 EXPECT_FALSE(ros::isShuttingDown());
178 int main(
int argc,
char **argv)
180 ros::init(argc, argv,
"shm_connection");
181 testing::InitGoogleTest(&argc, argv);
182 return RUN_ALL_TESTS();