From d2a70ccc51e4ca6de405b081f4346c1747b3e2d5 Mon Sep 17 00:00:00 2001 From: joanvallve <jvallve@iri.upc.edu> Date: Fri, 5 Jul 2024 13:14:56 +0200 Subject: [PATCH] more verbose gtest --- test/gtest_schema.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/test/gtest_schema.cpp b/test/gtest_schema.cpp index 45764b208..5125fd00d 100644 --- a/test/gtest_schema.cpp +++ b/test/gtest_schema.cpp @@ -124,18 +124,25 @@ 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; for (auto const& entry : filesystem::recursive_directory_iterator(wolf_dir)) { if (filesystem::is_regular_file(entry) and entry.path().extension().string() == ".schema") { - ASSERT_FALSE(schemas_found.count(entry.path().filename().string())); - 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++; } } - - 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."); } int main(int argc, char** argv) -- GitLab