test_include.cpp
Go to the documentation of this file.
1 // Unit tests for include 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 "param_utils.h"
9 
10 using namespace rosmon::launch;
11 
12 TEST_CASE("include basic", "[include]")
13 {
14  LaunchConfig config;
15  config.parseString(R"EOF(
16  <launch>
17  <arg name="test_argument" value="hello" />
18 
19  <include file="$(find rosmon_core)/test/basic_sub.launch">
20  <arg name="test_argument" value="$(arg test_argument)" />
21  </include>
22  </launch>
23  )EOF");
24 
25  config.evaluateParameters();
26 
27  auto params = config.parameters();
28 
29  CHECK(getTypedParam<std::string>(params, "/test_argument") == "hello");
30 }
31 
32 TEST_CASE("include default", "[include]")
33 {
34  // roslaunch allows this - to me it seems quite confusing, since the value
35  // of the arg tag cannot be overriden, despite using "default".
36 
37  LaunchConfig config;
38  config.parseString(R"EOF(
39  <launch>
40  <arg name="test_argument" value="hello" />
41 
42  <include file="$(find rosmon_core)/test/basic_sub.launch">
43  <arg name="test_argument" default="$(arg test_argument)" />
44  </include>
45  </launch>
46  )EOF");
47 
48  config.evaluateParameters();
49 
50  auto params = config.parameters();
51 
52  CHECK(getTypedParam<std::string>(params, "/test_argument") == "hello");
53 }
54 
55 TEST_CASE("include pass_all", "[include]")
56 {
57  LaunchConfig config;
58  config.parseString(R"EOF(
59  <launch>
60  <arg name="test_argument" value="hello" />
61 
62  <include file="$(find rosmon_core)/test/basic_sub.launch" pass_all_args="true" />
63  </launch>
64  )EOF");
65 
66  config.evaluateParameters();
67 
68  auto params = config.parameters();
69 
70  CHECK(getTypedParam<std::string>(params, "/test_argument") == "hello");
71 }
auto & params
Definition: test_param.cpp:220
const std::map< std::string, XmlRpc::XmlRpcValue > & parameters() const
void parseString(const std::string &input, bool onlyArguments=false)
TEST_CASE("include basic","[include]")


rosmon_core
Author(s): Max Schwarz
autogenerated on Wed Jul 10 2019 03:10:12