15 #include <aws/core/client/ClientConfiguration.h> 18 #include <gtest/gtest.h> 21 #define PARAM_READER_TEST__PARAM_PREFIX "configuration_namespace9181" 22 #define PARAM_READER_TEST__PARAM_KEY "someBogusParamKey" 23 #define PARAM_READER_TEST__PARAM_VALUE "uk-north-2180" 42 auto parameter_reader = std::make_shared<Aws::Client::Ros1NodeParameterReader>();
49 auto param_path_complex_no_node_ns =
ParameterPath(std::vector<std::string>{},
52 std::vector<std::string>{
"test_parameter_reader",
"producers"},
55 ASSERT_EQ(param_path_flat.get_resolved_path(
'/',
'/'), param_path_variadic.get_resolved_path(
'/',
'/'));
56 ASSERT_EQ(param_path_flat.get_resolved_path(
'/',
'/'), param_path_complex_with_node_ns.
get_resolved_path(
'/',
'/'));
58 std::string flat_result;
59 parameter_reader->ReadParam(param_path_flat, flat_result);
60 std::string variadic_result;
61 parameter_reader->ReadParam(param_path_variadic, variadic_result);
62 std::string complex_no_node_ns_result;
63 parameter_reader->ReadParam(param_path_complex_no_node_ns, complex_no_node_ns_result);
64 std::string complex_with_node_ns_result;
65 parameter_reader->ReadParam(param_path_complex_with_node_ns, complex_with_node_ns_result);
67 ASSERT_EQ(flat_result, variadic_result);
68 ASSERT_EQ(variadic_result, complex_with_node_ns_result);
71 ASSERT_EQ(std::string(), complex_no_node_ns_result);
73 parameter_reader->ReadParam(param_path_complex_no_node_ns, complex_no_node_ns_result);
74 ASSERT_EQ(complex_no_node_ns_result, complex_with_node_ns_result);
77 TEST(ParameterReader, failureTests)
79 auto parameter_reader = std::make_shared<Aws::Client::Ros1NodeParameterReader>();
83 ASSERT_EQ(Aws::AwsError::AWS_ERR_NOT_FOUND, parameter_reader->ReadParam(nonexistent_path, nonexistent_path_result));
87 int main(
int argc,
char ** argv)
89 testing::InitGoogleTest(&argc, argv);
90 ros::init(argc, argv,
"test_parameter_reader");
91 return RUN_ALL_TESTS();
int main(int argc, char **argv)
#define PARAM_READER_TEST__PARAM_KEY
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
TEST(ParameterReader, failureTests)
std::string get_resolved_path(char node_namespace_separator, char parameter_namespace_separator) const
#define PARAM_READER_TEST__PARAM_VALUE
#define PARAM_READER_TEST__PARAM_PREFIX
TEST_F(ParameterReaderTest, parameterPathResolution)