cleanup: solve std namespace issues and remove unused imports

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
Jason Dellaluce 2023-02-17 11:37:16 +00:00 committed by poiana
parent 010f6c6a9e
commit 4706cd8b4e
3 changed files with 10 additions and 12 deletions

View File

@ -35,7 +35,7 @@ TEST(Configuration, configuration_exceptions)
yaml_helper conf; yaml_helper conf;
/* Broken YAML */ /* Broken YAML */
string sample_broken_yaml = sample_yaml + " / bad_symbol"; std::string sample_broken_yaml = sample_yaml + " / bad_symbol";
EXPECT_ANY_THROW(conf.load_from_string(sample_broken_yaml)); EXPECT_ANY_THROW(conf.load_from_string(sample_broken_yaml));
/* Right YAML */ /* Right YAML */
@ -67,16 +67,16 @@ TEST(Configuration, read_yaml_fields)
/* get some fields */ /* get some fields */
ASSERT_EQ(conf.get_scalar<int>("base_value.id", -1), 1); ASSERT_EQ(conf.get_scalar<int>("base_value.id", -1), 1);
ASSERT_STREQ(conf.get_scalar<string>("base_value.name", "none").c_str(), "sample_name"); ASSERT_STREQ(conf.get_scalar<std::string>("base_value.name", "none").c_str(), "sample_name");
ASSERT_EQ(conf.get_scalar<bool>("base_value.subvalue.subvalue2.boolean", false), true); ASSERT_EQ(conf.get_scalar<bool>("base_value.subvalue.subvalue2.boolean", false), true);
/* get list field elements */ /* get list field elements */
ASSERT_STREQ(conf.get_scalar<string>("base_value_2.sample_list[0]", "none").c_str(), "elem1"); ASSERT_STREQ(conf.get_scalar<std::string>("base_value_2.sample_list[0]", "none").c_str(), "elem1");
ASSERT_STREQ(conf.get_scalar<string>("base_value_2.sample_list[1]", "none").c_str(), "elem2"); ASSERT_STREQ(conf.get_scalar<std::string>("base_value_2.sample_list[1]", "none").c_str(), "elem2");
ASSERT_STREQ(conf.get_scalar<string>("base_value_2.sample_list[2]", "none").c_str(), "elem3"); ASSERT_STREQ(conf.get_scalar<std::string>("base_value_2.sample_list[2]", "none").c_str(), "elem3");
/* get sequence */ /* get sequence */
vector<string> seq; std::vector<std::string> seq;
conf.get_sequence(seq, "base_value_2.sample_list"); conf.get_sequence(seq, "base_value_2.sample_list");
ASSERT_EQ(seq.size(), 3); ASSERT_EQ(seq.size(), 3);
ASSERT_STREQ(seq[0].c_str(), "elem1"); ASSERT_STREQ(seq[0].c_str(), "elem1");
@ -86,7 +86,7 @@ TEST(Configuration, read_yaml_fields)
TEST(Configuration, modify_yaml_fields) TEST(Configuration, modify_yaml_fields)
{ {
string key = "base_value.subvalue.subvalue2.boolean"; std::string key = "base_value.subvalue.subvalue2.boolean";
yaml_helper conf; yaml_helper conf;
/* Get original value */ /* Get original value */

View File

@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
#include "fields_info.h"
#include "actions.h" #include "actions.h"
using namespace falco::app; using namespace falco::app;

View File

@ -116,7 +116,7 @@ void falco_configuration::load_yaml(const std::string& config_name, const yaml_h
filename = config.get_scalar<std::string>("file_output.filename", ""); filename = config.get_scalar<std::string>("file_output.filename", "");
if(filename == std::string("")) if(filename == std::string(""))
{ {
throw logic_error("Error reading config file (" + config_name + "): file output enabled but no filename in configuration block"); throw std::logic_error("Error reading config file (" + config_name + "): file output enabled but no filename in configuration block");
} }
file_output.options["filename"] = filename; file_output.options["filename"] = filename;
@ -148,7 +148,7 @@ void falco_configuration::load_yaml(const std::string& config_name, const yaml_h
program = config.get_scalar<std::string>("program_output.program", ""); program = config.get_scalar<std::string>("program_output.program", "");
if(program == std::string("")) if(program == std::string(""))
{ {
throw logic_error("Error reading config file (" + config_name + "): program output enabled but no program in configuration block"); throw std::logic_error("Error reading config file (" + config_name + "): program output enabled but no program in configuration block");
} }
program_output.options["program"] = program; program_output.options["program"] = program;
@ -167,7 +167,7 @@ void falco_configuration::load_yaml(const std::string& config_name, const yaml_h
if(url == std::string("")) if(url == std::string(""))
{ {
throw logic_error("Error reading config file (" + config_name + "): http output enabled but no url in configuration block"); throw std::logic_error("Error reading config file (" + config_name + "): http output enabled but no url in configuration block");
} }
http_output.options["url"] = url; http_output.options["url"] = url;