40 #include <gtest/gtest.h> 62 ASSERT_STREQ(node_name.c_str(),
"/name_remapped");
69 ASSERT_STREQ(
ros::names::clean(
"////asdf///jioweioj/").c_str(),
"/asdf/jioweioj");
72 TEST(RoscppHandles, nodeHandleNameRemapping)
76 remap[
"/a/a"] =
"/a/b";
78 remap[
"d/d"] =
"/c/e";
83 EXPECT_STREQ(n.
resolveName(
"/a/a").c_str(),
"/a/b");
88 EXPECT_STREQ(n2.resolveName(
"a").c_str(),
"/z/b");
89 EXPECT_STREQ(n2.resolveName(
"/a/a").c_str(),
"/a/b");
90 EXPECT_STREQ(n2.resolveName(
"c").c_str(),
"/a/c");
91 EXPECT_STREQ(n2.resolveName(
"d/d").c_str(),
"/c/e");
92 EXPECT_STREQ(n2.resolveName(
"d/e").c_str(),
"/z/c/f");
96 main(
int argc,
char** argv)
98 testing::InitGoogleTest(&argc, argv);
99 ros::init( argc, argv,
"name_remapping" );
102 return RUN_ALL_TESTS();
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val)
std::string resolveName(const std::string &name, bool remap=true) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL const std::string & getName()
int main(int argc, char **argv)
ROSCPP_DECL std::string resolve(const std::string &name, bool remap=true)
ROSCPP_DECL std::string clean(const std::string &name)
std::map< std::string, std::string > M_string
ROSCPP_DECL std::string remap(const std::string &name)
ROSCPP_DECL bool get(const std::string &key, std::string &s)
TEST(roscpp, parameterRemapping)