-
Notifications
You must be signed in to change notification settings - Fork 522
Increasing test coverage of rclcpp_action #1043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
af0c99e
Increasing test coverage of rclcpp_action
brawner d8007e1
PR Fixup
brawner f22e870
PR Fixup
brawner 1550fae
PR Fixup
brawner 462b899
Increasing test coverage of rclcpp_action
brawner 0ce9da0
PR Fixup
brawner 61aea1a
PR Fixup
brawner 4d6c039
PR Fixup
brawner 8aae005
Merge branch 'tests_rclcpp_action' of github.com:brawner/rclcpp into …
brawner 5f9c5cb
Fix warnings
brawner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // Copyright 2020 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. | ||
|
|
||
brawner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| #include <gtest/gtest.h> | ||
|
|
||
| #include <limits> | ||
| #include "rclcpp_action/types.hpp" | ||
|
|
||
| TEST(TestActionTypes, goal_uuid_to_string) { | ||
| rclcpp_action::GoalUUID goal_id; | ||
| 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 (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 (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 (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 (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 (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 (uint8_t i = 0; i < UUID_SIZE; ++i) { | ||
| EXPECT_EQ(goal_info.goal_id.uuid[i], goal_id[i]); | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.