4 #include <catch_ros/catch.hpp> 6 #include "../../src/launch/launch_config.h" 17 <param name="global_param" value="hello_world" /> 25 auto it = config.
parameters().find(
"/global_param");
30 REQUIRE(static_cast<std::string>(value) ==
"hello_world");
38 <param name="int_param_auto" value="0" /> 39 <param name="int_param_forced" value="0" type="int" /> 41 <param name="double_param_auto" value="0.0" /> 42 <param name="double_param_forced" value="0" type="double" /> 44 <param name="str_param_auto" value="hello" /> 45 <param name="str_param_forced" value="0" type="str" /> 47 <param name="bool_param_auto" value="true" /> 48 <param name="bool_param_forced" value="true" type="boolean" /> 50 <param name="bool_param_auto_nonlowercase" value="True" /> 51 <param name="bool_param_forced_nonlowercase" value="True" type="boolean" /> 53 <param name="yaml_param" type="yaml" value="test_param: true" /> 54 <param name="yaml_param_scalar" type="yaml" value="true" /> 85 <param name="test" command="echo -n hello_world" /> 87 <param name="multiline" command="/bin/echo -ne hello\\nworld" /> 89 <param name="yaml_param" type="yaml" command="echo test_param: true" /> 106 config.
parseString(R
"EOF(<launch><param name="test" command="false" /></launch>)EOF"); 118 <param name="test" textfile="$(find rosmon_core)/test/textfile.txt" /> 131 using Catch::Matchers::Contains;
136 <param name="test" textfile="$(find rosmon_core)/test/textfile_does_not_exist.txt" /> 151 <param name="test" binfile="$(find rosmon_core)/test/textfile.txt" /> 161 auto it =
params.find(
"/test");
162 REQUIRE(it !=
params.end());
168 std::string expectedData =
"hello_world";
171 REQUIRE(expectedData.size() == data.size());
172 for(std::size_t i = 0; i < expectedData.size(); ++i)
173 REQUIRE(data[i] == expectedData[i]);
181 <param name="global/param" value="abc" /> 182 <param name="/global/param2" value="def" /> 184 <group ns="namespace"> 185 <param name="test" value="val1" /> 186 <param name="/test2" value="val2" /> 189 <node name="test_node" pkg="rosmon_core" type="abort"> 190 <param name="private" value="val3" /> 191 <param name="~private2" value="val4" /> 192 <param name="/leading_slash" value="val5" /> 213 TEST_CASE(
"scoped params with double slash (#49)",
"[param]")
219 <param name="param1" value="hello" /> 222 <node name="test_node" pkg="rosmon_core" type="abort" ns="/racecar"> 223 <param name="private_param" value="hello again" /> 236 TEST_CASE(
"wrong param types",
"[param]")
254 LaunchConfig().parseString(R"EOF(<launch><param name="test" value="invalid: {{ yaml}} here" type="yaml" /></launch>)EOF"), 261 config.parseString(R"EOF(<launch><param name="test" command="echo -ne invalid: {{ yaml}} here" type="yaml" /></launch>)EOF"); 275 TEST_CASE("invalid param input combinations",
"[param]")
278 LaunchConfig().
parseString(R
"EOF(<launch><param name="test" value="abc" command="echo -ne test" /></launch>)EOF"), 283 LaunchConfig().parseString(R"EOF(<launch><param name="test" textfile="$(find rosmon_core)/test/textfile.txt" command="echo -ne test" /></launch>)EOF"), 293 TEST_CASE("invalid param names",
"[param]")
295 using Catch::Matchers::Contains;
const std::map< std::string, XmlRpc::XmlRpcValue > & parameters() const
void evaluateParameters()
void parseString(const std::string &input, bool onlyArguments=false)
TEST_CASE("global_param","[param]")
config parseString(R"EOF(
<launch>
<group ns="/">
<param name="param1" value="hello" />
</group>
<node name="test_node" pkg="rosmon_core" type="abort" ns="/racecar">
<param name="private_param" value="hello again" />
</node>
</launch>
)EOF")
std::vector< char > BinaryData