test_remap.cpp
Go to the documentation of this file.
1 // Test <remap> tags
2 // Author: Max Schwarz <max.schwarz@ais.uni-bonn.de>
3 
4 #include <catch_ros/catch.hpp>
5 
6 #include "../../src/launch/launch_config.h"
7 
8 #include "node_utils.h"
9 
10 using namespace rosmon::launch;
11 
12 TEST_CASE("remap", "[remap]")
13 {
14  LaunchConfig config;
15  config.parseString(R"EOF(
16  <launch rosmon-name="rosmon_uut">
17  <remap from="topic_a" to="topic_b" />
18 
19  <node name="test" pkg="rosmon_core" type="abort">
20  <remap from="~local_a" to="/global_a" />
21  <remap from="local_b" to="/global_b" />
22  </node>
23 
24  <remap from="topic_c" to="topic_d" />
25  </launch>
26  )EOF");
27 
28  auto node = getNode(config.nodes(), "test");
29 
30  CAPTURE(printMapping(node->remappings()));
31 
32  auto maps = node->remappings();
33 
34  CHECK(maps.at("topic_a") == "topic_b");
35  CHECK(maps.at("~local_a") == "/global_a");
36  CHECK(maps.at("local_b") == "/global_b");
37 
38  CHECK(maps.find("topic_c") == maps.end());
39 }
40 
41 TEST_CASE("remap scoped", "[remap]")
42 {
43  LaunchConfig config;
44  config.parseString(R"EOF(
45  <launch rosmon-name="rosmon_uut">
46  <group ns="namespace">
47  <remap from="topic_a" to="topic_b" />
48  </group>
49 
50  <node name="test" pkg="rosmon_core" type="abort">
51  </node>
52  </launch>
53  )EOF");
54 
55  auto node = getNode(config.nodes(), "test");
56 
57  CAPTURE(printMapping(node->remappings()));
58 
59  auto maps = node->remappings();
60 
61  CHECK(maps.find("topic_a") == maps.end());
62 }
const std::vector< Node::Ptr > & nodes() const
rosmon::launch::Node::Ptr getNode(const std::vector< rosmon::launch::Node::Ptr > &nodes, const std::string &name, const std::string &namespaceString)
Definition: node_utils.cpp:23
void parseString(const std::string &input, bool onlyArguments=false)
TEST_CASE("remap","[remap]")
Definition: test_remap.cpp:12
std::string printMapping(const std::map< std::string, std::string > &mapping)
Definition: node_utils.cpp:10


rosmon_core
Author(s): Max Schwarz
autogenerated on Sat Jan 9 2021 03:35:43