test_utils.cpp
Go to the documentation of this file.
00001 #include <kinematics_msgs/utils.h>
00002 #include <gtest/gtest.h>
00003 
00004 using namespace kinematics_msgs;
00005 
00006 TEST(TestUtils,DefaultLinks)
00007 {
00008   std::vector<std::string> collision_enable, collision_disable, default_links, result;
00009   default_links.push_back("wrist");
00010   default_links.push_back("elbow");
00011   default_links.push_back("shoulder");
00012   getCollisionLinks(default_links,collision_enable,collision_disable,result);
00013   EXPECT_TRUE((int)result.size() == 3);
00014   EXPECT_TRUE(result[0] == default_links[0]);
00015   EXPECT_TRUE(result[1] == default_links[1]);
00016   EXPECT_TRUE(result[2] == default_links[2]);
00017 }
00018 
00019 TEST(TestUtils,CollisionEnable)
00020 {
00021   std::vector<std::string> collision_enable, collision_disable, default_links, result;
00022 
00023   default_links.push_back("wrist");
00024   default_links.push_back("elbow");
00025   default_links.push_back("shoulder");
00026 
00027   collision_enable.push_back("head");
00028 
00029   getCollisionLinks(default_links,collision_enable,collision_disable,result);
00030   EXPECT_TRUE((int)result.size() == 1);
00031   EXPECT_TRUE(result[0] == collision_enable[0]);
00032 }
00033 
00034 TEST(TestUtils,CollisionDisable)
00035 {
00036   std::vector<std::string> collision_enable, collision_disable, default_links, result;
00037 
00038   default_links.push_back("wrist");
00039   default_links.push_back("elbow");
00040   default_links.push_back("shoulder");
00041 
00042   collision_disable.push_back("elbow");
00043 
00044   getCollisionLinks(default_links,collision_enable,collision_disable,result);
00045   EXPECT_TRUE((int)result.size() == 2);
00046   EXPECT_TRUE(result[0] == default_links[0] || result[0] == default_links[2]);
00047   EXPECT_TRUE(result[1] == default_links[0] || result[1] == default_links[2]);
00048 }
00049 
00050 TEST(TestUtils,CollisionEnableDisable)
00051 {
00052   std::vector<std::string> collision_enable, collision_disable, default_links, result;
00053 
00054   default_links.push_back("wrist");
00055   default_links.push_back("elbow");
00056   default_links.push_back("shoulder");
00057 
00058   collision_disable.push_back("elbow");
00059   collision_disable.push_back("foot");
00060 
00061   collision_enable.push_back("gripper");
00062   collision_enable.push_back("head");
00063   collision_enable.push_back("wrist");
00064 
00065   getCollisionLinks(default_links,collision_enable,collision_disable,result);
00066   EXPECT_TRUE((int)result.size() == 4);
00067 
00068   for(unsigned int i=0; i < result.size(); i++)
00069   {
00070     EXPECT_TRUE(result[i] == "wrist" || result[i] == "shoulder" || result[i] == "gripper" || result[i] == "head");
00071   }
00072 }
00073 
00074 
00075 int main(int argc, char **argv){
00076   testing::InitGoogleTest(&argc, argv);
00077   return RUN_ALL_TESTS();
00078 }


kinematics_msgs
Author(s): Sachin Chitta
autogenerated on Tue Jan 7 2014 11:18:50