Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/catch_test_case_info.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2026-09-06 19:02:48 +0200
committerMartin Hořeňovský2026-09-06 20:08:25 +0200
commit5fe473f202a322ab10ee10bf64fcae63593286cf (patch)
tree873305a2b47405d89c52ea0de87eb1d0d404c157 /src/catch2/catch_test_case_info.cpp
parent897d8043eb192d0fc361c6339ce13e1cabe481c4 (diff)
downloadcatch3-5fe473f202a322ab10ee10bf64fcae63593286cf.tar.gz
Faster check for duplicated test cases
By avoiding `std::set`, we save 1 allocation per checked test case, and the sort + pairwise check has much nicer cache behaviour, leading to much faster check. Overall, the check is only a tiny part of the startup overhead, but the improvement is large enough that it ends up measurable in binaries with many tests (e.g. `SelfTest`).
Diffstat (limited to 'src/catch2/catch_test_case_info.cpp')
-rw-r--r--src/catch2/catch_test_case_info.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/catch2/catch_test_case_info.cpp b/src/catch2/catch_test_case_info.cpp
index 9d64e532..d775b89a 100644
--- a/src/catch2/catch_test_case_info.cpp
+++ b/src/catch2/catch_test_case_info.cpp
@@ -259,4 +259,10 @@ namespace Catch {
return lhs.tags < rhs.tags;
}
+ bool operator==( TestCaseInfo const& lhs, TestCaseInfo const& rhs ) {
+ return lhs.name == rhs.name
+ && lhs.className == rhs.className
+ && lhs.tags == rhs.tags;
+ }
+
} // end namespace Catch