|
7 | 7 | // SPDX-License-Identifier: BSL-1.0 |
8 | 8 |
|
9 | 9 | #include <catch2/catch_test_macros.hpp> |
| 10 | +#include <catch2/matchers/catch_matchers_templated.hpp> |
10 | 11 |
|
11 | | -TEST_CASE("Simple REQUIRE - 10M") { |
12 | | - for (size_t i = 0; i < 10'000'000; ++i) { |
13 | | - REQUIRE(true); |
| 12 | +namespace { |
| 13 | + |
| 14 | +class MatchAllMatcher final : public Catch::Matchers::MatcherGenericBase { |
| 15 | +public: |
| 16 | + template <typename Any> |
| 17 | + bool match( Any&& ) const { |
| 18 | + return true; |
| 19 | + } |
| 20 | + |
| 21 | + std::string describe() const override { |
| 22 | + using namespace std::string_literals; |
| 23 | + return "Long string that does not fit into SSO"s; |
| 24 | + } |
| 25 | +}; |
| 26 | + |
| 27 | +MatchAllMatcher MatchAll() { return MatchAllMatcher(); } |
| 28 | + |
| 29 | + |
| 30 | +TEST_CASE( "REQUIRE", "[assertions]" ) { |
| 31 | + for ( size_t i = 0; i < 10'000'000; ++i ) { |
| 32 | + REQUIRE( true ); |
14 | 33 | } |
15 | 34 | } |
16 | 35 |
|
17 | | -TEST_CASE("Simple NOTHROW - 10M") { |
18 | | - for (size_t i = 0; i < 10'000'000; ++i) { |
19 | | - REQUIRE_NOTHROW([](){}()); |
| 36 | +TEST_CASE( "REQUIRE_THAT", "[assertions][matchers]" ) { |
| 37 | + for ( size_t i = 0; i < 10'000'000; ++i ) { |
| 38 | + REQUIRE_THAT( 1, MatchAll() ); |
20 | 39 | } |
21 | 40 | } |
22 | 41 |
|
23 | | -TEST_CASE("Simple THROWS - 10M") { |
24 | | - for (size_t i = 0; i < 10'000'000; ++i) { |
25 | | - REQUIRE_THROWS([]() { throw 1; }()); |
| 42 | +TEST_CASE( "REQUIRE_NOTHROW", "[assertions][exceptions]" ) { |
| 43 | + for ( size_t i = 0; i < 10'000'000; ++i ) { |
| 44 | + REQUIRE_NOTHROW( []() {}() ); |
26 | 45 | } |
27 | 46 | } |
| 47 | + |
| 48 | +TEST_CASE( "REQUIRE_THROWS", "[assertions][exceptions]" ) { |
| 49 | + for ( size_t i = 0; i < 10'000'000; ++i ) { |
| 50 | + REQUIRE_THROWS( []() { throw 1; }() ); |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +} // namespace |
0 commit comments