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

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/IntrospectiveTests
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-11-07 12:39:07 +0100
committerMartin Hořeňovský2019-11-14 10:53:12 +0100
commitd36c15c3caf96c2e751f4ad83a386c1fd047c2f6 (patch)
treecba3faef17447ccfd3a2c9a7e751f8a52e2ae226 /projects/SelfTest/IntrospectiveTests
parent302e2c0b06f131199b97ad33bdebacc359782ff0 (diff)
downloadcatch3-d36c15c3caf96c2e751f4ad83a386c1fd047c2f6.tar.gz
Store tags in one big pre-allocated string and only work with refs
This should decrease the number of allocations before main is entered significantly, but complicates the code somewhat in return. Assuming I used `massif` right, doing just `SelfTest --list-tests` went from 929 allocations at "Remove gcc-4.9 from the travis builds" (2 commits up), to 614 allocations with this commit.
Diffstat (limited to 'projects/SelfTest/IntrospectiveTests')
-rw-r--r--projects/SelfTest/IntrospectiveTests/Tag.tests.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp b/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp
index 79657226..5120d8ed 100644
--- a/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp
+++ b/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp
@@ -42,6 +42,12 @@ TEST_CASE( "Tag alias can be registered against tag patterns" ) {
}
TEST_CASE("shortened hide tags are split apart") {
+ using Catch::StringRef;
auto testcase = Catch::makeTestCaseInfo("", {"fake test name", "[.magic-tag]"}, CATCH_INTERNAL_LINEINFO);
- REQUIRE_THAT(testcase->tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")));
+ // Transform ...
+ std::vector<StringRef> tags;
+ for (auto const& tag : testcase->tags) {
+ tags.push_back(tag.original);
+ }
+ REQUIRE_THAT(tags, Catch::VectorContains("magic-tag"_catch_sr) && Catch::VectorContains("."_catch_sr));
}