// Copyright 2019 Open Source Robotics Foundation, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include #include using rosidl_generator_traits::is_message; using rosidl_generator_traits::is_service; using rosidl_generator_traits::is_action; using rosidl_generator_traits::is_action_goal; using rosidl_generator_traits::is_action_result; using rosidl_generator_traits::is_action_feedback; TEST(TestActionTraits, is_action) { using Fibonacci = test_msgs::action::Fibonacci; // Top level definition is an action EXPECT_FALSE(is_message()); EXPECT_FALSE(is_service()); EXPECT_TRUE(is_action()); EXPECT_FALSE(is_action_goal()); EXPECT_FALSE(is_action_result()); EXPECT_FALSE(is_action_feedback()); // Goal is an action_goal as well as a message EXPECT_TRUE(is_message()); EXPECT_FALSE(is_service()); EXPECT_FALSE(is_action()); EXPECT_TRUE(is_action_goal()); EXPECT_FALSE(is_action_result()); EXPECT_FALSE(is_action_feedback()); // Result is an action_result as well as a message EXPECT_TRUE(is_message()); EXPECT_FALSE(is_service()); EXPECT_FALSE(is_action()); EXPECT_FALSE(is_action_goal()); EXPECT_TRUE(is_action_result()); EXPECT_FALSE(is_action_feedback()); // Feedback is an action_feedback as well as a message EXPECT_TRUE(is_message()); EXPECT_FALSE(is_service()); EXPECT_FALSE(is_action()); EXPECT_FALSE(is_action_goal()); EXPECT_FALSE(is_action_result()); EXPECT_TRUE(is_action_feedback()); } TEST(TestActionTraits, is_action_impl) { using Fibonacci = test_msgs::action::Fibonacci; // Test traits on some of the internal implementation of actions EXPECT_FALSE(is_message()); EXPECT_TRUE(is_service()); EXPECT_FALSE(is_action()); EXPECT_FALSE(is_action_goal()); EXPECT_FALSE(is_action_result()); EXPECT_FALSE(is_action_feedback()); EXPECT_FALSE(is_message()); EXPECT_TRUE(is_service()); EXPECT_FALSE(is_action()); EXPECT_FALSE(is_action_goal()); EXPECT_FALSE(is_action_result()); EXPECT_FALSE(is_action_feedback()); EXPECT_FALSE(is_message()); EXPECT_TRUE(is_service()); EXPECT_FALSE(is_action()); EXPECT_FALSE(is_action_goal()); EXPECT_FALSE(is_action_result()); EXPECT_FALSE(is_action_feedback()); EXPECT_TRUE(is_message()); EXPECT_FALSE(is_service()); EXPECT_FALSE(is_action()); EXPECT_FALSE(is_action_goal()); EXPECT_FALSE(is_action_result()); EXPECT_FALSE(is_action_feedback()); EXPECT_TRUE(is_message()); EXPECT_FALSE(is_service()); EXPECT_FALSE(is_action()); EXPECT_FALSE(is_action_goal()); EXPECT_FALSE(is_action_result()); EXPECT_FALSE(is_action_feedback()); }