1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
From: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date: Tue, 26 Jul 2016 17:35:53 +0200
Subject: Fix unit tests
Different to OSRF we have catkin, cmake_modules and roslang installed in
our ROS workspace.
---
test/test/utest.cpp | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/test/test/utest.cpp b/test/test/utest.cpp
index b81fc10..2ecfea4 100644
--- a/test/test/utest.cpp
+++ b/test/test/utest.cpp
@@ -72,13 +72,13 @@ TEST(rospack, reentrant)
output = rp.getOutput();
boost::trim(output);
boost::split(output_list, output, boost::is_any_of("\n"));
- ASSERT_EQ((int)output_list.size(), 4);
+ ASSERT_EQ((int)output_list.size(), 6);
ret = rp.run(std::string("list"));
ASSERT_EQ(ret, 0);
output = rp.getOutput();
boost::trim(output);
boost::split(output_list, output, boost::is_any_of("\n"));
- ASSERT_EQ((int)output_list.size(), 4);
+ ASSERT_EQ((int)output_list.size(), 6);
std::vector<std::string> path_name;
boost::split(path_name, output_list[0], boost::is_any_of(" "));
ASSERT_EQ((int)path_name.size(), 2);
@@ -98,13 +98,13 @@ TEST(rospack, multiple_rospack_objects)
output = rp.getOutput();
boost::trim(output);
boost::split(output_list, output, boost::is_any_of("\n"));
- ASSERT_EQ((int)output_list.size(), 4);
+ ASSERT_EQ((int)output_list.size(), 6);
ret = rp.run(std::string("list"));
ASSERT_EQ(ret, 0);
output = rp.getOutput();
boost::trim(output);
boost::split(output_list, output, boost::is_any_of("\n"));
- ASSERT_EQ((int)output_list.size(), 4);
+ ASSERT_EQ((int)output_list.size(), 6);
std::vector<std::string> path_name;
boost::split(path_name, output_list[0], boost::is_any_of(" "));
ASSERT_EQ((int)path_name.size(), 2);
@@ -120,13 +120,13 @@ TEST(rospack, multiple_rospack_objects)
output = rp2.getOutput();
boost::trim(output);
boost::split(output_list, output, boost::is_any_of("\n"));
- ASSERT_EQ((int)output_list.size(), 4);
+ ASSERT_EQ((int)output_list.size(), 6);
ret = rp2.run(std::string("list"));
ASSERT_EQ(ret, 0);
output = rp2.getOutput();
boost::trim(output);
boost::split(output_list, output, boost::is_any_of("\n"));
- ASSERT_EQ((int)output_list.size(), 4);
+ ASSERT_EQ((int)output_list.size(), 6);
path_name.clear();
boost::split(path_name, output_list[0], boost::is_any_of(" "));
ASSERT_EQ((int)path_name.size(), 2);
@@ -153,6 +153,8 @@ TEST(rospack, env_change)
std::string rr = std::string(getcwd(buf, sizeof(buf))) + "/test2";
setenv("ROS_PACKAGE_PATH", rr.c_str(), 1);
std::vector<std::string> test_pkgs;
+ test_pkgs.push_back("catkin");
+ test_pkgs.push_back("cmake_modules");
test_pkgs.push_back("precedence1");
test_pkgs.push_back("precedence2");
test_pkgs.push_back("precedence3");
@@ -189,9 +191,12 @@ TEST(rospack, env_change)
rr = std::string(getcwd(buf, sizeof(buf))) + "/test3";
setenv("ROS_PACKAGE_PATH", rr.c_str(), 1);
test_pkgs.clear();
+ test_pkgs.push_back("catkin");
+ test_pkgs.push_back("cmake_modules");
test_pkgs.push_back("precedence1");
test_pkgs.push_back("precedence2");
test_pkgs.push_back("precedence3");
+ test_pkgs.push_back("roslang");
ret = rp.run(std::string("list-names"));
EXPECT_EQ(ret, 0);
output_list.clear();
@@ -226,7 +231,7 @@ TEST(rospack, env_change)
EXPECT_EQ(ret, 0);
output = rp.getOutput();
boost::trim(output);
- EXPECT_EQ(output, std::string());
+ EXPECT_EQ(output, "catkin\ncmake_modules\nroslang");
// Reset old path, for other tests
setenv("ROS_PACKAGE_PATH", oldrpp, 1);
|