Skip to content

Commit

Permalink
PR Fixup
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Brawner <brawner@gmail.com>
  • Loading branch information
brawner committed Apr 22, 2020
1 parent e823c67 commit d3ac7f3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions rclcpp_action/test/test_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,50 @@
// See the License for the specific language governing permissions and
// limitations under the License.


#include <gtest/gtest.h>

#include <limits>
#include "rclcpp_action/types.hpp"

TEST(TestActionTypes, goal_uuid_to_string) {
rclcpp_action::GoalUUID goal_id;
for (size_t i = 0; i < UUID_SIZE; ++i) {
for (uint8_t i = 0; i < UUID_SIZE; ++i) {
goal_id[i] = i;
}
EXPECT_STREQ("0123456789abcdef", rclcpp_action::to_string(goal_id).c_str());

for (size_t i = 0; i < UUID_SIZE; ++i) {
for (uint8_t i = 0; i < UUID_SIZE; ++i) {
goal_id[i] = 16u + i;
}
EXPECT_STREQ("101112131415161718191a1b1c1d1e1f", rclcpp_action::to_string(goal_id).c_str());

for (size_t i = 0; i < UUID_SIZE; ++i) {
for (uint8_t i = 0; i < UUID_SIZE; ++i) {
goal_id[i] = std::numeric_limits<uint8_t>::max() - i;
}
EXPECT_STREQ("fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0", rclcpp_action::to_string(goal_id).c_str());
}

TEST(TestActionTypes, goal_uuid_to_rcl_action_goal_info) {
rclcpp_action::GoalUUID goal_id;
for (size_t i = 0; i < UUID_SIZE; ++i) {
for (uint8_t i = 0; i < UUID_SIZE; ++i) {
goal_id[i] = i;
}
rcl_action_goal_info_t goal_info = rcl_action_get_zero_initialized_goal_info();
rclcpp_action::convert(goal_id, &goal_info);
for (size_t i = 0; i < UUID_SIZE; ++i) {
for (uint8_t i = 0; i < UUID_SIZE; ++i) {
EXPECT_EQ(goal_info.goal_id.uuid[i], goal_id[i]);
}
}

TEST(TestActionTypes, rcl_action_goal_info_to_goal_uuid) {
rcl_action_goal_info_t goal_info = rcl_action_get_zero_initialized_goal_info();
for (size_t i = 0; i < UUID_SIZE; ++i) {
for (uint8_t i = 0; i < UUID_SIZE; ++i) {
goal_info.goal_id.uuid[i] = i;
}

rclcpp_action::GoalUUID goal_id;
rclcpp_action::convert(goal_id, &goal_info);
for (size_t i = 0; i < UUID_SIZE; ++i) {
for (uint8_t i = 0; i < UUID_SIZE; ++i) {
EXPECT_EQ(goal_info.goal_id.uuid[i], goal_id[i]);
}
}

0 comments on commit d3ac7f3

Please sign in to comment.