From 2537f07d7511a3de7c677c334e14e6bdab88ffd2 Mon Sep 17 00:00:00 2001 From: joanvallve <jvallve@iri.upc.edu> Date: Mon, 8 Jul 2024 10:49:21 +0200 Subject: [PATCH] [skip ci] gtest_schema checking duplicated in specific folders --- test/gtest_schema.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/test/gtest_schema.cpp b/test/gtest_schema.cpp index d6619ff2e..7998eb646 100644 --- a/test/gtest_schema.cpp +++ b/test/gtest_schema.cpp @@ -126,20 +126,23 @@ TEST(Schema, duplicated_schemas) { std::map<std::string, std::string> schemas_found; unsigned int n_duplicated = 0; - for (auto const& entry : filesystem::recursive_directory_iterator(wolf_dir)) - { - if (filesystem::is_regular_file(entry) and entry.path().extension().string() == ".schema") + std::vector<std::string> root_folders{wolf_dir + "/schema", wolf_dir + "/test"}; + + for (auto root_folder : root_folders) + for (auto const& entry : filesystem::recursive_directory_iterator(root_folder)) { - 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++; + 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++; + } } - } ASSERT_EQ(n_duplicated, 0); WOLF_INFO_COND(n_duplicated == 0, "Found ", schemas_found.size(), " schema files."); WOLF_ERROR_COND( -- GitLab