Skip to content
Snippets Groups Projects
Commit 89ff6973 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

COmment out API with default YAML

parent 52fb61e3
No related branches found
No related tags found
2 merge requests!312Adress 244: Do not use default yaml params,!305WIP: Resolve "Do not use default YAML params"
......@@ -68,14 +68,14 @@ public:
_params.insert(std::pair<std::string, std::string>(key, value));
}
template<typename T>
T getParam(std::string key, std::string def_value) const {
if(_params.find(key) != _params.end()){
return converter<T>::convert(_params.find(key)->second);
}else{
return converter<T>::convert(def_value);
}
}
// template<typename T>
// T getParam(std::string key, std::string def_value) const {
// if(_params.find(key) != _params.end()){
// return converter<T>::convert(_params.find(key)->second);
// }else{
// return converter<T>::convert(def_value);
// }
// }
template<typename T>
T getParam(std::string key) const {
......
......@@ -16,18 +16,19 @@ ParserYAML parse(string _file, string _path_root)
return parser;
}
TEST(ParamsServer, Default)
{
auto parser = parse("test/yaml/params1.yaml", wolf_root);
auto params = parser.getParams();
ParamsServer server = ParamsServer(params, parser.sensorsSerialization(), parser.processorsSerialization());
EXPECT_EQ(server.getParam<double>("should_not_exist", "2.6"), 2.6);
EXPECT_EQ(server.getParam<bool>("my_proc_test/voting_active", "true"), false);
EXPECT_NE(server.getParam<unsigned int>("my_proc_test/time_tolerance", "23"), 23);
EXPECT_THROW({ server.getParam<unsigned int>("test error"); }, std::runtime_error);
EXPECT_NE(server.getParam<unsigned int>("my_proc_test/time_tolerance"), 23);
EXPECT_EQ(server.getParam<bool>("my_proc_test/voting_active"), false);
}
//TEST(ParamsServer, Default)
//{
// auto parser = parse("test/yaml/params1.yaml", wolf_root);
// auto params = parser.getParams();
// ParamsServer server = ParamsServer(params, parser.sensorsSerialization(), parser.processorsSerialization());
// EXPECT_EQ(server.getParam<double>("should_not_exist", "2.6"), 2.6);
// EXPECT_EQ(server.getParam<bool>("my_proc_test/voting_active", "true"), false);
// EXPECT_NE(server.getParam<unsigned int>("my_proc_test/time_tolerance", "23"), 23);
// EXPECT_THROW({ server.getParam<unsigned int>("test error"); }, std::runtime_error);
// EXPECT_NE(server.getParam<unsigned int>("my_proc_test/time_tolerance"), 23);
// EXPECT_EQ(server.getParam<bool>("my_proc_test/voting_active"), false);
//}
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment