Skip to content
Snippets Groups Projects
Commit a45a3415 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

[skip ci] gtest_schema checking duplicated in specific folders

parent d3f06bb9
No related branches found
No related tags found
1 merge request!25Draft: Resolve "Adapt to new sensor constructors in core"
...@@ -121,18 +121,29 @@ TEST(Schema, validate_all_schemas) ...@@ -121,18 +121,29 @@ TEST(Schema, validate_all_schemas)
TEST(Schema, duplicated_schemas) TEST(Schema, duplicated_schemas)
{ {
std::set<std::string> schemas_found; std::map<std::string, std::string> schemas_found;
unsigned int n_duplicated = 0;
std::vector<std::string> root_folders{plugin_dir + "/schema", plugin_dir + "/test"};
for (auto const& entry : filesystem::recursive_directory_iterator(plugin_dir)) for (auto root_folder : root_folders)
{ for (auto const& entry : filesystem::recursive_directory_iterator(root_folder))
if (filesystem::is_regular_file(entry) and entry.path().extension().string() == ".schema")
{ {
ASSERT_FALSE(schemas_found.count(entry.path().filename().string())); if (filesystem::is_regular_file(entry) and entry.path().extension().string() == ".schema")
schemas_found.insert(entry.path().filename().string()); {
bool duplicated = schemas_found.count(entry.path().filename().string());
WOLF_ERROR_COND(duplicated,
"Found duplicated schema file:\n",
entry.path().string(),
"\n",
schemas_found[entry.path().filename().string()])
schemas_found[entry.path().filename().string()] = entry.path().string();
if (duplicated) n_duplicated++;
}
} }
} ASSERT_EQ(n_duplicated, 0);
WOLF_INFO_COND(n_duplicated == 0, "Found ", schemas_found.size(), " schema files.");
WOLF_INFO("Found ", schemas_found.size(), " schema files."); WOLF_ERROR_COND(
n_duplicated != 0, "Found ", n_duplicated, " duplicated schemas in ", schemas_found.size(), " schema files.");
} }
......
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