test
xml
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
}
rosmon::launch::LaunchConfig::parseString
void parseString(const std::string &input, bool onlyArguments=false)
Definition:
launch_config.cpp:249
rosmon::launch::LaunchConfig::nodes
const std::vector< Node::Ptr > & nodes() const
Definition:
launch_config.h:215
rosmon::launch::LaunchConfig
Definition:
launch_config.h:175
getNode
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
TEST_CASE
TEST_CASE("remap", "[remap]")
Definition:
test_remap.cpp:12
rosmon::launch
Definition:
bytes_parser.cpp:15
printMapping
std::string printMapping(const std::map< std::string, std::string > &mapping)
Definition:
node_utils.cpp:10
node_utils.h
rosmon_core
Author(s): Max Schwarz
autogenerated on Wed Feb 21 2024 04:01:14