Skip to content

Commit

Permalink
Copy tests in from 28 (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
griswaldbrooks authored Sep 19, 2023
1 parent 42c5dcc commit d8fee9d
Show file tree
Hide file tree
Showing 4 changed files with 299 additions and 103 deletions.
4 changes: 3 additions & 1 deletion functional_programming_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
find_package(ament_cmake_gmock REQUIRED)

ament_add_gtest(with_functional_programming test/with_functional_programming.cpp TIMEOUT 5)
ament_add_gmock(with_functional_programming test/with_functional_programming.cpp TIMEOUT 5)
target_compile_features(with_functional_programming PUBLIC cxx_std_20)
ament_target_dependencies(with_functional_programming rclcpp std_msgs)
target_link_libraries(with_functional_programming
pathing)

ament_add_gtest(without_functional_programming test/without_functional_programming.cpp TIMEOUT 5)
target_compile_features(without_functional_programming PUBLIC cxx_std_20)
Expand Down
4 changes: 2 additions & 2 deletions functional_programming_tests/include/pathing/pathing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace generate_path {
* @brief Types of errors expected in the generate path callback function
*/
enum class error {
NO_OCCUPANCY_MAP,
EMPTY_OCCUPANCY_MAP,
INVALID_START_SIZE,
INVALID_GOAL_SIZE,
NO_VALID_PATH
Expand All @@ -84,7 +84,7 @@ enum class error {
* @brief Descriptions of the errors
*/
std::map<error, std::string> const error_description = {
{error::NO_OCCUPANCY_MAP, "The Occupancy Map is empty."},
{error::EMPTY_OCCUPANCY_MAP, "The Occupancy Map is empty."},
{error::INVALID_START_SIZE,
"The start field in the request is not of size 2."},
{error::INVALID_GOAL_SIZE,
Expand Down
2 changes: 1 addition & 1 deletion functional_programming_tests/src/pathing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ tl::expected<example_srvs::srv::GetPath::Response, error> generate_path(
std::shared_ptr<example_srvs::srv::GetPath::Request> const request,
Map<unsigned char> const& occupancy_map, PathingGenerator path_generator) {
if (occupancy_map.get_data().size() == 0) {
return tl::unexpected(error::NO_OCCUPANCY_MAP);
return tl::unexpected(error::EMPTY_OCCUPANCY_MAP);
}
// Check to make sure start and goal fields of the request are of size 2
if (request->start.data.size() != 2) {
Expand Down
Loading

0 comments on commit d8fee9d

Please sign in to comment.