6 #include <ram_msgs/AdditiveManufacturingTrajectory.h> 8 #include <ram_utils/GetTrajectorySize.h> 9 #include <ram_utils/GetNumberOfLayersLevels.h> 10 #include <ram_utils/GetLayerSize.h> 12 #include <gtest/gtest.h> 14 std::unique_ptr<ros::NodeHandle>
nh;
23 TEST(TestSuite, testSrvsExistence)
25 get_trajectory_size_client =
nh->serviceClient<ram_utils::GetTrajectorySize>(
"ram/information/get_trajectory_size");
27 EXPECT_TRUE(exists_1);
29 get_number_of_layers_levels_client =
nh->serviceClient<ram_utils::GetNumberOfLayersLevels>(
30 "ram/information/get_number_of_layers_levels");
32 EXPECT_TRUE(exists_2);
34 get_layer_size_client =
nh->serviceClient<ram_utils::GetLayerSize>(
"ram/information/get_layer_size");
36 EXPECT_TRUE(exists_3);
39 TEST(TestSuite, selectPosesInEmptyTrajectory)
48 ram_utils::GetTrajectorySize get_trajectory_size_srv;
49 get_trajectory_size_client.
call(get_trajectory_size_srv);
50 bool success_1 = (get_trajectory_size_srv.response.trajectory_size != 0) ?
true :
false;
51 EXPECT_FALSE(success_1);
53 ram_utils::GetNumberOfLayersLevels get_number_of_layers_srv;
54 bool success_2(get_number_of_layers_levels_client.
call(get_number_of_layers_srv));
55 EXPECT_FALSE(success_2);
57 ram_utils::GetLayerSize get_layer_size_srv;
58 bool success_3(get_layer_size_client.
call(get_layer_size_srv));
59 EXPECT_FALSE(success_3);
62 TEST(TestSuite, getTrajectorySize)
66 for (
int i(0); i < 3; ++i)
68 for (
int j(0); j <= i; ++j)
70 ram_msgs::AdditiveManufacturingPose pose;
81 ram_utils::GetTrajectorySize srv;
82 bool success(get_trajectory_size_client.
call(srv));
83 bool response = (srv.response.trajectory_size == 6) ?
true :
false;
84 EXPECT_TRUE(success && response);
87 TEST(TestSuite, numberOfLayersLevels)
89 ram_utils::GetNumberOfLayersLevels srv;
90 get_number_of_layers_levels_client.
call(srv);
91 bool success(get_number_of_layers_levels_client.
call(srv));
92 bool response = (srv.response.number_of_layers == 3) ?
true :
false;
94 EXPECT_TRUE(success && response);
99 ram_utils::GetLayerSize srv;
100 srv.request.layer_level = 2;
101 get_layer_size_client.
call(srv);
102 bool success(get_layer_size_client.
call(srv));
103 bool response = (srv.response.layer_size == 3) ?
true :
false;
105 EXPECT_TRUE(success && response);
111 ros::init(argc, argv,
"ram_utils_trajectory_info_test");
114 test_trajectory_pub =
nh->advertise<ram_msgs::AdditiveManufacturingTrajectory>(
"ram/trajectory", 10,
true);
123 testing::InitGoogleTest(&argc, argv);
124 return RUN_ALL_TESTS();
static boost::uuids::uuid fromRandom(void)
ros::Publisher test_trajectory_pub
void publish(const boost::shared_ptr< M > &message) const
ros::ServiceClient get_trajectory_size_client
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
ram_msgs::AdditiveManufacturingTrajectory trajectory
ros::ServiceClient get_number_of_layers_levels_client
int main(int argc, char **argv)
std::unique_ptr< ros::NodeHandle > nh
bool waitForExistence(ros::Duration timeout=ros::Duration(-1))
ros::ServiceClient get_layer_size_client
TEST(TestSuite, testSrvsExistence)
#define ROS_WARN_STREAM_THROTTLE(rate, args)
uint32_t getNumSubscribers() const
static uuid_msgs::UniqueID toMsg(boost::uuids::uuid const &uu)
std::string getTopic() const