Skip to content

Commit

Permalink
[jsk_recognition_utils] Test rgb_colors.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Nov 16, 2015
1 parent 392d03d commit a1e3ba1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jsk_recognition_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ add_executable(echo_tf_lookup_transform test/echo_tf_lookup_transform.cpp)

catkin_add_gtest(test_cv_utils src/tests/test_cv_utils.cpp)
target_link_libraries(test_cv_utils ${PROJECT_NAME} ${OpenCV_LIBRARIES})
catkin_add_gtest(test_rgb_colors src/tests/test_rgb_colors.cpp)
target_link_libraries(test_rgb_colors ${PROJECT_NAME} ${OpenCV_LIBRARIES})

install(TARGETS jsk_recognition_utils
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
Expand Down
23 changes: 23 additions & 0 deletions jsk_recognition_utils/src/tests/test_rgb_colors.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "jsk_recognition_utils/rgb_colors.h"
#include <opencv2/opencv.hpp>
#include <gtest/gtest.h>


TEST(RGBColors, testGetRGBColor){
cv::Vec3d color;
// red
color = jsk_recognition_utils::getRGBColor(jsk_recognition_utils::RED);
EXPECT_EQ(1, color[0]);
EXPECT_EQ(0, color[1]);
EXPECT_EQ(0, color[2]);
// gray
color = jsk_recognition_utils::getRGBColor(jsk_recognition_utils::GRAY);
EXPECT_EQ(0.502, color[0]);
EXPECT_EQ(0.502, color[1]);
EXPECT_EQ(0.502, color[2]);
}

int main(int argc, char **argv){
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

0 comments on commit a1e3ba1

Please sign in to comment.