diff --git a/benchmarks/runtime_assertion_benches.cpp b/benchmarks/runtime_assertion_benches.cpp index 6a28e3fa..1202b0cd 100644 --- a/benchmarks/runtime_assertion_benches.cpp +++ b/benchmarks/runtime_assertion_benches.cpp @@ -7,21 +7,48 @@ // SPDX-License-Identifier: BSL-1.0 #include +#include -TEST_CASE("Simple REQUIRE - 10M") { - for (size_t i = 0; i < 10'000'000; ++i) { - REQUIRE(true); +namespace { + +class MatchAllMatcher final : public Catch::Matchers::MatcherGenericBase { +public: + template + bool match( Any&& ) const { + return true; + } + + std::string describe() const override { + using namespace std::string_literals; + return "Long string that does not fit into SSO"s; + } +}; + +MatchAllMatcher MatchAll() { return MatchAllMatcher(); } + + +TEST_CASE( "REQUIRE", "[assertions]" ) { + for ( size_t i = 0; i < 10'000'000; ++i ) { + REQUIRE( true ); } } -TEST_CASE("Simple NOTHROW - 10M") { - for (size_t i = 0; i < 10'000'000; ++i) { - REQUIRE_NOTHROW([](){}()); +TEST_CASE( "REQUIRE_THAT", "[assertions][matchers]" ) { + for ( size_t i = 0; i < 10'000'000; ++i ) { + REQUIRE_THAT( 1, MatchAll() ); } } -TEST_CASE("Simple THROWS - 10M") { - for (size_t i = 0; i < 10'000'000; ++i) { - REQUIRE_THROWS([]() { throw 1; }()); +TEST_CASE( "REQUIRE_NOTHROW", "[assertions][exceptions]" ) { + for ( size_t i = 0; i < 10'000'000; ++i ) { + REQUIRE_NOTHROW( []() {}() ); } } + +TEST_CASE( "REQUIRE_THROWS", "[assertions][exceptions]" ) { + for ( size_t i = 0; i < 10'000'000; ++i ) { + REQUIRE_THROWS( []() { throw 1; }() ); + } +} + +} // namespace