diff --git a/test/gtest_schema.cpp b/test/gtest_schema.cpp index 835ba1c48d521ab9a099fb83989fd44ce5bd0d04..57d7f1eafc260b35b54f922422195e653042c089 100644 --- a/test/gtest_schema.cpp +++ b/test/gtest_schema.cpp @@ -121,18 +121,29 @@ TEST(Schema, validate_all_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)) - { - if (filesystem::is_regular_file(entry) and entry.path().extension().string() == ".schema") + for (auto root_folder : root_folders) + for (auto const& entry : filesystem::recursive_directory_iterator(root_folder)) { - ASSERT_FALSE(schemas_found.count(entry.path().filename().string())); - schemas_found.insert(entry.path().filename().string()); + if (filesystem::is_regular_file(entry) and entry.path().extension().string() == ".schema") + { + 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++; + } } - } - - WOLF_INFO("Found ", schemas_found.size(), " schema files."); + ASSERT_EQ(n_duplicated, 0); + WOLF_INFO_COND(n_duplicated == 0, "Found ", schemas_found.size(), " schema files."); + WOLF_ERROR_COND( + n_duplicated != 0, "Found ", n_duplicated, " duplicated schemas in ", schemas_found.size(), " schema files."); }