From a07b444331cc2a6ba96d8e031eb40deb24261a69 Mon Sep 17 00:00:00 2001 From: KStocky Date: Sat, 6 Jul 2024 16:06:47 +0100 Subject: [PATCH 01/16] Initial implementation of Test cases with persistent fixtures. With a simple example --- examples/CMakeLists.txt | 1 + examples/Fixture.cpp | 26 ++++++++++ src/catch2/catch_test_case_info.hpp | 8 ++++ src/catch2/catch_test_macros.hpp | 4 ++ .../catch_interfaces_test_invoker.hpp | 2 + src/catch2/internal/catch_run_context.cpp | 2 + src/catch2/internal/catch_test_registry.cpp | 2 + src/catch2/internal/catch_test_registry.hpp | 47 +++++++++++++++++++ 8 files changed, 92 insertions(+) create mode 100644 examples/Fixture.cpp diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 7e629e0932..3dce2a8c54 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -25,6 +25,7 @@ target_compile_definitions(231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT) # These examples use the standard separate compilation set( SOURCES_IDIOMATIC_EXAMPLES + Fixture.cpp 030-Asn-Require-Check.cpp 100-Fix-Section.cpp 110-Fix-ClassFixture.cpp diff --git a/examples/Fixture.cpp b/examples/Fixture.cpp new file mode 100644 index 0000000000..82a12d1dcb --- /dev/null +++ b/examples/Fixture.cpp @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: BSL-1.0 + +// Fixture.cpp + +// Catch has three ways to express fixtures: +// - Sections +// - Traditional class-based fixtures that are created and destroyed on every partial run +// - Traditional class-based fixtures that are created at the start of a test case and destroyed at the end of a test case (this file) + +// main() provided by linkage to Catch2WithMain + +#include + +struct MyFixture{ + int MyInt = 0; +}; + +TEST_CASE_FIXTURE(MyFixture, "Tests with MyFixture") { + SECTION("First partial run") { + REQUIRE(MyInt++ == 0); + } + + SECTION("Second partial run") { + REQUIRE(MyInt == 1); + } +} \ No newline at end of file diff --git a/src/catch2/catch_test_case_info.hpp b/src/catch2/catch_test_case_info.hpp index da9927e7bf..7a47a726c3 100644 --- a/src/catch2/catch_test_case_info.hpp +++ b/src/catch2/catch_test_case_info.hpp @@ -112,6 +112,14 @@ namespace Catch { TestCaseHandle(TestCaseInfo* info, ITestInvoker* invoker) : m_info(info), m_invoker(invoker) {} + void testCaseStarting() const { + m_invoker->testCaseStarting(); + } + + void testCaseEnding() const { + m_invoker->testCaseEnding(); + } + void invoke() const { m_invoker->invoke(); } diff --git a/src/catch2/catch_test_macros.hpp b/src/catch2/catch_test_macros.hpp index 1088afbedd..a1d99f4ae7 100644 --- a/src/catch2/catch_test_macros.hpp +++ b/src/catch2/catch_test_macros.hpp @@ -43,6 +43,7 @@ #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) #define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) + #define CATCH_TEST_CASE_FIXTURE( className, ... ) INTERNAL_CATCH_TEST_CASE_FIXTURE( className, __VA_ARGS__ ) #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) #define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) #define CATCH_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) @@ -97,6 +98,7 @@ #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define CATCH_METHOD_AS_TEST_CASE( method, ... ) + #define CATCH_TEST_CASE_FIXTURE( className, ... ) #define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0) #define CATCH_SECTION( ... ) #define CATCH_DYNAMIC_SECTION( ... ) @@ -142,6 +144,7 @@ #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) #define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) + #define TEST_CASE_FIXTURE( className, ... ) INTERNAL_CATCH_TEST_CASE_FIXTURE( className, __VA_ARGS__ ) #define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) #define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) #define DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) @@ -195,6 +198,7 @@ #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), __VA_ARGS__) #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define METHOD_AS_TEST_CASE( method, ... ) + #define TEST_CASE_FIXTURE( className, ... ) #define REGISTER_TEST_CASE( Function, ... ) (void)(0) #define SECTION( ... ) #define DYNAMIC_SECTION( ... ) diff --git a/src/catch2/interfaces/catch_interfaces_test_invoker.hpp b/src/catch2/interfaces/catch_interfaces_test_invoker.hpp index 3caeff9a32..e30aea8342 100644 --- a/src/catch2/interfaces/catch_interfaces_test_invoker.hpp +++ b/src/catch2/interfaces/catch_interfaces_test_invoker.hpp @@ -12,6 +12,8 @@ namespace Catch { class ITestInvoker { public: + virtual void testCaseStarting(); + virtual void testCaseEnding(); virtual void invoke() const = 0; virtual ~ITestInvoker(); // = default }; diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp index 076917885b..b1eebebdd4 100644 --- a/src/catch2/internal/catch_run_context.cpp +++ b/src/catch2/internal/catch_run_context.cpp @@ -185,6 +185,7 @@ namespace Catch { auto const& testInfo = testCase.getTestCaseInfo(); m_reporter->testCaseStarting(testInfo); + testCase.testCaseStarting(); m_activeTestCase = &testCase; @@ -254,6 +255,7 @@ namespace Catch { deltaTotals.testCases.failed++; } m_totals.testCases += deltaTotals.testCases; + testCase.testCaseEnding(); m_reporter->testCaseEnded(TestCaseStats(testInfo, deltaTotals, CATCH_MOVE(redirectedCout), diff --git a/src/catch2/internal/catch_test_registry.cpp b/src/catch2/internal/catch_test_registry.cpp index e9c999fecd..4fe22b2f90 100644 --- a/src/catch2/internal/catch_test_registry.cpp +++ b/src/catch2/internal/catch_test_registry.cpp @@ -16,6 +16,8 @@ #include namespace Catch { + void ITestInvoker::testCaseStarting() {} + void ITestInvoker::testCaseEnding() {} ITestInvoker::~ITestInvoker() = default; namespace { diff --git a/src/catch2/internal/catch_test_registry.hpp b/src/catch2/internal/catch_test_registry.hpp index c62fbdcc10..1e8c27571d 100644 --- a/src/catch2/internal/catch_test_registry.hpp +++ b/src/catch2/internal/catch_test_registry.hpp @@ -47,6 +47,33 @@ Detail::unique_ptr makeTestInvoker( void (C::*testAsMethod)() ) { return Detail::make_unique>( testAsMethod ); } +template +class TestInvokerFixture : public ITestInvoker { + void ( C::*m_testAsMethod )(); + Detail::unique_ptr m_fixture = nullptr; + +public: + TestInvokerFixture( void ( C::*testAsMethod )() ) noexcept : m_testAsMethod( testAsMethod ) {} + + void testCaseStarting() override { + m_fixture = Detail::make_unique(); + } + + void testCaseEnding() override { + m_fixture.reset(); + } + + void invoke() const override { + auto* f = const_cast( m_fixture.get() ); + ( f->*m_testAsMethod )(); + } +}; + +template +Detail::unique_ptr makeTestInvokerFixture( void ( C::*testAsMethod )() ) { + return Detail::make_unique>( testAsMethod ); +} + struct NameAndTags { constexpr NameAndTags( StringRef name_ = StringRef(), StringRef tags_ = StringRef() ) noexcept: @@ -143,6 +170,26 @@ static int catchInternalSectionHint = 0; #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), ClassName, __VA_ARGS__ ) + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEST_CASE_FIXTURE2( TestName, ClassName, ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + namespace { \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS( ClassName ) { \ + void test(); \ + }; \ + const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \ + Catch::makeTestInvokerFixture( &TestName::test ), \ + CATCH_INTERNAL_LINEINFO, \ + #ClassName##_catch_sr, \ + Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ + } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + void TestName::test() + #define INTERNAL_CATCH_TEST_CASE_FIXTURE( ClassName, ... ) \ + INTERNAL_CATCH_TEST_CASE_FIXTURE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), ClassName, __VA_ARGS__ ) + /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ From 3386614f40cf4cddb33f30860bf670713b8ff1d8 Mon Sep 17 00:00:00 2001 From: KStocky Date: Sat, 6 Jul 2024 16:11:10 +0100 Subject: [PATCH 02/16] Ignore all files with the name CMakeUserPresets.json --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index be955e6cd9..ae60972623 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ Build cmake-build-* benchmark-dir .conan/test_package/build -.conan/test_package/CMakeUserPresets.json +**/CMakeUserPresets.json bazel-* MODULE.bazel.lock build-fuzzers From a4ddfa12ad325eb428c4c5232c2c2b9c1f54de37 Mon Sep 17 00:00:00 2001 From: KStocky Date: Sat, 6 Jul 2024 22:23:04 +0100 Subject: [PATCH 03/16] Adding acceptance tests for TEST_CASE_FIXTURE --- .../Baselines/automake.sw.approved.txt | 2 + .../Baselines/automake.sw.multi.approved.txt | 2 + .../Baselines/compact.sw.approved.txt | 8 +- .../Baselines/compact.sw.multi.approved.txt | 8 +- .../Baselines/console.std.approved.txt | 16 +- .../Baselines/console.sw.approved.txt | 52 +- .../Baselines/console.sw.multi.approved.txt | 52 +- .../SelfTest/Baselines/junit.sw.approved.txt | 14 +- .../Baselines/junit.sw.multi.approved.txt | 14 +- .../Baselines/sonarqube.sw.approved.txt | 12 + .../Baselines/sonarqube.sw.multi.approved.txt | 12 + tests/SelfTest/Baselines/tap.sw.approved.txt | 10 +- .../Baselines/tap.sw.multi.approved.txt | 10 +- .../Baselines/teamcity.sw.approved.txt | 5 + .../Baselines/teamcity.sw.multi.approved.txt | 5 + tests/SelfTest/Baselines/xml.sw.approved.txt | 54 +- .../Baselines/xml.sw.multi.approved.txt | 54 +- .../SelfTest/Baselines/xml.sw.unapproved.txt | 21887 ++++++++++++++++ tests/SelfTest/UsageTests/Class.tests.cpp | 26 + 19 files changed, 22225 insertions(+), 18 deletions(-) create mode 100644 tests/SelfTest/Baselines/xml.sw.unapproved.txt diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index dbdf395c13..6c3b71eadf 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -66,6 +66,8 @@ Nor would this :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1 :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3 :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6 +:test-result: FAIL A TEST_CASE_FIXTURE based test run that fails +:test-result: PASS A TEST_CASE_FIXTURE based test run that succeeds :test-result: FAIL A TEST_CASE_METHOD based test run that fails :test-result: PASS A TEST_CASE_METHOD based test run that succeeds :test-result: PASS A Template product test case - Foo diff --git a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt index 4029ec65a5..40d5c5407d 100644 --- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -64,6 +64,8 @@ :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1 :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3 :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6 +:test-result: FAIL A TEST_CASE_FIXTURE based test run that fails +:test-result: PASS A TEST_CASE_FIXTURE based test run that succeeds :test-result: FAIL A TEST_CASE_METHOD based test run that fails :test-result: PASS A TEST_CASE_METHOD based test run that succeeds :test-result: PASS A Template product test case - Foo diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 9363cb54d7..201d5987f7 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -239,6 +239,10 @@ Class.tests.cpp:: failed: Nttp_Fixture::value == 0 for: 6 == 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 1 > 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 3 > 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 6 > 0 +Class.tests.cpp:: passed: m_a++ == 0 for: 0 == 0 +Class.tests.cpp:: failed: m_a == 0 for: 1 == 0 +Class.tests.cpp:: passed: m_a++ == 0 for: 0 == 0 +Class.tests.cpp:: passed: m_a == 1 for: 1 == 1 Class.tests.cpp:: failed: m_a == 2 for: 1 == 2 Class.tests.cpp:: passed: m_a == 1 for: 1 == 1 Misc.tests.cpp:: passed: x.size() == 0 for: 0 == 0 @@ -2840,7 +2844,7 @@ InternalBenchmark.tests.cpp:: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:: passed: Misc.tests.cpp:: passed: -test cases: 416 | 311 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2255 | 2074 passed | 146 failed | 35 failed as expected +test cases: 418 | 312 passed | 86 failed | 6 skipped | 14 failed as expected +assertions: 2259 | 2077 passed | 147 failed | 35 failed as expected diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index 4007dfca89..566591ed60 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -237,6 +237,10 @@ Class.tests.cpp:: failed: Nttp_Fixture::value == 0 for: 6 == 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 1 > 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 3 > 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 6 > 0 +Class.tests.cpp:: passed: m_a++ == 0 for: 0 == 0 +Class.tests.cpp:: failed: m_a == 0 for: 1 == 0 +Class.tests.cpp:: passed: m_a++ == 0 for: 0 == 0 +Class.tests.cpp:: passed: m_a == 1 for: 1 == 1 Class.tests.cpp:: failed: m_a == 2 for: 1 == 2 Class.tests.cpp:: passed: m_a == 1 for: 1 == 1 Misc.tests.cpp:: passed: x.size() == 0 for: 0 == 0 @@ -2829,7 +2833,7 @@ InternalBenchmark.tests.cpp:: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:: passed: Misc.tests.cpp:: passed: -test cases: 416 | 311 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2255 | 2074 passed | 146 failed | 35 failed as expected +test cases: 418 | 312 passed | 86 failed | 6 skipped | 14 failed as expected +assertions: 2259 | 2077 passed | 147 failed | 35 failed as expected diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 9b3984352d..01665aa79b 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -286,6 +286,18 @@ Class.tests.cpp:: FAILED: with expansion: 6 == 0 +------------------------------------------------------------------------------- +A TEST_CASE_FIXTURE based test run that fails + Second partial run +------------------------------------------------------------------------------- +Class.tests.cpp: +............................................................................... + +Class.tests.cpp:: FAILED: + REQUIRE( m_a == 0 ) +with expansion: + 1 == 0 + ------------------------------------------------------------------------------- A TEST_CASE_METHOD based test run that fails ------------------------------------------------------------------------------- @@ -1598,6 +1610,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 416 | 325 passed | 70 failed | 7 skipped | 14 failed as expected -assertions: 2238 | 2074 passed | 129 failed | 35 failed as expected +test cases: 418 | 326 passed | 71 failed | 7 skipped | 14 failed as expected +assertions: 2242 | 2077 passed | 130 failed | 35 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index de89152e2a..7f80a5d19e 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -2006,6 +2006,54 @@ Class.tests.cpp:: PASSED: with expansion: 6 > 0 +------------------------------------------------------------------------------- +A TEST_CASE_FIXTURE based test run that fails + First partial run +------------------------------------------------------------------------------- +Class.tests.cpp: +............................................................................... + +Class.tests.cpp:: PASSED: + REQUIRE( m_a++ == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A TEST_CASE_FIXTURE based test run that fails + Second partial run +------------------------------------------------------------------------------- +Class.tests.cpp: +............................................................................... + +Class.tests.cpp:: FAILED: + REQUIRE( m_a == 0 ) +with expansion: + 1 == 0 + +------------------------------------------------------------------------------- +A TEST_CASE_FIXTURE based test run that succeeds + First partial run +------------------------------------------------------------------------------- +Class.tests.cpp: +............................................................................... + +Class.tests.cpp:: PASSED: + REQUIRE( m_a++ == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A TEST_CASE_FIXTURE based test run that succeeds + Second partial run +------------------------------------------------------------------------------- +Class.tests.cpp: +............................................................................... + +Class.tests.cpp:: PASSED: + REQUIRE( m_a == 1 ) +with expansion: + 1 == 1 + ------------------------------------------------------------------------------- A TEST_CASE_METHOD based test run that fails ------------------------------------------------------------------------------- @@ -18894,6 +18942,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 416 | 311 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2255 | 2074 passed | 146 failed | 35 failed as expected +test cases: 418 | 312 passed | 86 failed | 6 skipped | 14 failed as expected +assertions: 2259 | 2077 passed | 147 failed | 35 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index f70c0d6fb7..f08245a7f6 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -2004,6 +2004,54 @@ Class.tests.cpp:: PASSED: with expansion: 6 > 0 +------------------------------------------------------------------------------- +A TEST_CASE_FIXTURE based test run that fails + First partial run +------------------------------------------------------------------------------- +Class.tests.cpp: +............................................................................... + +Class.tests.cpp:: PASSED: + REQUIRE( m_a++ == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A TEST_CASE_FIXTURE based test run that fails + Second partial run +------------------------------------------------------------------------------- +Class.tests.cpp: +............................................................................... + +Class.tests.cpp:: FAILED: + REQUIRE( m_a == 0 ) +with expansion: + 1 == 0 + +------------------------------------------------------------------------------- +A TEST_CASE_FIXTURE based test run that succeeds + First partial run +------------------------------------------------------------------------------- +Class.tests.cpp: +............................................................................... + +Class.tests.cpp:: PASSED: + REQUIRE( m_a++ == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A TEST_CASE_FIXTURE based test run that succeeds + Second partial run +------------------------------------------------------------------------------- +Class.tests.cpp: +............................................................................... + +Class.tests.cpp:: PASSED: + REQUIRE( m_a == 1 ) +with expansion: + 1 == 1 + ------------------------------------------------------------------------------- A TEST_CASE_METHOD based test run that fails ------------------------------------------------------------------------------- @@ -18883,6 +18931,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 416 | 311 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2255 | 2074 passed | 146 failed | 35 failed as expected +test cases: 418 | 312 passed | 86 failed | 6 skipped | 14 failed as expected +assertions: 2259 | 2077 passed | 147 failed | 35 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 1888139ad3..0cb57950c0 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -303,6 +303,18 @@ at Class.tests.cpp: + + + +FAILED: + REQUIRE( m_a == 0 ) +with expansion: + 1 == 0 +at Class.tests.cpp: + + + + FAILED: diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt index b594c8c038..c89e384f58 100644 --- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -1,6 +1,6 @@ - + @@ -302,6 +302,18 @@ at Class.tests.cpp: + + + +FAILED: + REQUIRE( m_a == 0 ) +with expansion: + 1 == 0 +at Class.tests.cpp: + + + + FAILED: diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index 537145ccdf..c3f3d1e391 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -509,6 +509,18 @@ at Class.tests.cpp: + + + +FAILED: + REQUIRE( m_a == 0 ) +with expansion: + 1 == 0 +at Class.tests.cpp: + + + + FAILED: diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index 5965774dd8..09186eab94 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -508,6 +508,18 @@ at Class.tests.cpp: + + + +FAILED: + REQUIRE( m_a == 0 ) +with expansion: + 1 == 0 +at Class.tests.cpp: + + + + FAILED: diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 383bd4b084..1eb9e3aab8 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -474,6 +474,14 @@ ok {test-number} - Nttp_Fixture::value > 0 for: 1 > 0 ok {test-number} - Nttp_Fixture::value > 0 for: 3 > 0 # A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6 ok {test-number} - Nttp_Fixture::value > 0 for: 6 > 0 +# A TEST_CASE_FIXTURE based test run that fails +ok {test-number} - m_a++ == 0 for: 0 == 0 +# A TEST_CASE_FIXTURE based test run that fails +not ok {test-number} - m_a == 0 for: 1 == 0 +# A TEST_CASE_FIXTURE based test run that succeeds +ok {test-number} - m_a++ == 0 for: 0 == 0 +# A TEST_CASE_FIXTURE based test run that succeeds +ok {test-number} - m_a == 1 for: 1 == 1 # A TEST_CASE_METHOD based test run that fails not ok {test-number} - m_a == 2 for: 1 == 2 # A TEST_CASE_METHOD based test run that succeeds @@ -4539,5 +4547,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2267 +1..2271 diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index 6622a96acd..60128bcbb2 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -472,6 +472,14 @@ ok {test-number} - Nttp_Fixture::value > 0 for: 1 > 0 ok {test-number} - Nttp_Fixture::value > 0 for: 3 > 0 # A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6 ok {test-number} - Nttp_Fixture::value > 0 for: 6 > 0 +# A TEST_CASE_FIXTURE based test run that fails +ok {test-number} - m_a++ == 0 for: 0 == 0 +# A TEST_CASE_FIXTURE based test run that fails +not ok {test-number} - m_a == 0 for: 1 == 0 +# A TEST_CASE_FIXTURE based test run that succeeds +ok {test-number} - m_a++ == 0 for: 0 == 0 +# A TEST_CASE_FIXTURE based test run that succeeds +ok {test-number} - m_a == 1 for: 1 == 1 # A TEST_CASE_METHOD based test run that fails not ok {test-number} - m_a == 2 for: 1 == 2 # A TEST_CASE_METHOD based test run that succeeds @@ -4528,5 +4536,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2267 +1..2271 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index cec3a0ee74..a85a8a5e26 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -161,6 +161,11 @@ ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6' duration="{duration}"] +##teamcity[testStarted name='A TEST_CASE_FIXTURE based test run that fails'] +##teamcity[testFailed name='A TEST_CASE_FIXTURE based test run that fails' message='-------------------------------------------------------------------------------|nSecond partial run|n-------------------------------------------------------------------------------|nClass.tests.cpp:|n...............................................................................|n|nClass.tests.cpp:|nexpression failed|n REQUIRE( m_a == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFinished name='A TEST_CASE_FIXTURE based test run that fails' duration="{duration}"] +##teamcity[testStarted name='A TEST_CASE_FIXTURE based test run that succeeds'] +##teamcity[testFinished name='A TEST_CASE_FIXTURE based test run that succeeds' duration="{duration}"] ##teamcity[testStarted name='A TEST_CASE_METHOD based test run that fails'] ##teamcity[testFailed name='A TEST_CASE_METHOD based test run that fails' message='Class.tests.cpp:|n...............................................................................|n|nClass.tests.cpp:|nexpression failed|n REQUIRE( m_a == 2 )|nwith expansion:|n 1 == 2|n'] ##teamcity[testFinished name='A TEST_CASE_METHOD based test run that fails' duration="{duration}"] diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt index 6f7d8f199a..046917dc20 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -161,6 +161,11 @@ ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6' duration="{duration}"] +##teamcity[testStarted name='A TEST_CASE_FIXTURE based test run that fails'] +##teamcity[testFailed name='A TEST_CASE_FIXTURE based test run that fails' message='-------------------------------------------------------------------------------|nSecond partial run|n-------------------------------------------------------------------------------|nClass.tests.cpp:|n...............................................................................|n|nClass.tests.cpp:|nexpression failed|n REQUIRE( m_a == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFinished name='A TEST_CASE_FIXTURE based test run that fails' duration="{duration}"] +##teamcity[testStarted name='A TEST_CASE_FIXTURE based test run that succeeds'] +##teamcity[testFinished name='A TEST_CASE_FIXTURE based test run that succeeds' duration="{duration}"] ##teamcity[testStarted name='A TEST_CASE_METHOD based test run that fails'] ##teamcity[testFailed name='A TEST_CASE_METHOD based test run that fails' message='Class.tests.cpp:|n...............................................................................|n|nClass.tests.cpp:|nexpression failed|n REQUIRE( m_a == 2 )|nwith expansion:|n 1 == 2|n'] ##teamcity[testFinished name='A TEST_CASE_METHOD based test run that fails' duration="{duration}"] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index f8acf1d414..dffc0e617a 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -2034,6 +2034,56 @@ Nor would this + +
+ + + m_a++ == 0 + + + 0 == 0 + + + +
+
+ + + m_a == 0 + + + 1 == 0 + + + +
+ +
+ +
+ + + m_a++ == 0 + + + 0 == 0 + + + +
+
+ + + m_a == 1 + + + 1 == 1 + + + +
+ +
@@ -21832,6 +21882,6 @@ Approx( -1.95996398454005449 ) - - + + diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 5d815a511a..2dcd1b1cd3 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -2034,6 +2034,56 @@ Nor would this
+ +
+ + + m_a++ == 0 + + + 0 == 0 + + + +
+
+ + + m_a == 0 + + + 1 == 0 + + + +
+ +
+ +
+ + + m_a++ == 0 + + + 0 == 0 + + + +
+
+ + + m_a == 1 + + + 1 == 1 + + + +
+ +
@@ -21831,6 +21881,6 @@ Approx( -1.95996398454005449 ) - - + + diff --git a/tests/SelfTest/Baselines/xml.sw.unapproved.txt b/tests/SelfTest/Baselines/xml.sw.unapproved.txt new file mode 100644 index 0000000000..dffc0e617a --- /dev/null +++ b/tests/SelfTest/Baselines/xml.sw.unapproved.txt @@ -0,0 +1,21887 @@ + + + + + + + + + y.v == 0 + + + 0 == 0 + + + + + 0 == y.v + + + 0 == 0 + + + + + + + + t1 == t2 + + + {?} == {?} + + + + + t1 != t2 + + + {?} != {?} + + + + + t1 < t2 + + + {?} < {?} + + + + + t1 > t2 + + + {?} > {?} + + + + + t1 <= t2 + + + {?} <= {?} + + + + + t1 >= t2 + + + {?} >= {?} + + + + + + + + + + uarr := "123" + + + sarr := "456" + + + + std::memcmp(uarr, "123", sizeof(uarr)) == 0 + + + 0 == 0 + + + + uarr := "123" + + + sarr := "456" + + + + std::memcmp(sarr, "456", sizeof(sarr)) == 0 + + + 0 == 0 + + + + + + + + +
+ +
+ +
+ + + + h1 == h2 + + + [1403 helper] == [1403 helper] + + + + + + + +This info message starts with a linebreak + + + +This warning message starts with a linebreak + + + + + + 1514 + + + +This would not be caught previously + + +Nor would this + + + + + + + std::is_same<TypeList<int>, TypeList<int>>::value + + + true + + + + + + + + spec.matches(*fakeTestCase("spec . char")) + + + true + + + + + spec.matches(*fakeTestCase("spec , char")) + + + true + + + + + !(spec.matches(*fakeTestCase(R"(spec \, char)"))) + + + !false + + + + + +
+ + + spec.matches(*fakeTestCase(R"(spec {a} char)")) + + + true + + + + + spec.matches(*fakeTestCase(R"(spec [a] char)")) + + + true + + + + + !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) + + + !false + + + +
+
+ + + spec.matches(*fakeTestCase(R"(spec \ char)")) + + + true + + + +
+ +
+ + + + counter < 7 + + + 3 < 7 + + + + + counter < 7 + + + 6 < 7 + + + + + + + + i != j + + + 1 != 3 + + + + + i != j + + + 1 != 4 + + + + + i != j + + + 2 != 3 + + + + + i != j + + + 2 != 4 + + + + + +
+ +
+
+ + + m + + + 1 + + + +
+
+ + + m + + + 2 + + + +
+
+ + + m + + + 3 + + + +
+ +
+ +
+ + + 1 + + + 1 + + + +
+ + + m + + + 2 + + + + + m + + + 3 + + + +
+ + + + m + + + 1 + + + + + m + + + 2 + + + + + m + + + 3 + + + + + +
+ +
+ + i := 1 + + + j := 3 + + + k := 5 + +
+ +
+ + i := 1 + + + j := 3 + + + k := 6 + +
+ +
+ + i := 1 + + + j := 4 + + + k := 5 + + + i := 1 + + + j := 4 + + + k := 6 + +
+ +
+ + i := 2 + + + j := 3 + + + k := 5 + +
+ +
+ + i := 2 + + + j := 3 + + + k := 6 + +
+ +
+ + i := 2 + + + j := 4 + + + k := 5 + + + i := 2 + + + j := 4 + + + k := 6 + + +
+ + + + m + + + 1 + + + + + n + + + 1 + + + + + m + + + 1 + + + + + n + + + 2 + + + + + m + + + 1 + + + + + n + + + 3 + + + + + m + + + 2 + + + + + n + + + 1 + + + + + m + + + 2 + + + + + n + + + 2 + + + + + m + + + 2 + + + + + n + + + 3 + + + + + m + + + 3 + + + + + n + + + 1 + + + + + m + + + 3 + + + + + n + + + 2 + + + + + m + + + 3 + + + + + n + + + 3 + + + + + + + + + + + + + + + + + smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) + + + 0.0 is within 2 ULPs of -4.9406564584124654e-324 ([-1.4821969375237396e-323, 4.9406564584124654e-324]) + + + + + smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) + + + 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e-324, -0.0000000000000000e+00]) + + + + + + + + smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) + + + 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) + + + + + smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) + + + 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) + + + + + + + failure to init + + + + +
+ + answer := 42 + + + expected exception + + +
+
+ + answer := 42 + + + + thisThrows() + + + thisThrows() + + + expected exception + + + +
+
+ + answer := 42 + + + + thisThrows() + + + thisThrows() + + + +
+ +
+ + + + 42 == f + + + 42 == {?} + + + + + + + + a == t + + + 3 == 3 + + + + + a == t + + + 3 == 3 + + + + + throws_int(true) + + + throws_int(true) + + + + + throws_int(true), int + + + throws_int(true), int + + + + + throws_int(false) + + + throws_int(false) + + + + + "aaa", Catch::Matchers::EndsWith("aaa") + + + "aaa" ends with: "aaa" + + + + + templated_tests<int>(3) + + + true + + + + + + + + f() == 0 + + + 1 == 0 + + + + + errno_after == 1 + + + 1 == 1 + + + + + + + dummy := 0 + + + + x == 4 + + + {?} == 4 + + + + + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ + + + false != false + + + false != false + + + + + true != true + + + true != true + + + + + !true + + + false + + + + + !(true) + + + !true + + + + + !trueValue + + + false + + + + + !(trueValue) + + + !true + + + + + !(1 == 1) + + + false + + + + + !(1 == 1) + + + !(1 == 1) + + + + + + + + false == false + + + false == false + + + + + true == true + + + true == true + + + + + !false + + + true + + + + + !(false) + + + !false + + + + + !falseValue + + + true + + + + + !(falseValue) + + + !false + + + + + !(1 == 2) + + + true + + + + + !(1 == 2) + + + !(1 == 2) + + + + + +
+ + + is_true<true>::value == true + + + true == true + + + + + true == is_true<true>::value + + + true == true + + + +
+
+ + + is_true<false>::value == false + + + false == false + + + + + false == is_true<false>::value + + + false == false + + + +
+
+ + + !is_true<false>::value + + + true + + + +
+
+ + + !!is_true<true>::value + + + true + + + +
+
+ + + is_true<true>::value + + + true + + + + + !(is_true<false>::value) + + + !false + + + +
+ +
+ + + + x < y + + + 1 < 4 + + + + + y < z + + + 4 < 7 + + + + + x < z + + + 1 < 7 + + + + + x < y + + + 1 < 4 + + + + + y < z + + + 4 < 8 + + + + + x < z + + + 1 < 8 + + + + + x < y + + + 1 < 4 + + + + + y < z + + + 4 < 9 + + + + + x < z + + + 1 < 9 + + + + + x < y + + + 1 < 5 + + + + + y < z + + + 5 < 7 + + + + + x < z + + + 1 < 7 + + + + + x < y + + + 1 < 5 + + + + + y < z + + + 5 < 8 + + + + + x < z + + + 1 < 8 + + + + + x < y + + + 1 < 5 + + + + + y < z + + + 5 < 9 + + + + + x < z + + + 1 < 9 + + + + + x < y + + + 1 < 6 + + + + + y < z + + + 6 < 7 + + + + + x < z + + + 1 < 7 + + + + + x < y + + + 1 < 6 + + + + + y < z + + + 6 < 8 + + + + + x < z + + + 1 < 8 + + + + + x < y + + + 1 < 6 + + + + + y < z + + + 6 < 9 + + + + + x < z + + + 1 < 9 + + + + + x < y + + + 2 < 4 + + + + + y < z + + + 4 < 7 + + + + + x < z + + + 2 < 7 + + + + + x < y + + + 2 < 4 + + + + + y < z + + + 4 < 8 + + + + + x < z + + + 2 < 8 + + + + + x < y + + + 2 < 4 + + + + + y < z + + + 4 < 9 + + + + + x < z + + + 2 < 9 + + + + + x < y + + + 2 < 5 + + + + + y < z + + + 5 < 7 + + + + + x < z + + + 2 < 7 + + + + + x < y + + + 2 < 5 + + + + + y < z + + + 5 < 8 + + + + + x < z + + + 2 < 8 + + + + + x < y + + + 2 < 5 + + + + + y < z + + + 5 < 9 + + + + + x < z + + + 2 < 9 + + + + + x < y + + + 2 < 6 + + + + + y < z + + + 6 < 7 + + + + + x < z + + + 2 < 7 + + + + + x < y + + + 2 < 6 + + + + + y < z + + + 6 < 8 + + + + + x < z + + + 2 < 8 + + + + + x < y + + + 2 < 6 + + + + + y < z + + + 6 < 9 + + + + + x < z + + + 2 < 9 + + + + + x < y + + + 3 < 4 + + + + + y < z + + + 4 < 7 + + + + + x < z + + + 3 < 7 + + + + + x < y + + + 3 < 4 + + + + + y < z + + + 4 < 8 + + + + + x < z + + + 3 < 8 + + + + + x < y + + + 3 < 4 + + + + + y < z + + + 4 < 9 + + + + + x < z + + + 3 < 9 + + + + + x < y + + + 3 < 5 + + + + + y < z + + + 5 < 7 + + + + + x < z + + + 3 < 7 + + + + + x < y + + + 3 < 5 + + + + + y < z + + + 5 < 8 + + + + + x < z + + + 3 < 8 + + + + + x < y + + + 3 < 5 + + + + + y < z + + + 5 < 9 + + + + + x < z + + + 3 < 9 + + + + + x < y + + + 3 < 6 + + + + + y < z + + + 6 < 7 + + + + + x < z + + + 3 < 7 + + + + + x < y + + + 3 < 6 + + + + + y < z + + + 6 < 8 + + + + + x < z + + + 3 < 8 + + + + + x < y + + + 3 < 6 + + + + + y < z + + + 6 < 9 + + + + + x < z + + + 3 < 9 + + + + + + + + s == "world" + + + "hello" == "world" + + + + + + + + s == "hello" + + + "hello" == "hello" + + + + + + + + Template_Fixture_2<TestType>::m_a.size() == 1 + + + 0 == 1 + + + + + + + + Template_Fixture_2<TestType>::m_a.size() == 1 + + + 0 == 1 + + + + + + + + Template_Fixture_2<TestType>::m_a.size() == 1 + + + 0 == 1 + + + + + + + + Template_Fixture_2<TestType>::m_a.size() == 1 + + + 0 == 1 + + + + + + + + Template_Fixture_2<TestType>::m_a.size() == 0 + + + 0 == 0 + + + + + + + + Template_Fixture_2<TestType>::m_a.size() == 0 + + + 0 == 0 + + + + + + + + Template_Fixture_2<TestType>::m_a.size() == 0 + + + 0 == 0 + + + + + + + + Template_Fixture_2<TestType>::m_a.size() == 0 + + + 0 == 0 + + + + + + + + Template_Fixture_2<TestType>{}.m_a.size() < 2 + + + 6 < 2 + + + + + + + + Template_Fixture_2<TestType>{}.m_a.size() < 2 + + + 2 < 2 + + + + + + + + Template_Fixture_2<TestType>{}.m_a.size() < 2 + + + 6 < 2 + + + + + + + + Template_Fixture_2<TestType>{}.m_a.size() < 2 + + + 2 < 2 + + + + + + + + Template_Fixture_2<TestType>{}.m_a.size() >= 2 + + + 6 >= 2 + + + + + + + + Template_Fixture_2<TestType>{}.m_a.size() >= 2 + + + 2 >= 2 + + + + + + + + Template_Fixture_2<TestType>{}.m_a.size() >= 2 + + + 6 >= 2 + + + + + + + + Template_Fixture_2<TestType>{}.m_a.size() >= 2 + + + 2 >= 2 + + + + + + + + Template_Fixture<TestType>::m_a == 2 + + + 1.0 == 2 + + + + + + + + Template_Fixture<TestType>::m_a == 2 + + + 1.0f == 2 + + + + + + + + Template_Fixture<TestType>::m_a == 2 + + + 1 == 2 + + + + + + + + Template_Fixture<TestType>::m_a == 1 + + + 1.0 == 1 + + + + + + + + Template_Fixture<TestType>::m_a == 1 + + + 1.0f == 1 + + + + + + + + Template_Fixture<TestType>::m_a == 1 + + + 1 == 1 + + + + + + + + Nttp_Fixture<V>::value == 0 + + + 1 == 0 + + + + + + + + Nttp_Fixture<V>::value == 0 + + + 3 == 0 + + + + + + + + Nttp_Fixture<V>::value == 0 + + + 6 == 0 + + + + + + + + Nttp_Fixture<V>::value > 0 + + + 1 > 0 + + + + + + + + Nttp_Fixture<V>::value > 0 + + + 3 > 0 + + + + + + + + Nttp_Fixture<V>::value > 0 + + + 6 > 0 + + + + + +
+ + + m_a++ == 0 + + + 0 == 0 + + + +
+
+ + + m_a == 0 + + + 1 == 0 + + + +
+ +
+ +
+ + + m_a++ == 0 + + + 0 == 0 + + + +
+
+ + + m_a == 1 + + + 1 == 1 + + + +
+ +
+ + + + m_a == 2 + + + 1 == 2 + + + + + + + + m_a == 1 + + + 1 == 1 + + + + + + + + x.size() == 0 + + + 0 == 0 + + + + + + + + x.size() == 0 + + + 0 == 0 + + + + + + + + x.size() == 0 + + + 0 == 0 + + + + + + + + x.size() == 0 + + + 0 == 0 + + + + + + + + x.size() > 0 + + + 42 > 0 + + + + + + + + x.size() > 0 + + + 9 > 0 + + + + + + + + x.size() > 0 + + + 42 > 0 + + + + + + + + x.size() > 0 + + + 9 > 0 + + + + + + + + d == 1.23_a + + + 1.22999999999999998 +== +Approx( 1.22999999999999998 ) + + + + + d != 1.22_a + + + 1.22999999999999998 +!= +Approx( 1.21999999999999997 ) + + + + + -d == -1.23_a + + + -1.22999999999999998 +== +Approx( -1.22999999999999998 ) + + + + + d == 1.2_a .epsilon(.1) + + + 1.22999999999999998 +== +Approx( 1.19999999999999996 ) + + + + + d != 1.2_a .epsilon(.001) + + + 1.22999999999999998 +!= +Approx( 1.19999999999999996 ) + + + + + d == 1_a .epsilon(.3) + + + 1.22999999999999998 == Approx( 1.0 ) + + + + + +
+
+ +
+ +
+ + to infinity and beyond + + +
+ + + + &o1 == &o2 + + + 0x == 0x + + + + + o1 == o2 + + + {?} == {?} + + + + + + + + 104.0 != Approx(100.0) + + + 104.0 != Approx( 100.0 ) + + + + + 104.0 == Approx(100.0).margin(5) + + + 104.0 == Approx( 100.0 ) + + + + + 104.0 == Approx(100.0).margin(4) + + + 104.0 == Approx( 100.0 ) + + + + + 104.0 != Approx(100.0).margin(3) + + + 104.0 != Approx( 100.0 ) + + + + + 100.3 != Approx(100.0) + + + 100.29999999999999716 != Approx( 100.0 ) + + + + + 100.3 == Approx(100.0).margin(0.5) + + + 100.29999999999999716 == Approx( 100.0 ) + + + + + + + + + + + i++ == 7 + + + 7 == 7 + + + + + i++ == 8 + + + 8 == 8 + + + + + + + + 1 == 1 + + + 1 == 1 + + + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + unexpected exception + + + + + + + + + + + Approx(0).margin(0) + + + Approx(0).margin(0) + + + + + Approx(0).margin(1234656) + + + Approx(0).margin(1234656) + + + + + Approx(0).margin(-2), std::domain_error + + + Approx(0).margin(-2), std::domain_error + + + + + Approx(0).epsilon(0) + + + Approx(0).epsilon(0) + + + + + Approx(0).epsilon(1) + + + Approx(0).epsilon(1) + + + + + Approx(0).epsilon(-0.001), std::domain_error + + + Approx(0).epsilon(-0.001), std::domain_error + + + + + Approx(0).epsilon(1.0001), std::domain_error + + + Approx(0).epsilon(1.0001), std::domain_error + + + + + + + + 0.25f == Approx(0.0f).margin(0.25f) + + + 0.25f == Approx( 0.0 ) + + + + + 0.0f == Approx(0.25f).margin(0.25f) + + + 0.0f == Approx( 0.25 ) + + + + + 0.5f == Approx(0.25f).margin(0.25f) + + + 0.5f == Approx( 0.25 ) + + + + + 245.0f == Approx(245.25f).margin(0.25f) + + + 245.0f == Approx( 245.25 ) + + + + + 245.5f == Approx(245.25f).margin(0.25f) + + + 245.5f == Approx( 245.25 ) + + + + + + + + divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) + + + 3.14285714285714279 +== +Approx( 3.14100000000000001 ) + + + + + divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) + + + 3.14285714285714279 +!= +Approx( 3.14100000000000001 ) + + + + + + + + d != Approx( 1.231 ) + + + 1.22999999999999998 +!= +Approx( 1.23100000000000009 ) + + + + + d == Approx( 1.231 ).epsilon( 0.1 ) + + + 1.22999999999999998 +== +Approx( 1.23100000000000009 ) + + + + + + + + 1.23f == Approx( 1.23f ) + + + 1.230000019f +== +Approx( 1.23000001907348633 ) + + + + + 0.0f == Approx( 0.0f ) + + + 0.0f == Approx( 0.0 ) + + + + + + + + 1 == Approx( 1 ) + + + 1 == Approx( 1.0 ) + + + + + 0 == Approx( 0 ) + + + 0 == Approx( 0.0 ) + + + + + + + + 1.0f == Approx( 1 ) + + + 1.0f == Approx( 1.0 ) + + + + + 0 == Approx( dZero) + + + 0 == Approx( 0.0 ) + + + + + 0 == Approx( dSmall ).margin( 0.001 ) + + + 0 == Approx( 0.00001 ) + + + + + 1.234f == Approx( dMedium ) + + + 1.233999968f +== +Approx( 1.23399999999999999 ) + + + + + dMedium == Approx( 1.234f ) + + + 1.23399999999999999 +== +Approx( 1.23399996757507324 ) + + + + + +
+ + + 1, Predicate<int>( alwaysTrue, "always true" ) + + + 1 matches predicate: "always true" + + + + + 1, !Predicate<int>( alwaysFalse, "always false" ) + + + 1 not matches predicate: "always false" + + + +
+
+ + + "Hello olleH", Predicate<std::string>( []( std::string const& str ) -> bool { return str.front() == str.back(); }, "First and last character should be equal" ) + + + "Hello olleH" matches predicate: "First and last character should be equal" + + + + + "This wouldn't pass", !Predicate<std::string>( []( std::string const& str ) -> bool { return str.front() == str.back(); } ) + + + "This wouldn't pass" not matches undescribed predicate + + + +
+ +
+ + + + lhs | rhs + + + Val: 1 | Val: 2 + + + + + !(lhs & rhs) + + + !(Val: 1 & Val: 2) + + + + + HasBitOperators{ 1 } & HasBitOperators{ 1 } + + + Val: 1 & Val: 1 + + + + + lhs ^ rhs + + + Val: 1 ^ Val: 2 + + + + + !(lhs ^ lhs) + + + !(Val: 1 ^ Val: 1) + + + + + + + + true + + + true + + +
+ + + true + + + true + + +
+ + + true + + + true + + + +
+ +
+ + + true + + + true + + +
+ + + true + + + true + + +
+ + + true + + + true + + + +
+ +
+ +
+ +
+ + + a, Contains(1) + + + { 1, 2, 3 } contains element 1 + + + + + b, Contains(1) + + + { 0, 1, 2 } contains element 1 + + + + + c, !Contains(1) + + + { 4, 5, 6 } not contains element 1 + + + +
+
+ + + a, Contains(0, close_enough) + + + { 1, 2, 3 } contains element 0 + + + + + b, Contains(0, close_enough) + + + { 0, 1, 2 } contains element 0 + + + + + c, !Contains(0, close_enough) + + + { 4, 5, 6 } not contains element 0 + + + +
+
+ + + a, Contains(4, [](auto&& lhs, size_t sz) { return lhs.size() == sz; }) + + + { "abc", "abcd", "abcde" } contains element 4 + + + +
+
+ + + in, Contains(1) + + + { 1, 2, 3, 4, 5 } contains element 1 + + + + + in, !Contains(8) + + + { 1, 2, 3, 4, 5 } not contains element 8 + + + +
+
+ + + in, Contains(MoveOnlyTestElement{ 2 }) + + + { 1, 2, 3 } contains element 2 + + + + + in, !Contains(MoveOnlyTestElement{ 9 }) + + + { 1, 2, 3 } not contains element 9 + + + +
+
+ + + in, Contains(Catch::Matchers::WithinAbs(0.5, 0.5)) + + + { 1.0, 2.0, 3.0, 0.0 } contains element matching is within 0.5 of 0.5 + + + +
+ +
+ +
+ + + empty_array, IsEmpty() + + + { } is empty + + + + + non_empty_array, !IsEmpty() + + + { 0.0 } not is empty + + + + + empty_vec, IsEmpty() + + + { } is empty + + + + + non_empty_vec, !IsEmpty() + + + { 'a', 'b', 'c' } not is empty + + + + + inner_lists_are_empty, !IsEmpty() + + + { { } } not is empty + + + + + inner_lists_are_empty.front(), IsEmpty() + + + { } is empty + + + +
+
+ + + has_empty{}, !IsEmpty() + + + {?} not is empty + + + +
+
+ + + unrelated::ADL_empty{}, IsEmpty() + + + {?} is empty + + + +
+ +
+ + + a := 1 + + + b := 2 + + + c := 3 + + + a + b := 3 + + + a+b := 3 + + + c > b := true + + + a == 1 := true + + + + + + custom_index_op<int>{1, 2, 3}[0, 1, 2] := 0 + + + custom_index_op<int>{1, 2, 3}[(0, 1)] := 0 + + + custom_index_op<int>{1, 2, 3}[0] := 0 + + + (helper_1436<int, int>{12, -12}) := { 12, -12 } + + + (helper_1436<int, int>(-12, 12)) := { -12, 12 } + + + (1, 2) := 2 + + + (2, 3) := 3 + + + + + + ("comma, in string", "escaped, \", ") := "escaped, ", " + + + "single quote in string,'," := "single quote in string,'," + + + "some escapes, \\,\\\\" := "some escapes, \,\\" + + + "some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<" + + + '"' := '"' + + + '\'' := ''' + + + ',' := ',' + + + '}' := '}' + + + ')' := ')' + + + '(' := '(' + + + '{' := '{' + + + + +
+ + i := 2 + + + + true + + + true + + + +
+
+ + 3 + + + + true + + + true + + + +
+ +
+ +
+ + + eq( "", "" ) + + + true + + + + + !(eq( "", "a" )) + + + !false + + + +
+
+ + + eq( "a", "a" ) + + + true + + + + + eq( "a", "A" ) + + + true + + + + + eq( "A", "a" ) + + + true + + + + + eq( "A", "A" ) + + + true + + + + + !(eq( "a", "b" )) + + + !false + + + + + !(eq( "a", "B" )) + + + !false + + + +
+ +
+ +
+ + + lt( "", "a" ) + + + true + + + + + !(lt( "a", "a" )) + + + !false + + + + + !(lt( "", "" )) + + + !false + + + +
+
+ + + lt( "a", "b" ) + + + true + + + + + lt( "a", "B" ) + + + true + + + + + lt( "A", "b" ) + + + true + + + + + lt( "A", "B" ) + + + true + + + +
+ +
+ +
+ + + ::Catch::Detail::stringify('\t') == "'\\t'" + + + "'\t'" == "'\t'" + + + + + ::Catch::Detail::stringify('\n') == "'\\n'" + + + "'\n'" == "'\n'" + + + + + ::Catch::Detail::stringify('\r') == "'\\r'" + + + "'\r'" == "'\r'" + + + + + ::Catch::Detail::stringify('\f') == "'\\f'" + + + "'\f'" == "'\f'" + + + +
+
+ + + ::Catch::Detail::stringify( ' ' ) == "' '" + + + "' '" == "' '" + + + + + ::Catch::Detail::stringify( 'A' ) == "'A'" + + + "'A'" == "'A'" + + + + + ::Catch::Detail::stringify( 'z' ) == "'z'" + + + "'z'" == "'z'" + + + +
+
+ + + ::Catch::Detail::stringify( '\0' ) == "0" + + + "0" == "0" + + + + + ::Catch::Detail::stringify( static_cast<char>(2) ) == "2" + + + "2" == "2" + + + + + ::Catch::Detail::stringify( static_cast<char>(5) ) == "5" + + + "5" == "5" + + + +
+ +
+ + + + name.empty() + + + true + + + + + name == "foo" + + + "foo" == "foo" + + + + + +
+ + + !(parse_result) + + + !{?} + + + +
+
+ + + parse_result + + + {?} + + + + + res == std::vector<std::string>{ "aaa", "bbb" } + + + { "aaa", "bbb" } == { "aaa", "bbb" } + + + +
+ +
+ +
+ + + streamWrapper.str().empty() + + + true + + + +
+
+ + + streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3\n" + + + "1 +Using code: 2 +2 +Using code: 0 +3 +" +== +"1 +Using code: 2 +2 +Using code: 0 +3 +" + + + +
+
+ + + streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" + + + "Using code: 2 +A +B +Using code: 0 +C +" +== +"Using code: 2 +A +B +Using code: 0 +C +" + + + +
+ +
+ + + + 1, ( MatcherA() && MatcherB() ) && MatcherC() + + + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) + + + + + 1, MatcherA() && ( MatcherB() && MatcherC() ) + + + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) + + + + + 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) + + + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) + + + + + + + + 1, ( MatcherA() || MatcherB() ) || MatcherC() + + + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) + + + + + 1, MatcherA() || ( MatcherB() || MatcherC() ) + + + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) + + + + + 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) + + + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) + + + + + + + + 0, !MatcherA() + + + 0 not equals: (int) 1 or (string) "1" + + + + + 1, !!MatcherA() + + + 1 equals: (int) 1 or (string) "1" + + + + + 0, !!!MatcherA() + + + 0 not equals: (int) 1 or (string) "1" + + + + + 1, !!!!MatcherA() + + + 1 equals: (int) 1 or (string) "1" + + + + + + + + + + + 1, MatcherA() || MatcherB() + + + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) + + + + + 1, MatcherA() && MatcherB() + + + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) + + + + + 1, MatcherA() || !MatcherB() + + + 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) + + + + + + + + vec, Predicate<std::vector<int>>( []( auto const& v ) { return std::all_of( v.begin(), v.end(), []( int elem ) { return elem % 2 == 1; } ); }, "All elements are odd" ) && !EqualsRange( a ) + + + { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) + + + + + str, StartsWith( "foo" ) && EqualsRange( arr ) && EndsWith( "bar" ) + + + "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) + + + + + str, StartsWith( "foo" ) && !EqualsRange( bad_arr ) && EndsWith( "bar" ) + + + "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and ends with: "bar" ) + + + + + str, EqualsRange( arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) + + + "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) + + + + + str, !EqualsRange( bad_arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) + + + "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) + + + + + str, EqualsRange( bad_arr ) || ( StartsWith( "foo" ) && EndsWith( "bar" ) ) + + + "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" and ends with: "bar" ) ) + + + + + str, ( StartsWith( "foo" ) && EndsWith( "bar" ) ) || EqualsRange( bad_arr ) + + + "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) + + + + + + + + container, EqualsRange( a ) || EqualsRange( b ) || EqualsRange( c ) + + + { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) + + + + + + + + std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} + + + std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} + + + + + std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} + + + std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} + + + + + std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} + + + std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} + + + + + std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} + + + std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} + + + + + std::vector<int>{1, 2} == std::vector<int>{1, 2} + + + { 1, 2 } == { 1, 2 } + + + + + std::vector<int>{1, 2} == std::vector<int>{1, 2} + + + { 1, 2 } == { 1, 2 } + + + + + !(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3}) + + + !({ 1, 2 } == { 1, 2, 3 }) + + + + + !(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3}) + + + !({ 1, 2 } == { 1, 2, 3 }) + + + + + std::vector<int>{1, 2} == std::vector<int>{1, 2} + + + { 1, 2 } == { 1, 2 } + + + + + std::vector<int>{1, 2} == std::vector<int>{1, 2} + + + { 1, 2 } == { 1, 2 } + + + + + true + + + true + + + + + std::vector<int>{1, 2} == std::vector<int>{1, 2} + + + { 1, 2 } == { 1, 2 } + + + + + + + + a + + + 0x + + + + + a == &foo + + + 0x == 0x + + + + + + + + SimplePcg32{} == SimplePcg32{} + + + {?} == {?} + + + + + SimplePcg32{ 0 } != SimplePcg32{} + + + {?} != {?} + + + + + !(SimplePcg32{ 1 } == SimplePcg32{ 2 }) + + + !({?} == {?}) + + + + + !(SimplePcg32{ 1 } != SimplePcg32{ 1 }) + + + !({?} != {?}) + + + + + + + + td == Approx(10.0) + + + StrongDoubleTypedef(10) == Approx( 10.0 ) + + + + + Approx(10.0) == td + + + Approx( 10.0 ) == StrongDoubleTypedef(10) + + + + + td != Approx(11.0) + + + StrongDoubleTypedef(10) != Approx( 11.0 ) + + + + + Approx(11.0) != td + + + Approx( 11.0 ) != StrongDoubleTypedef(10) + + + + + td <= Approx(10.0) + + + StrongDoubleTypedef(10) <= Approx( 10.0 ) + + + + + td <= Approx(11.0) + + + StrongDoubleTypedef(10) <= Approx( 11.0 ) + + + + + Approx(10.0) <= td + + + Approx( 10.0 ) <= StrongDoubleTypedef(10) + + + + + Approx(9.0) <= td + + + Approx( 9.0 ) <= StrongDoubleTypedef(10) + + + + + td >= Approx(9.0) + + + StrongDoubleTypedef(10) >= Approx( 9.0 ) + + + + + td >= Approx(td) + + + StrongDoubleTypedef(10) >= Approx( 10.0 ) + + + + + Approx(td) >= td + + + Approx( 10.0 ) >= StrongDoubleTypedef(10) + + + + + Approx(11.0) >= td + + + Approx( 11.0 ) >= StrongDoubleTypedef(10) + + + + + + + + 54 == 6*9 + + + 54 == 54 + + + + + + + + ( -1 > 2u ) + + + true + + + + + -1 > 2u + + + -1 > 2 + + + + + ( 2u < -1 ) + + + true + + + + + 2u < -1 + + + 2 < -1 + + + + + ( minInt > 2u ) + + + true + + + + + minInt > 2u + + + -2147483648 > 2 + + + + + + + + i == 1 + + + 1 == 1 + + + + + ui == 2 + + + 2 == 2 + + + + + l == 3 + + + 3 == 3 + + + + + ul == 4 + + + 4 == 4 + + + + + c == 5 + + + 5 == 5 + + + + + uc == 6 + + + 6 == 6 + + + + + 1 == i + + + 1 == 1 + + + + + 2 == ui + + + 2 == 2 + + + + + 3 == l + + + 3 == 3 + + + + + 4 == ul + + + 4 == 4 + + + + + 5 == c + + + 5 == 5 + + + + + 6 == uc + + + 6 == 6 + + + + + (std::numeric_limits<uint32_t>::max)() > ul + + + 4294967295 (0x) > 4 + + + + + +
+ + + !(matcher.match( 1 )) + + + !false + + + + + first.matchCalled + + + true + + + + + !second.matchCalled + + + true + + + +
+
+ + + matcher.match( 1 ) + + + true + + + + + first.matchCalled + + + true + + + + + !second.matchCalled + + + true + + + +
+ +
+ +
+ + + !(matcher.match( 1 )) + + + !false + + + + + first.matchCalled + + + true + + + + + !second.matchCalled + + + true + + + +
+
+ + + matcher.match( 1 ) + + + true + + + + + first.matchCalled + + + true + + + + + !second.matchCalled + + + true + + + +
+ +
+ + + + testStringForMatching(), ContainsSubstring( "not there", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" contains: "not there" (case insensitive) + + + + + testStringForMatching(), ContainsSubstring( "STRING" ) + + + "this string contains 'abc' as a substring" contains: "STRING" + + + + + +
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + elem % 2 == 1 + + + 1 == 1 + + + +
+
+ + + call_count == 1 + + + 1 == 1 + + + + + make_data().size() == test_count + + + 6 == 6 + + + +
+ +
+ + + + Catch::makeStream( "-" )->isConsole() + + + true + + + + + + + + throwCustom() + + + throwCustom() + + + custom exception - not std + + + + + + + + throwCustom(), std::exception + + + throwCustom(), std::exception + + + custom exception - not std + + + + + + + custom std exception + + + + + + + 101.000001 != Approx(100).epsilon(0.01) + + + 101.00000099999999748 != Approx( 100.0 ) + + + + + std::pow(10, -5) != Approx(std::pow(10, -7)) + + + 0.00001 != Approx( 0.0000001 ) + + + + + + + + enumInfo->lookup(0) == "Value1" + + + Value1 == "Value1" + + + + + enumInfo->lookup(1) == "Value2" + + + Value2 == "Value2" + + + + + enumInfo->lookup(3) == "{** unexpected enum value **}" + + + {** unexpected enum value **} +== +"{** unexpected enum value **}" + + + + + + + This generator is empty + + + + + + + Catch::makeStream( "" )->isConsole() + + + true + + + + + + + + testStringForMatching(), EndsWith( "Substring" ) + + + "this string contains 'abc' as a substring" ends with: "Substring" + + + + + testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" ends with: "this" (case insensitive) + + + + + + + + stringify( EnumClass3::Value1 ) == "Value1" + + + "Value1" == "Value1" + + + + + stringify( EnumClass3::Value2 ) == "Value2" + + + "Value2" == "Value2" + + + + + stringify( EnumClass3::Value3 ) == "Value3" + + + "Value3" == "Value3" + + + + + stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" + + + "{** unexpected enum value **}" +== +"{** unexpected enum value **}" + + + + + stringify( ec3 ) == "Value2" + + + "Value2" == "Value2" + + + + + + + + stringify( Bikeshed::Colours::Red ) == "Red" + + + "Red" == "Red" + + + + + stringify( Bikeshed::Colours::Blue ) == "Blue" + + + "Blue" == "Blue" + + + + + + + + 101.01 != Approx(100).epsilon(0.01) + + + 101.01000000000000512 != Approx( 100.0 ) + + + + + + + + data.int_seven == 6 + + + 7 == 6 + + + + + data.int_seven == 8 + + + 7 == 8 + + + + + data.int_seven == 0 + + + 7 == 0 + + + + + data.float_nine_point_one == Approx( 9.11f ) + + + 9.100000381f +== +Approx( 9.10999965667724609 ) + + + + + data.float_nine_point_one == Approx( 9.0f ) + + + 9.100000381f == Approx( 9.0 ) + + + + + data.float_nine_point_one == Approx( 1 ) + + + 9.100000381f == Approx( 1.0 ) + + + + + data.float_nine_point_one == Approx( 0 ) + + + 9.100000381f == Approx( 0.0 ) + + + + + data.double_pi == Approx( 3.1415 ) + + + 3.14159265350000005 +== +Approx( 3.14150000000000018 ) + + + + + data.str_hello == "goodbye" + + + "hello" == "goodbye" + + + + + data.str_hello == "hell" + + + "hello" == "hell" + + + + + data.str_hello == "hello1" + + + "hello" == "hello1" + + + + + data.str_hello.size() == 6 + + + 5 == 6 + + + + + x == Approx( 1.301 ) + + + 1.30000000000000027 +== +Approx( 1.30099999999999993 ) + + + + + + + + data.int_seven == 7 + + + 7 == 7 + + + + + data.float_nine_point_one == Approx( 9.1f ) + + + 9.100000381f +== +Approx( 9.10000038146972656 ) + + + + + data.double_pi == Approx( 3.1415926535 ) + + + 3.14159265350000005 +== +Approx( 3.14159265350000005 ) + + + + + data.str_hello == "hello" + + + "hello" == "hello" + + + + + "hello" == data.str_hello + + + "hello" == "hello" + + + + + data.str_hello.size() == 5 + + + 5 == 5 + + + + + x == Approx( 1.3 ) + + + 1.30000000000000027 +== +Approx( 1.30000000000000004 ) + + + + + + + + testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) + + + "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" + + + + + testStringForMatching(), Equals( "this string contains 'ABC' as a substring", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive) + + + + + + + + testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) + + + "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" + + + + + testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" equals: "something else" (case insensitive) + + + + + + + + ::Catch::Detail::stringify(WhatException{}) == "This exception has overridden what() method" + + + "This exception has overridden what() method" +== +"This exception has overridden what() method" + + + + + ::Catch::Detail::stringify(OperatorException{}) == "OperatorException" + + + "OperatorException" == "OperatorException" + + + + + ::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException" + + + "StringMakerException" +== +"StringMakerException" + + + + + +
+ + + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } + + + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } + + + + + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } + + + doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } + + + +
+
+ + + throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } + + + throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } + + + Unknown exception + + + + + throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } + + + throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } + + + Unknown exception + + + +
+
+ + + throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } + + + SpecialException::what special exception has value of 1 + + + + + throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } + + + SpecialException::what special exception has value of 1 + + + +
+ +
+ + + + throwsSpecialException( 1 ), SpecialException, ExceptionMatcher{ 1 } + + + SpecialException::what special exception has value of 1 + + + + + throwsSpecialException( 2 ), SpecialException, ExceptionMatcher{ 2 } + + + SpecialException::what special exception has value of 2 + + + + + + + + throwsDerivedException(), DerivedException, MessageMatches( StartsWith( "Derived" ) ) + + + DerivedException::what matches "starts with: "Derived"" + + + + + throwsDerivedException(), DerivedException, MessageMatches( EndsWith( "::what" ) ) + + + DerivedException::what matches "ends with: "::what"" + + + + + throwsDerivedException(), DerivedException, MessageMatches( !StartsWith( "::what" ) ) + + + DerivedException::what matches "not starts with: "::what"" + + + + + throwsSpecialException( 2 ), SpecialException, MessageMatches( StartsWith( "Special" ) ) + + + SpecialException::what matches "starts with: "Special"" + + + + + +
+ + + thisThrows(), "expected exception" + + + "expected exception" equals: "expected exception" + + + +
+
+ + + thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) + + + "expected exception" equals: "expected exception" (case insensitive) + + + +
+
+ + + thisThrows(), StartsWith( "expected" ) + + + "expected exception" starts with: "expected" + + + + + thisThrows(), EndsWith( "exception" ) + + + "expected exception" ends with: "exception" + + + + + thisThrows(), ContainsSubstring( "except" ) + + + "expected exception" contains: "except" + + + + + thisThrows(), ContainsSubstring( "exCept", Catch::CaseSensitive::No ) + + + "expected exception" contains: "except" (case insensitive) + + + +
+ +
+ + + + throwsDerivedException(), DerivedException, Message( "DerivedException::what" ) + + + DerivedException::what exception message matches "DerivedException::what" + + + + + throwsDerivedException(), DerivedException, !Message( "derivedexception::what" ) + + + DerivedException::what not exception message matches "derivedexception::what" + + + + + throwsSpecialException( 2 ), SpecialException, !Message( "DerivedException::what" ) + + + SpecialException::what not exception message matches "DerivedException::what" + + + + + throwsSpecialException( 2 ), SpecialException, Message( "SpecialException::what" ) + + + SpecialException::what exception message matches "SpecialException::what" + + + + + + + + thisThrows(), std::string + + + thisThrows(), std::string + + + expected exception + + + + + thisDoesntThrow(), std::domain_error + + + thisDoesntThrow(), std::domain_error + + + + + thisThrows() + + + thisThrows() + + + expected exception + + + + + + + This is a failure + + + + + + + + + + This is a failure + + + This message appears in the output + + + + + + + Factorial(0) == 1 + + + 1 == 1 + + + + + Factorial(1) == 1 + + + 1 == 1 + + + + + Factorial(2) == 2 + + + 2 == 2 + + + + + Factorial(3) == 6 + + + 6 == 6 + + + + + Factorial(10) == 3628800 + + + 3628800 (0x) == 3628800 (0x) + + + + + + + + filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException + + + filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException + + + + + +
+ + + 10., WithinRel( 11.1, 0.1 ) + + + 10.0 and 11.09999999999999964 are within 10% of each other + + + + + 10., !WithinRel( 11.2, 0.1 ) + + + 10.0 not and 11.19999999999999929 are within 10% of each other + + + + + 1., !WithinRel( 0., 0.99 ) + + + 1.0 not and 0.0 are within 99% of each other + + + + + -0., WithinRel( 0. ) + + + -0.0 and 0.0 are within 2.22045e-12% of each other + + +
+ + + v1, WithinRel( v2 ) + + + 0.0 and 0.0 are within 2.22045e-12% of each other + + + +
+ +
+
+ + + 1., WithinAbs( 1., 0 ) + + + 1.0 is within 0.0 of 1.0 + + + + + 0., WithinAbs( 1., 1 ) + + + 0.0 is within 1.0 of 1.0 + + + + + 0., !WithinAbs( 1., 0.99 ) + + + 0.0 not is within 0.98999999999999999 of 1.0 + + + + + 0., !WithinAbs( 1., 0.99 ) + + + 0.0 not is within 0.98999999999999999 of 1.0 + + + + + 11., !WithinAbs( 10., 0.5 ) + + + 11.0 not is within 0.5 of 10.0 + + + + + 10., !WithinAbs( 11., 0.5 ) + + + 10.0 not is within 0.5 of 11.0 + + + + + -10., WithinAbs( -10., 0.5 ) + + + -10.0 is within 0.5 of -10.0 + + + + + -10., WithinAbs( -9.6, 0.5 ) + + + -10.0 is within 0.5 of -9.59999999999999964 + + + +
+
+ + + 1., WithinULP( 1., 0 ) + + + 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) + + + + + nextafter( 1., 2. ), WithinULP( 1., 1 ) + + + 1.00000000000000022 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1.0000000000000002e+00]) + + + + + 0., WithinULP( nextafter( 0., 1. ), 1 ) + + + 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9.8813129168249309e-324]) + + + + + 1., WithinULP( nextafter( 1., 0. ), 1 ) + + + 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1.0000000000000000e+00]) + + + + + 1., !WithinULP( nextafter( 1., 2. ), 0 ) + + + 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, 1.0000000000000002e+00]) + + + + + 1., WithinULP( 1., 0 ) + + + 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) + + + + + -0., WithinULP( 0., 0 ) + + + -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) + + + +
+
+ + + 1., WithinAbs( 1., 0.5 ) || WithinULP( 2., 1 ) + + + 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) + + + + + 1., WithinAbs( 2., 0.5 ) || WithinULP( 1., 0 ) + + + 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) + + + + + 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) + + + 0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) + + + +
+
+ + + WithinAbs( 1., 0. ) + + + WithinAbs( 1., 0. ) + + + + + WithinAbs( 1., -1. ), std::domain_error + + + WithinAbs( 1., -1. ), std::domain_error + + + + + WithinULP( 1., 0 ) + + + WithinULP( 1., 0 ) + + + + + WithinRel( 1., 0. ) + + + WithinRel( 1., 0. ) + + + + + WithinRel( 1., -0.2 ), std::domain_error + + + WithinRel( 1., -0.2 ), std::domain_error + + + + + WithinRel( 1., 1. ), std::domain_error + + + WithinRel( 1., 1. ), std::domain_error + + + +
+
+ + + 1., !IsNaN() + + + 1.0 not is NaN + + + +
+ +
+ +
+ + + 10.f, WithinRel( 11.1f, 0.1f ) + + + 10.0f and 11.10000038146972656 are within 10% of each other + + + + + 10.f, !WithinRel( 11.2f, 0.1f ) + + + 10.0f not and 11.19999980926513672 are within 10% of each other + + + + + 1.f, !WithinRel( 0.f, 0.99f ) + + + 1.0f not and 0.0 are within 99% of each other + + + + + -0.f, WithinRel( 0.f ) + + + -0.0f and 0.0 are within 0.00119209% of each other + + +
+ + + v1, WithinRel( v2 ) + + + 0.0f and 0.0 are within 0.00119209% of each other + + + +
+ +
+
+ + + 1.f, WithinAbs( 1.f, 0 ) + + + 1.0f is within 0.0 of 1.0 + + + + + 0.f, WithinAbs( 1.f, 1 ) + + + 0.0f is within 1.0 of 1.0 + + + + + 0.f, !WithinAbs( 1.f, 0.99f ) + + + 0.0f not is within 0.99000000953674316 of 1.0 + + + + + 0.f, !WithinAbs( 1.f, 0.99f ) + + + 0.0f not is within 0.99000000953674316 of 1.0 + + + + + 0.f, WithinAbs( -0.f, 0 ) + + + 0.0f is within 0.0 of -0.0 + + + + + 11.f, !WithinAbs( 10.f, 0.5f ) + + + 11.0f not is within 0.5 of 10.0 + + + + + 10.f, !WithinAbs( 11.f, 0.5f ) + + + 10.0f not is within 0.5 of 11.0 + + + + + -10.f, WithinAbs( -10.f, 0.5f ) + + + -10.0f is within 0.5 of -10.0 + + + + + -10.f, WithinAbs( -9.6f, 0.5f ) + + + -10.0f is within 0.5 of -9.60000038146972656 + + + +
+
+ + + 1.f, WithinULP( 1.f, 0 ) + + + 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) + + + + + -1.f, WithinULP( -1.f, 0 ) + + + -1.0f is within 0 ULPs of -1.00000000e+00f ([-1.00000000e+00, -1.00000000e+00]) + + + + + nextafter( 1.f, 2.f ), WithinULP( 1.f, 1 ) + + + 1.000000119f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) + + + + + 0.f, WithinULP( nextafter( 0.f, 1.f ), 1 ) + + + 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) + + + + + 1.f, WithinULP( nextafter( 1.f, 0.f ), 1 ) + + + 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) + + + + + 1.f, !WithinULP( nextafter( 1.f, 2.f ), 0 ) + + + 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+00]) + + + + + 1.f, WithinULP( 1.f, 0 ) + + + 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) + + + + + -0.f, WithinULP( 0.f, 0 ) + + + -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) + + + +
+
+ + + 1.f, WithinAbs( 1.f, 0.5 ) || WithinULP( 1.f, 1 ) + + + 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) + + + + + 1.f, WithinAbs( 2.f, 0.5 ) || WithinULP( 1.f, 0 ) + + + 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) + + + + + 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) + + + 0.0001f ( is within 0.00100000004749745 of 0.0 or and 0.0 are within 10% of each other ) + + + +
+
+ + + WithinAbs( 1.f, 0.f ) + + + WithinAbs( 1.f, 0.f ) + + + + + WithinAbs( 1.f, -1.f ), std::domain_error + + + WithinAbs( 1.f, -1.f ), std::domain_error + + + + + WithinULP( 1.f, 0 ) + + + WithinULP( 1.f, 0 ) + + + + + WithinULP( 1.f, static_cast<uint64_t>( -1 ) ), std::domain_error + + + WithinULP( 1.f, static_cast<uint64_t>( -1 ) ), std::domain_error + + + + + WithinRel( 1.f, 0.f ) + + + WithinRel( 1.f, 0.f ) + + + + + WithinRel( 1.f, -0.2f ), std::domain_error + + + WithinRel( 1.f, -0.2f ), std::domain_error + + + + + WithinRel( 1.f, 1.f ), std::domain_error + + + WithinRel( 1.f, 1.f ), std::domain_error + + + +
+
+ + + 1., !IsNaN() + + + 1.0 not is NaN + + + +
+ +
+ + + + i % 2 == 0 + + + 0 == 0 + + + + + i % 2 == 0 + + + 0 == 0 + + + + + i % 2 == 0 + + + 0 == 0 + + + + + i % 2 == 0 + + + 0 == 0 + + + + + +
+
+ + + i % 2 == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + i % 2 == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + i % 2 == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + filter([] (int) {return false; }, value(1)), Catch::GeneratorException + + + filter([] (int) {return false; }, value(1)), Catch::GeneratorException + + + +
+ +
+
+ + + i < 4 + + + 1 < 4 + + + +
+
+ + + i < 4 + + + 2 < 4 + + + +
+
+ + + i < 4 + + + 3 < 4 + + + +
+
+
+ + + i % 2 == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + i % 2 == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + i % 2 == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + i.size() == 1 + + + 1 == 1 + + + +
+ +
+
+
+ + + i.size() == 1 + + + 1 == 1 + + + +
+ +
+
+
+ + + i.size() == 1 + + + 1 == 1 + + + +
+ +
+
+
+ + + i.size() == 1 + + + 1 == 1 + + + +
+ +
+
+
+ + + i.size() == 1 + + + 1 == 1 + + + +
+ +
+
+
+ + + i.size() == 1 + + + 1 == 1 + + + +
+ +
+
+ + + j > 0 + + + 1 > 0 + + + +
+
+ + + j > 0 + + + 2 > 0 + + + +
+
+ + + j > 0 + + + 3 > 0 + + + +
+
+ + + j > 0 + + + 1 > 0 + + + +
+
+ + + j > 0 + + + 2 > 0 + + + +
+
+ + + j > 0 + + + 3 > 0 + + + +
+
+
+ + + chunk2.size() == 2 + + + 2 == 2 + + + + + chunk2.front() == chunk2.back() + + + 1 == 1 + + + +
+ +
+
+
+ + + chunk2.size() == 2 + + + 2 == 2 + + + + + chunk2.front() == chunk2.back() + + + 2 == 2 + + + +
+ +
+
+
+ + + chunk2.size() == 2 + + + 2 == 2 + + + + + chunk2.front() == chunk2.back() + + + 3 == 3 + + + +
+ +
+
+
+ + + chunk2.size() == 2 + + + 2 == 2 + + + + + chunk2.front() == chunk2.back() + + + 1 == 1 + + + + + chunk2.front() < 3 + + + 1 < 3 + + + +
+ +
+
+
+ + + chunk2.size() == 2 + + + 2 == 2 + + + + + chunk2.front() == chunk2.back() + + + 2 == 2 + + + + + chunk2.front() < 3 + + + 2 < 3 + + + +
+ +
+
+
+ + + chunk2.size() == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + chunk2.size() == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + chunk2.size() == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + chunk(2, value(1)), Catch::GeneratorException + + + chunk(2, value(1)), Catch::GeneratorException + + + +
+ +
+ +
+ +
+ + + j < i + + + -3 < 1 + + + +
+
+ + + j < i + + + -2 < 1 + + + +
+
+ + + j < i + + + -1 < 1 + + + +
+
+ + + 4u * i > str.size() + + + 4 > 1 + + + +
+
+ + + 4u * i > str.size() + + + 4 > 2 + + + +
+
+ + + 4u * i > str.size() + + + 4 > 3 + + + +
+
+ + + j < i + + + -3 < 2 + + + +
+
+ + + j < i + + + -2 < 2 + + + +
+
+ + + j < i + + + -1 < 2 + + + +
+
+ + + 4u * i > str.size() + + + 8 > 1 + + + +
+
+ + + 4u * i > str.size() + + + 8 > 2 + + + +
+
+ + + 4u * i > str.size() + + + 8 > 3 + + + +
+
+ + + j < i + + + -3 < 3 + + + +
+
+ + + j < i + + + -2 < 3 + + + +
+
+ + + j < i + + + -1 < 3 + + + +
+
+ + + 4u * i > str.size() + + + 12 > 1 + + + +
+
+ + + 4u * i > str.size() + + + 12 > 2 + + + +
+
+ + + 4u * i > str.size() + + + 12 > 3 + + + +
+ +
+ +
+ + + gen.get() == 123 + + + 123 == 123 + + + + + !(gen.next()) + + + !false + + + +
+
+ + + gen.get() == 1 + + + 1 == 1 + + + + + gen.next() + + + true + + + + + gen.get() == 3 + + + 3 == 3 + + + + + gen.next() + + + true + + + + + gen.get() == 5 + + + 5 == 5 + + + + + !(gen.next()) + + + !false + + + +
+
+ + + gen.get() == 1 + + + 1 == 1 + + + + + gen.next() + + + true + + + + + gen.get() == 5 + + + 5 == 5 + + + + + gen.next() + + + true + + + + + gen.get() == 2 + + + 2 == 2 + + + + + gen.next() + + + true + + + + + gen.get() == 4 + + + 4 == 4 + + + + + gen.next() + + + true + + + + + gen.get() == 0 + + + 0 == 0 + + + + + !(gen.next()) + + + !false + + + +
+
+ + + gen.get().size() == 2 + + + 2 == 2 + + + + + gen.get() == "aa" + + + "aa" == "aa" + + + + + gen.next() + + + true + + + + + gen.get() == "bb" + + + "bb" == "bb" + + + + + gen.next() + + + true + + + + + gen.get() == "cc" + + + "cc" == "cc" + + + + + !(gen.next()) + + + !false + + + +
+
+
+ + + gen.get() == 1 + + + 1 == 1 + + + + + gen.next() + + + true + + + + + gen.get() == 3 + + + 3 == 3 + + + + + !(gen.next()) + + + !false + + + +
+ +
+
+
+ + + gen.get() == 1 + + + 1 == 1 + + + + + gen.next() + + + true + + + + + gen.get() == 3 + + + 3 == 3 + + + + + !(gen.next()) + + + !false + + + +
+ +
+
+
+ + + filter([](int) { return false; }, value(1)), Catch::GeneratorException + + + filter([](int) { return false; }, value(1)), Catch::GeneratorException + + + + + filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException + + + filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException + + + +
+ +
+
+
+ + + gen.get() == 1 + + + 1 == 1 + + + + + gen.next() + + + true + + + + + gen.get() == 2 + + + 2 == 2 + + + + + !(gen.next()) + + + !false + + + +
+ +
+
+
+ + + gen.get() == 1 + + + 1 == 1 + + + + + !(gen.next()) + + + !false + + + +
+ +
+
+ + + gen.get() == 2.0 + + + 2.0 == 2.0 + + + + + gen.next() + + + true + + + + + gen.get() == 4.0 + + + 4.0 == 4.0 + + + + + gen.next() + + + true + + + + + gen.get() == 6.0 + + + 6.0 == 6.0 + + + + + !(gen.next()) + + + !false + + + +
+
+ + + gen.get() == 2.0 + + + 2.0 == 2.0 + + + + + gen.next() + + + true + + + + + gen.get() == 4.0 + + + 4.0 == 4.0 + + + + + gen.next() + + + true + + + + + gen.get() == 6.0 + + + 6.0 == 6.0 + + + + + !(gen.next()) + + + !false + + + +
+
+
+ + + gen.get() == 3 + + + 3 == 3 + + + + + !(gen.next()) + + + !false + + + +
+ +
+
+
+ + + gen.get() == 1 + + + 1 == 1 + + + + + gen.next() + + + true + + + + + gen.get() == 2 + + + 2 == 2 + + + + + gen.next() + + + true + + + + + gen.get() == 3 + + + 3 == 3 + + + + + gen.next() + + + true + + + + + gen.get() == 1 + + + 1 == 1 + + + + + gen.next() + + + true + + + + + gen.get() == 2 + + + 2 == 2 + + + + + gen.next() + + + true + + + + + gen.get() == 3 + + + 3 == 3 + + + + + !(gen.next()) + + + !false + + + +
+ +
+
+
+
+ + + gen.get() == -2 + + + -2 == -2 + + + + + gen.next() + + + true + + + + + gen.get() == -1 + + + -1 == -1 + + + + + gen.next() + + + true + + + + + gen.get() == 0 + + + 0 == 0 + + + + + gen.next() + + + true + + + + + gen.get() == 1 + + + 1 == 1 + + + + + !(gen.next()) + + + !false + + + +
+ +
+ +
+
+
+
+ + + gen.get() == 2 + + + 2 == 2 + + + + + gen.next() + + + true + + + + + gen.get() == 1 + + + 1 == 1 + + + + + gen.next() + + + true + + + + + gen.get() == 0 + + + 0 == 0 + + + + + gen.next() + + + true + + + + + gen.get() == -1 + + + -1 == -1 + + + + + !(gen.next()) + + + !false + + + +
+ +
+ +
+
+
+
+
+ + + gen.get() == -7 + + + -7 == -7 + + + + + gen.next() + + + true + + + + + gen.get() == -4 + + + -4 == -4 + + + + + gen.next() + + + true + + + + + gen.get() == -1 + + + -1 == -1 + + + + + gen.next() + + + true + + + + + gen.get() == 2 + + + 2 == 2 + + + + + !(gen.next()) + + + !false + + + +
+ +
+ +
+ +
+
+
+
+
+ + + gen.get() == -7 + + + -7 == -7 + + + + + gen.next() + + + true + + + + + gen.get() == -4 + + + -4 == -4 + + + + + gen.next() + + + true + + + + + gen.get() == -1 + + + -1 == -1 + + + + + gen.next() + + + true + + + + + gen.get() == 2 + + + 2 == 2 + + + + + !(gen.next()) + + + !false + + + +
+ +
+ +
+ +
+
+
+
+
+ + + gen.get() == -7 + + + -7 == -7 + + + + + gen.next() + + + true + + + + + gen.get() == -4 + + + -4 == -4 + + + + + gen.next() + + + true + + + + + gen.get() == -1 + + + -1 == -1 + + + + + gen.next() + + + true + + + + + gen.get() == 2 + + + 2 == 2 + + + + + gen.next() + + + true + + + + + gen.get() == 5 + + + 5 == 5 + + + + + !(gen.next()) + + + !false + + + +
+ +
+ +
+ +
+
+
+
+
+ + Current expected value is -1 + + + + gen.get() == Approx(expected) + + + -1.0 == Approx( -1.0 ) + + + + Current expected value is -1 + + + + gen.next() + + + true + + + + Current expected value is -0.9 + + + + gen.get() == Approx(expected) + + + -0.90000000000000002 +== +Approx( -0.90000000000000002 ) + + + + Current expected value is -0.9 + + + + gen.next() + + + true + + + + Current expected value is -0.8 + + + + gen.get() == Approx(expected) + + + -0.80000000000000004 +== +Approx( -0.80000000000000004 ) + + + + Current expected value is -0.8 + + + + gen.next() + + + true + + + + Current expected value is -0.7 + + + + gen.get() == Approx(expected) + + + -0.70000000000000007 +== +Approx( -0.70000000000000007 ) + + + + Current expected value is -0.7 + + + + gen.next() + + + true + + + + Current expected value is -0.6 + + + + gen.get() == Approx(expected) + + + -0.60000000000000009 +== +Approx( -0.60000000000000009 ) + + + + Current expected value is -0.6 + + + + gen.next() + + + true + + + + Current expected value is -0.5 + + + + gen.get() == Approx(expected) + + + -0.50000000000000011 +== +Approx( -0.50000000000000011 ) + + + + Current expected value is -0.5 + + + + gen.next() + + + true + + + + Current expected value is -0.4 + + + + gen.get() == Approx(expected) + + + -0.40000000000000013 +== +Approx( -0.40000000000000013 ) + + + + Current expected value is -0.4 + + + + gen.next() + + + true + + + + Current expected value is -0.3 + + + + gen.get() == Approx(expected) + + + -0.30000000000000016 +== +Approx( -0.30000000000000016 ) + + + + Current expected value is -0.3 + + + + gen.next() + + + true + + + + Current expected value is -0.2 + + + + gen.get() == Approx(expected) + + + -0.20000000000000015 +== +Approx( -0.20000000000000015 ) + + + + Current expected value is -0.2 + + + + gen.next() + + + true + + + + Current expected value is -0.1 + + + + gen.get() == Approx(expected) + + + -0.10000000000000014 +== +Approx( -0.10000000000000014 ) + + + + Current expected value is -0.1 + + + + gen.next() + + + true + + + + Current expected value is -1.38778e-16 + + + + gen.get() == Approx(expected) + + + -0.00000000000000014 +== +Approx( -0.00000000000000014 ) + + + + Current expected value is -1.38778e-16 + + + + gen.next() + + + true + + + + Current expected value is 0.1 + + + + gen.get() == Approx(expected) + + + 0.09999999999999987 +== +Approx( 0.09999999999999987 ) + + + + Current expected value is 0.1 + + + + gen.next() + + + true + + + + Current expected value is 0.2 + + + + gen.get() == Approx(expected) + + + 0.19999999999999987 +== +Approx( 0.19999999999999987 ) + + + + Current expected value is 0.2 + + + + gen.next() + + + true + + + + Current expected value is 0.3 + + + + gen.get() == Approx(expected) + + + 0.29999999999999988 +== +Approx( 0.29999999999999988 ) + + + + Current expected value is 0.3 + + + + gen.next() + + + true + + + + Current expected value is 0.4 + + + + gen.get() == Approx(expected) + + + 0.39999999999999991 +== +Approx( 0.39999999999999991 ) + + + + Current expected value is 0.4 + + + + gen.next() + + + true + + + + Current expected value is 0.5 + + + + gen.get() == Approx(expected) + + + 0.49999999999999989 +== +Approx( 0.49999999999999989 ) + + + + Current expected value is 0.5 + + + + gen.next() + + + true + + + + Current expected value is 0.6 + + + + gen.get() == Approx(expected) + + + 0.59999999999999987 +== +Approx( 0.59999999999999987 ) + + + + Current expected value is 0.6 + + + + gen.next() + + + true + + + + Current expected value is 0.7 + + + + gen.get() == Approx(expected) + + + 0.69999999999999984 +== +Approx( 0.69999999999999984 ) + + + + Current expected value is 0.7 + + + + gen.next() + + + true + + + + Current expected value is 0.8 + + + + gen.get() == Approx(expected) + + + 0.79999999999999982 +== +Approx( 0.79999999999999982 ) + + + + Current expected value is 0.8 + + + + gen.next() + + + true + + + + Current expected value is 0.9 + + + + gen.get() == Approx(expected) + + + 0.8999999999999998 +== +Approx( 0.8999999999999998 ) + + + + Current expected value is 0.9 + + + + gen.next() + + + true + + + + + gen.get() == Approx( rangeEnd ) + + + 0.99999999999999978 == Approx( 1.0 ) + + + + + !(gen.next()) + + + !false + + + +
+ +
+ +
+ +
+
+
+
+
+ + Current expected value is -1 + + + + gen.get() == Approx(expected) + + + -1.0 == Approx( -1.0 ) + + + + Current expected value is -1 + + + + gen.next() + + + true + + + + Current expected value is -0.7 + + + + gen.get() == Approx(expected) + + + -0.69999999999999996 +== +Approx( -0.69999999999999996 ) + + + + Current expected value is -0.7 + + + + gen.next() + + + true + + + + Current expected value is -0.4 + + + + gen.get() == Approx(expected) + + + -0.39999999999999997 +== +Approx( -0.39999999999999997 ) + + + + Current expected value is -0.4 + + + + gen.next() + + + true + + + + Current expected value is -0.1 + + + + gen.get() == Approx(expected) + + + -0.09999999999999998 +== +Approx( -0.09999999999999998 ) + + + + Current expected value is -0.1 + + + + gen.next() + + + true + + + + Current expected value is 0.2 + + + + gen.get() == Approx(expected) + + + 0.20000000000000001 +== +Approx( 0.20000000000000001 ) + + + + Current expected value is 0.2 + + + + gen.next() + + + true + + + + Current expected value is 0.5 + + + + gen.get() == Approx(expected) + + + 0.5 == Approx( 0.5 ) + + + + Current expected value is 0.5 + + + + gen.next() + + + true + + + + + !(gen.next()) + + + !false + + + +
+ +
+ +
+ +
+
+
+
+
+ + Current expected value is -1 + + + + gen.get() == Approx(expected) + + + -1.0 == Approx( -1.0 ) + + + + Current expected value is -1 + + + + gen.next() + + + true + + + + Current expected value is -0.7 + + + + gen.get() == Approx(expected) + + + -0.69999999999999996 +== +Approx( -0.69999999999999996 ) + + + + Current expected value is -0.7 + + + + gen.next() + + + true + + + + Current expected value is -0.4 + + + + gen.get() == Approx(expected) + + + -0.39999999999999997 +== +Approx( -0.39999999999999997 ) + + + + Current expected value is -0.4 + + + + gen.next() + + + true + + + + Current expected value is -0.1 + + + + gen.get() == Approx(expected) + + + -0.09999999999999998 +== +Approx( -0.09999999999999998 ) + + + + Current expected value is -0.1 + + + + gen.next() + + + true + + + + Current expected value is 0.2 + + + + gen.get() == Approx(expected) + + + 0.20000000000000001 +== +Approx( 0.20000000000000001 ) + + + + Current expected value is 0.2 + + + + gen.next() + + + true + + + + Current expected value is 0.5 + + + + gen.get() == Approx(expected) + + + 0.5 == Approx( 0.5 ) + + + + Current expected value is 0.5 + + + + gen.next() + + + true + + + + + !(gen.next()) + + + !false + + + +
+ +
+ +
+ +
+
+
+
+
+ + + gen.get() == 5 + + + 5 == 5 + + + + + gen.next() + + + true + + + + + gen.get() == 2 + + + 2 == 2 + + + + + gen.next() + + + true + + + + + gen.get() == -1 + + + -1 == -1 + + + + + gen.next() + + + true + + + + + gen.get() == -4 + + + -4 == -4 + + + + + !(gen.next()) + + + !false + + + +
+ +
+ +
+ +
+
+
+
+
+ + + gen.get() == 5 + + + 5 == 5 + + + + + gen.next() + + + true + + + + + gen.get() == 2 + + + 2 == 2 + + + + + gen.next() + + + true + + + + + gen.get() == -1 + + + -1 == -1 + + + + + gen.next() + + + true + + + + + gen.get() == -4 + + + -4 == -4 + + + + + !(gen.next()) + + + !false + + + +
+ +
+ +
+ +
+
+
+
+
+ + + gen.get() == 5 + + + 5 == 5 + + + + + gen.next() + + + true + + + + + gen.get() == 2 + + + 2 == 2 + + + + + gen.next() + + + true + + + + + gen.get() == -1 + + + -1 == -1 + + + + + gen.next() + + + true + + + + + gen.get() == -4 + + + -4 == -4 + + + + + gen.next() + + + true + + + + + gen.get() == -7 + + + -7 == -7 + + + + + !(gen.next()) + + + !false + + + +
+ +
+ +
+ +
+ +
+ + + + d >= Approx( 1.22 ) + + + 1.22999999999999998 +>= +Approx( 1.21999999999999997 ) + + + + + d >= Approx( 1.23 ) + + + 1.22999999999999998 +>= +Approx( 1.22999999999999998 ) + + + + + !(d >= Approx( 1.24 )) + + + !(1.22999999999999998 +>= +Approx( 1.23999999999999999 )) + + + + + d >= Approx( 1.24 ).epsilon(0.1) + + + 1.22999999999999998 +>= +Approx( 1.23999999999999999 ) + + + + + + + + h1( dummy ) != h2( dummy ) + + + 3422778688 (0x) +!= +130711275 (0x) + + + + + + + + h1( dummy ) == h2( dummy ) + + + 3422778688 (0x) +== +3422778688 (0x) + + + + + +
+ + + h( dummy1 ) != h( dummy2 ) + + + 2903002874 (0x) +!= +2668622104 (0x) + + + +
+
+ + + h( dummy1 ) != h( dummy2 ) + + + 2673152918 (0x) +!= +3916075712 (0x) + + + +
+
+ + + h( dummy1 ) != h( dummy2 ) + + + 2074929312 (0x) +!= +3429949824 (0x) + + + +
+ +
+ + + + h( dummy ) == h( dummy ) + + + 3422778688 (0x) +== +3422778688 (0x) + + + + + + + This info has multiple parts. + + + This unscoped info has multiple parts. + + + Show infos! + + + + + + this is a message + + + this is a warning + + + + + + this message should be logged + + + so should this + + + + a == 1 + + + 2 == 1 + + + + + + + this message may be logged later + + + + a == 2 + + + 2 == 2 + + + + this message may be logged later + + + this message should be logged + + + + a == 1 + + + 2 == 1 + + + + this message may be logged later + + + this message should be logged + + + and this, but later + + + + a == 0 + + + 2 == 0 + + + + this message may be logged later + + + this message should be logged + + + and this, but later + + + but not this + + + + a == 2 + + + 2 == 2 + + + + + + + current counter 0 + + + i := 0 + + + + i < 10 + + + 0 < 10 + + + + current counter 1 + + + i := 1 + + + + i < 10 + + + 1 < 10 + + + + current counter 2 + + + i := 2 + + + + i < 10 + + + 2 < 10 + + + + current counter 3 + + + i := 3 + + + + i < 10 + + + 3 < 10 + + + + current counter 4 + + + i := 4 + + + + i < 10 + + + 4 < 10 + + + + current counter 5 + + + i := 5 + + + + i < 10 + + + 5 < 10 + + + + current counter 6 + + + i := 6 + + + + i < 10 + + + 6 < 10 + + + + current counter 7 + + + i := 7 + + + + i < 10 + + + 7 < 10 + + + + current counter 8 + + + i := 8 + + + + i < 10 + + + 8 < 10 + + + + current counter 9 + + + i := 9 + + + + i < 10 + + + 9 < 10 + + + + current counter 10 + + + i := 10 + + + + i < 10 + + + 10 < 10 + + + + + + + + Dummy + + + Dummy + + + Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE + + + + + + + + data.int_seven != 7 + + + 7 != 7 + + + + + data.float_nine_point_one != Approx( 9.1f ) + + + 9.100000381f +!= +Approx( 9.10000038146972656 ) + + + + + data.double_pi != Approx( 3.1415926535 ) + + + 3.14159265350000005 +!= +Approx( 3.14159265350000005 ) + + + + + data.str_hello != "hello" + + + "hello" != "hello" + + + + + data.str_hello.size() != 5 + + + 5 != 5 + + + + + + + + data.int_seven != 6 + + + 7 != 6 + + + + + data.int_seven != 8 + + + 7 != 8 + + + + + data.float_nine_point_one != Approx( 9.11f ) + + + 9.100000381f +!= +Approx( 9.10999965667724609 ) + + + + + data.float_nine_point_one != Approx( 9.0f ) + + + 9.100000381f != Approx( 9.0 ) + + + + + data.float_nine_point_one != Approx( 1 ) + + + 9.100000381f != Approx( 1.0 ) + + + + + data.float_nine_point_one != Approx( 0 ) + + + 9.100000381f != Approx( 0.0 ) + + + + + data.double_pi != Approx( 3.1415 ) + + + 3.14159265350000005 +!= +Approx( 3.14150000000000018 ) + + + + + data.str_hello != "goodbye" + + + "hello" != "goodbye" + + + + + data.str_hello != "hell" + + + "hello" != "hell" + + + + + data.str_hello != "hello1" + + + "hello" != "hello1" + + + + + data.str_hello.size() != 6 + + + 5 != 6 + + + + + +
+ + + stream.str() == "" + + + "" == "" + + + +
+
+ + + stream.str() == "{\n}" + + + "{ +}" +== +"{ +}" + + + +
+
+ + + stream.str(), ContainsSubstring( "\"int\": 1," ) && ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"true\": true," ) && ContainsSubstring( "\"false\": false," ) && ContainsSubstring( "\"string\": \"this is a string\"," ) && ContainsSubstring( "\"array\": [\n 1,\n 2\n ]\n}" ) + + + "{ + "int": 1, + "double": 1.5, + "true": true, + "false": false, + "string": "this is a string", + "array": [ + 1, + 2 + ] +}" ( contains: ""int": 1," and contains: ""double": 1.5," and contains: ""true": true," and contains: ""false": false," and contains: ""string": "this is a string"," and contains: ""array": [ + 1, + 2 + ] +}" ) + + + +
+
+ + + stream.str(), ContainsSubstring( "\"empty_object\": {\n }," ) && ContainsSubstring( "\"fully_object\": {\n \"key\": 1\n }" ) + + + "{ + "empty_object": { + }, + "fully_object": { + "key": 1 + } +}" ( contains: ""empty_object": { + }," and contains: ""fully_object": { + "key": 1 + }" ) + + + +
+
+ + + stream.str() == "[\n]" + + + "[ +]" +== +"[ +]" + + + +
+
+ + + stream.str() == "[\n 1,\n 1.5,\n true,\n false,\n \"this is a string\",\n {\n \"object\": 42\n },\n [\n \"array\",\n 42.5\n ]\n]" + + + "[ + 1, + 1.5, + true, + false, + "this is a string", + { + "object": 42 + }, + [ + "array", + 42.5 + ] +]" +== +"[ + 1, + 1.5, + true, + false, + "this is a string", + { + "object": 42 + }, + [ + "array", + 42.5 + ] +]" + + + +
+
+ + + stream.str() == "{\n}" + + + "{ +}" +== +"{ +}" + + + +
+
+ + + stream.str() == "[\n]" + + + "[ +]" +== +"[ +]" + + + +
+
+ + + stream.str() == "\"custom\"" + + + ""custom"" == ""custom"" + + + +
+ +
+ +
+ + + sstream.str() == "\"\\\"\"" + + + ""\""" == ""\""" + + + +
+
+ + + sstream.str() == "\"\\\\\"" + + + ""\\"" == ""\\"" + + + +
+
+ + + sstream.str() == "\"/\"" + + + ""/"" == ""/"" + + + +
+
+ + + sstream.str() == "\"\\b\"" + + + ""\b"" == ""\b"" + + + +
+
+ + + sstream.str() == "\"\\f\"" + + + ""\f"" == ""\f"" + + + +
+
+ + + sstream.str() == "\"\\n\"" + + + ""\n"" == ""\n"" + + + +
+
+ + + sstream.str() == "\"\\r\"" + + + ""\r"" == ""\r"" + + + +
+
+ + + sstream.str() == "\"\\t\"" + + + ""\t"" == ""\t"" + + + +
+
+ + + sstream.str() == "\"\\\\/\\t\\r\\n\"" + + + ""\\/\t\r\n"" == ""\\/\t\r\n"" + + + +
+ +
+ + + + []() { return true; }() + + + true + + + + + + + + d <= Approx( 1.24 ) + + + 1.22999999999999998 +<= +Approx( 1.23999999999999999 ) + + + + + d <= Approx( 1.23 ) + + + 1.22999999999999998 +<= +Approx( 1.22999999999999998 ) + + + + + !(d <= Approx( 1.22 )) + + + !(1.22999999999999998 +<= +Approx( 1.21999999999999997 )) + + + + + d <= Approx( 1.22 ).epsilon(0.1) + + + 1.22999999999999998 +<= +Approx( 1.21999999999999997 ) + + + + + + + + + + + testStringForMatching(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "contains" ) + + + "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) + + + + + + + + testStringForMatching(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) + + + "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) + + + + + testStringForMatching2(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) + + + "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) + + + + + + + + testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "substring" ) + + + "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) + + + + + + + + testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) + + + "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) + + + + + + + + testStringForMatching(), !ContainsSubstring( "different" ) + + + "this string contains 'abc' as a substring" not contains: "different" + + + + + + + + testStringForMatching(), !ContainsSubstring( "substring" ) + + + "this string contains 'abc' as a substring" not contains: "substring" + + + + + +
+
+ + +
+ +
+
+
+ + +
+ +
+
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+ +
+ +
+ + + + thisThrows(), "expected exception" + + + "expected exception" equals: "expected exception" + + + + + thisThrows(), "should fail" + + + "expected exception" equals: "should fail" + + + + + + + + records == expected + + + { "Hello", "world", "Goodbye", "world" } +== +{ "Hello", "world", "Goodbye", "world" } + + + + + + + + multiReporter.getPreferences().shouldRedirectStdOut == false + + + false == false + + + + + multiReporter.getPreferences().shouldReportAllAssertions == false + + + false == false + + +
+ + + multiReporter.getPreferences().shouldRedirectStdOut == true + + + true == true + + + + + multiReporter.getPreferences().shouldReportAllAssertions == false + + + false == false + + + + + multiReporter.getPreferences().shouldRedirectStdOut == true + + + true == true + + + + + multiReporter.getPreferences().shouldReportAllAssertions == true + + + true == true + + + + + multiReporter.getPreferences().shouldRedirectStdOut == true + + + true == true + + + + + multiReporter.getPreferences().shouldReportAllAssertions == true + + + true == true + + + +
+ + + multiReporter.getPreferences().shouldRedirectStdOut == false + + + false == false + + + + + multiReporter.getPreferences().shouldReportAllAssertions == false + + + false == false + + +
+ + + multiReporter.getPreferences().shouldRedirectStdOut == true + + + true == true + + + + + multiReporter.getPreferences().shouldReportAllAssertions == false + + + false == false + + + + + multiReporter.getPreferences().shouldRedirectStdOut == true + + + true == true + + + + + multiReporter.getPreferences().shouldReportAllAssertions == true + + + true == true + + + + + multiReporter.getPreferences().shouldRedirectStdOut == true + + + true == true + + + + + multiReporter.getPreferences().shouldReportAllAssertions == true + + + true == true + + + +
+ +
+ + + + values > -6 + + + 3 > -6 + + + + + values > -6 + + + 4 > -6 + + + + + values > -6 + + + 5 > -6 + + + + + values > -6 + + + 6 > -6 + + + + + values > -6 + + + -5 > -6 + + + + + values > -6 + + + -4 > -6 + + + + + values > -6 + + + 90 > -6 + + + + + values > -6 + + + 91 > -6 + + + + + values > -6 + + + 92 > -6 + + + + + values > -6 + + + 93 > -6 + + + + + values > -6 + + + 94 > -6 + + + + + values > -6 + + + 95 > -6 + + + + + values > -6 + + + 96 > -6 + + + + + values > -6 + + + 97 > -6 + + + + + values > -6 + + + 98 > -6 + + + + + values > -6 + + + 99 > -6 + + + + + + + This one ran + + + + + + custom exception + + + + + + + True + + + {?} + + + + + !False + + + true + + + + + !(False) + + + !{?} + + + + + + + + + + + data.int_seven > 7 + + + 7 > 7 + + + + + data.int_seven < 7 + + + 7 < 7 + + + + + data.int_seven > 8 + + + 7 > 8 + + + + + data.int_seven < 6 + + + 7 < 6 + + + + + data.int_seven < 0 + + + 7 < 0 + + + + + data.int_seven < -1 + + + 7 < -1 + + + + + data.int_seven >= 8 + + + 7 >= 8 + + + + + data.int_seven <= 6 + + + 7 <= 6 + + + + + data.float_nine_point_one < 9 + + + 9.100000381f < 9 + + + + + data.float_nine_point_one > 10 + + + 9.100000381f > 10 + + + + + data.float_nine_point_one > 9.2 + + + 9.100000381f > 9.19999999999999929 + + + + + data.str_hello > "hello" + + + "hello" > "hello" + + + + + data.str_hello < "hello" + + + "hello" < "hello" + + + + + data.str_hello > "hellp" + + + "hello" > "hellp" + + + + + data.str_hello > "z" + + + "hello" > "z" + + + + + data.str_hello < "hellm" + + + "hello" < "hellm" + + + + + data.str_hello < "a" + + + "hello" < "a" + + + + + data.str_hello >= "z" + + + "hello" >= "z" + + + + + data.str_hello <= "a" + + + "hello" <= "a" + + + + + + + + data.int_seven < 8 + + + 7 < 8 + + + + + data.int_seven > 6 + + + 7 > 6 + + + + + data.int_seven > 0 + + + 7 > 0 + + + + + data.int_seven > -1 + + + 7 > -1 + + + + + data.int_seven >= 7 + + + 7 >= 7 + + + + + data.int_seven >= 6 + + + 7 >= 6 + + + + + data.int_seven <= 7 + + + 7 <= 7 + + + + + data.int_seven <= 8 + + + 7 <= 8 + + + + + data.float_nine_point_one > 9 + + + 9.100000381f > 9 + + + + + data.float_nine_point_one < 10 + + + 9.100000381f < 10 + + + + + data.float_nine_point_one < 9.2 + + + 9.100000381f < 9.19999999999999929 + + + + + data.str_hello <= "hello" + + + "hello" <= "hello" + + + + + data.str_hello >= "hello" + + + "hello" >= "hello" + + + + + data.str_hello < "hellp" + + + "hello" < "hellp" + + + + + data.str_hello < "zebra" + + + "hello" < "zebra" + + + + + data.str_hello > "hellm" + + + "hello" > "hellm" + + + + + data.str_hello > "a" + + + "hello" > "a" + + + + + +
+ + + rng() == 0x + + + 4242248763 (0x) +== +4242248763 (0x) + + + + + rng() == 0x + + + 1867888929 (0x) +== +1867888929 (0x) + + + + + rng() == 0x + + + 1276619030 (0x) +== +1276619030 (0x) + + + + + rng() == 0x + + + 1911218783 (0x) +== +1911218783 (0x) + + + + + rng() == 0x + + + 1827115164 (0x) +== +1827115164 (0x) + + + +
+
+ + + rng() == 0x + + + 1472234645 (0x) +== +1472234645 (0x) + + + + + rng() == 0x + + + 868832940 (0x) +== +868832940 (0x) + + + + + rng() == 0x + + + 570883446 (0x) +== +570883446 (0x) + + + + + rng() == 0x + + + 889299803 (0x) +== +889299803 (0x) + + + + + rng() == 0x + + + 4261393167 (0x) +== +4261393167 (0x) + + + + + rng() == 0x + + + 1472234645 (0x) +== +1472234645 (0x) + + + + + rng() == 0x + + + 868832940 (0x) +== +868832940 (0x) + + + + + rng() == 0x + + + 570883446 (0x) +== +570883446 (0x) + + + + + rng() == 0x + + + 889299803 (0x) +== +889299803 (0x) + + + + + rng() == 0x + + + 4261393167 (0x) +== +4261393167 (0x) + + + +
+ +
+ +
+ + Message from section one + + +
+
+ + Message from section two + + +
+ +
+ + + + ( EvilMatcher(), EvilMatcher() ), EvilCommaOperatorUsed + + + ( EvilMatcher(), EvilMatcher() ), EvilCommaOperatorUsed + + + + + &EvilMatcher(), EvilAddressOfOperatorUsed + + + &EvilMatcher(), EvilAddressOfOperatorUsed + + + + + EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) + + + EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) + + + + + ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() + + + ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() + + + + + +
+ + + parseUInt( "0" ) == Optional<unsigned int>{ 0 } + + + {?} == {?} + + + + + parseUInt( "100" ) == Optional<unsigned int>{ 100 } + + + {?} == {?} + + + + + parseUInt( "4294967295" ) == Optional<unsigned int>{ 4294967295 } + + + {?} == {?} + + + + + parseUInt( "0x", 16 ) == Optional<unsigned int>{ 255 } + + + {?} == {?} + + + +
+
+ + + !(parseUInt( "" )) + + + !{?} + + + + + !(parseUInt( "!!KJHF*#" )) + + + !{?} + + + + + !(parseUInt( "-1" )) + + + !{?} + + + + + !(parseUInt( "4294967296" )) + + + !{?} + + + + + !(parseUInt( "42949672964294967296429496729642949672964294967296" )) + + + !{?} + + + + + !(parseUInt( "2 4" )) + + + !{?} + + + + + !(parseUInt( "0x", 10 )) + + + !{?} + + + +
+ +
+ + + + spec.hasFilters() + + + true + + + + + spec.getInvalidSpecs().empty() + + + true + + + + + spec.matches( testCase ) + + + true + + + + + +
+ + + cli.parse({ "test", "--shard-count=8" }) + + + {?} + + + + + config.shardCount == 8 + + + 8 == 8 + + + +
+
+ + + !(result) + + + !{?} + + + + + result.errorMessage(), ContainsSubstring( "Could not parse '-1' as shard count" ) + + + "Could not parse '-1' as shard count" contains: "Could not parse '-1' as shard count" + + + +
+
+ + + !(result) + + + !{?} + + + + + result.errorMessage(), ContainsSubstring( "Shard count must be positive" ) + + + "Shard count must be positive" contains: "Shard count must be positive" + + + +
+
+ + + cli.parse({ "test", "--shard-index=2" }) + + + {?} + + + + + config.shardIndex == 2 + + + 2 == 2 + + + +
+
+ + + !(result) + + + !{?} + + + + + result.errorMessage(), ContainsSubstring( "Could not parse '-12' as shard index" ) + + + "Could not parse '-12' as shard index" contains: "Could not parse '-12' as shard index" + + + +
+
+ + + cli.parse({ "test", "--shard-index=0" }) + + + {?} + + + + + config.shardIndex == 0 + + + 0 == 0 + + + +
+ +
+ + + tagString := "[tag with spaces]" + + + + spec.hasFilters() + + + true + + + + tagString := "[tag with spaces]" + + + + spec.getInvalidSpecs().empty() + + + true + + + + tagString := "[tag with spaces]" + + + + spec.matches( testCase ) + + + true + + + + tagString := "[I said "good day" sir!]" + + + + spec.hasFilters() + + + true + + + + tagString := "[I said "good day" sir!]" + + + + spec.getInvalidSpecs().empty() + + + true + + + + tagString := "[I said "good day" sir!]" + + + + spec.matches( testCase ) + + + true + + + + + +
+ + + cli.parse( { "test", "-w", "NoAssertions" } ) + + + {?} + + + + + config.warnings == WarnAbout::NoAssertions + + + 1 == 1 + + + +
+
+ + + !(cli.parse( { "test", "-w", "NoTests" } )) + + + !{?} + + + +
+
+ + + cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) + + + {?} + + + + + config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) + + + 3 == 3 + + + +
+ +
+ + + + p == 0 + + + 0 == 0 + + + + + p == pNULL + + + 0 == 0 + + + + + p != 0 + + + 0x != 0 + + + + + cp != 0 + + + 0x != 0 + + + + + cpc != 0 + + + 0x != 0 + + + + + returnsNull() == 0 + + + {null string} == 0 + + + + + returnsConstNull() == 0 + + + {null string} == 0 + + + + + 0 != p + + + 0 != 0x + + + + + +
+ + + str1.size() == 3 + 5 + + + 8 == 8 + + + + + str2.size() == 3 + 10 + + + 13 == 13 + + + +
+
+ + + str1.size() == 2 + 5 + + + 7 == 7 + + + + + str2.size() == 2 + 15 + + + 17 == 17 + + + +
+ +
+ + + + "foo", Predicate<const char*>( []( const char* const& ) { return true; } ) + + + "foo" matches undescribed predicate + + + + + +
+ + + result + + + {?} + + + + + config.processName == "" + + + "" == "" + + + +
+
+ + + result + + + {?} + + + + + config.processName == "test" + + + "test" == "test" + + + + + config.shouldDebugBreak == false + + + false == false + + + + + config.abortAfter == -1 + + + -1 == -1 + + + + + config.noThrow == false + + + false == false + + + + + config.reporterSpecifications.empty() + + + true + + + + + !(cfg.hasTestFilters()) + + + !false + + + + + cfg.getReporterSpecs().size() == 1 + + + 1 == 1 + + + + + cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } + + + {?} == {?} + + + + + cfg.getProcessedReporterSpecs().size() == 1 + + + 1 == 1 + + + + + cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } + + + {?} == {?} + + + +
+
+
+ + + result + + + {?} + + + + + cfg.hasTestFilters() + + + true + + + + + cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false + + + false == false + + + + + cfg.testSpec().matches(*fakeTestCase("test1")) + + + true + + + +
+ +
+
+
+ + + result + + + {?} + + + + + cfg.hasTestFilters() + + + true + + + + + cfg.testSpec().matches(*fakeTestCase("test1")) == false + + + false == false + + + + + cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) + + + true + + + +
+ +
+
+
+ + + result + + + {?} + + + + + cfg.hasTestFilters() + + + true + + + + + cfg.testSpec().matches(*fakeTestCase("test1")) == false + + + false == false + + + + + cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) + + + true + + + +
+ +
+
+
+ + result.errorMessage() := "" + + + + result + + + {?} + + + + result.errorMessage() := "" + + + + config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } + + + { {?} } == { {?} } + + + +
+ +
+
+
+ + result.errorMessage() := "" + + + + result + + + {?} + + + + result.errorMessage() := "" + + + + config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } + + + { {?} } == { {?} } + + + +
+ +
+
+
+ + result.errorMessage() := "" + + + + result + + + {?} + + + + result.errorMessage() := "" + + + + config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } + + + { {?} } == { {?} } + + + +
+ +
+
+
+ + + !result + + + true + + + + + result.errorMessage(), ContainsSubstring("Unrecognized reporter") + + + "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" + + + +
+ +
+
+
+ + result.errorMessage() := "" + + + + result + + + {?} + + + + result.errorMessage() := "" + + + + config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } + + + { {?} } == { {?} } + + + +
+ +
+
+
+ + result.errorMessage() := "" + + + + result + + + {?} + + + + result.errorMessage() := "" + + + + config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } + + + { {?} } == { {?} } + + + +
+ +
+
+
+
+ + + cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) + + + {?} + + + + + config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } + + + { {?}, {?} } == { {?}, {?} } + + + +
+ +
+ +
+
+
+
+ + + cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) + + + {?} + + + + + config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } + + + { {?}, {?} } == { {?}, {?} } + + + +
+ +
+ +
+
+
+
+ + + !result + + + true + + + + + result.errorMessage(), ContainsSubstring("Only one reporter may have unspecified output file.") + + + "Only one reporter may have unspecified output file." contains: "Only one reporter may have unspecified output file." + + + +
+ +
+ +
+
+
+ + + cli.parse({"test", "-b"}) + + + {?} + + + + + config.shouldDebugBreak == true + + + true == true + + + +
+ +
+
+
+ + + cli.parse({"test", "--break"}) + + + {?} + + + + + config.shouldDebugBreak + + + true + + + +
+ +
+
+
+ + + cli.parse({"test", "-a"}) + + + {?} + + + + + config.abortAfter == 1 + + + 1 == 1 + + + +
+ +
+
+
+ + + cli.parse({"test", "-x", "2"}) + + + {?} + + + + + config.abortAfter == 2 + + + 2 == 2 + + + +
+ +
+
+
+ + + !result + + + true + + + + + result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("oops") + + + "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) + + + +
+ +
+
+
+
+ + + cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) + + + {?} + + + + + config.waitForKeypress == std::get<1>(input) + + + 0 == 0 + + + +
+ +
+ +
+
+
+
+ + + cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) + + + {?} + + + + + config.waitForKeypress == std::get<1>(input) + + + 1 == 1 + + + +
+ +
+ +
+
+
+
+ + + cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) + + + {?} + + + + + config.waitForKeypress == std::get<1>(input) + + + 2 == 2 + + + +
+ +
+ +
+
+
+
+ + + cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) + + + {?} + + + + + config.waitForKeypress == std::get<1>(input) + + + 3 == 3 + + + +
+ +
+ +
+
+
+
+ + + !result + + + true + + + + + result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("both") + + + "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) + + + +
+ +
+ +
+
+
+ + + cli.parse({"test", "-e"}) + + + {?} + + + + + config.noThrow + + + true + + + +
+ +
+
+
+ + + cli.parse({"test", "--nothrow"}) + + + {?} + + + + + config.noThrow + + + true + + + +
+ +
+
+
+ + + cli.parse({"test", "-o", "filename.ext"}) + + + {?} + + + + + config.defaultOutputFilename == "filename.ext" + + + "filename.ext" == "filename.ext" + + + +
+ +
+
+
+ + + cli.parse({"test", "--out", "filename.ext"}) + + + {?} + + + + + config.defaultOutputFilename == "filename.ext" + + + "filename.ext" == "filename.ext" + + + +
+ +
+
+
+ + + cli.parse({"test", "-abe"}) + + + {?} + + + + + config.abortAfter == 1 + + + 1 == 1 + + + + + config.shouldDebugBreak + + + true + + + + + config.noThrow == true + + + true == true + + + +
+ +
+
+
+ + + cli.parse({"test"}) + + + {?} + + + + + config.defaultColourMode == ColourMode::PlatformDefault + + + 0 == 0 + + + +
+ +
+
+
+ + + cli.parse( { "test", "--colour-mode", "default" } ) + + + {?} + + + + + config.defaultColourMode == ColourMode::PlatformDefault + + + 0 == 0 + + + +
+ +
+
+
+ + + cli.parse({"test", "--colour-mode", "ansi"}) + + + {?} + + + + + config.defaultColourMode == ColourMode::ANSI + + + 1 == 1 + + + +
+ +
+
+
+ + + cli.parse({"test", "--colour-mode", "none"}) + + + {?} + + + + + config.defaultColourMode == ColourMode::None + + + 3 == 3 + + + +
+ +
+
+
+ + + !result + + + true + + + + + result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) + + + "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not recognised" contains: "colour mode must be one of" + + + +
+ +
+
+
+ + + cli.parse({ "test", "--benchmark-samples=200" }) + + + {?} + + + + + config.benchmarkSamples == 200 + + + 200 == 200 + + + +
+ +
+
+
+ + + cli.parse({ "test", "--benchmark-resamples=20000" }) + + + {?} + + + + + config.benchmarkResamples == 20000 + + + 20000 (0x) == 20000 (0x) + + + +
+ +
+
+
+ + + cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) + + + {?} + + + + + config.benchmarkConfidenceInterval == Catch::Approx(0.99) + + + 0.98999999999999999 +== +Approx( 0.98999999999999999 ) + + + +
+ +
+
+
+ + + cli.parse({ "test", "--benchmark-no-analysis" }) + + + {?} + + + + + config.benchmarkNoAnalysis + + + true + + + +
+ +
+
+
+ + + cli.parse({ "test", "--benchmark-warmup-time=10" }) + + + {?} + + + + + config.benchmarkWarmupTime == 10 + + + 10 == 10 + + + +
+ +
+ +
+ + + + std::tuple_size<TestType>::value >= 1 + + + 3 >= 1 + + + + + + + + std::tuple_size<TestType>::value >= 1 + + + 2 >= 1 + + + + + + + + std::tuple_size<TestType>::value >= 1 + + + 1 >= 1 + + + + + + + + Catch::generateRandomSeed(method) + + + Catch::generateRandomSeed(method) + + + + + Catch::generateRandomSeed(method) + + + Catch::generateRandomSeed(method) + + + + + Catch::generateRandomSeed(method) + + + Catch::generateRandomSeed(method) + + + + + + + + Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) + + + Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) + + + + + + + + Catch::Detail::stringify(UsesSentinel{}) == "{ }" + + + "{ }" == "{ }" + + + + + + + + truthy(false) + + + Hey, its truthy! + + + + + + + + testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) + + + "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively + + + + + testStringForMatching(), Matches( "contains 'abc' as a substring" ) + + + "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively + + + + + testStringForMatching(), Matches( "this string contains 'abc' as a" ) + + + "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively + + + + + + + + registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" + + + "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'" + + + + + + + + actual, !UnorderedEquals( expected ) + + + { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } + + + + + + + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: Automake + + + + listingString, ContainsSubstring("fakeTag"s) + + + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: Automake + + + + listingString, ContainsSubstring("fake reporter"s) + + + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: Automake + + + + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) + + + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: compact + + + + listingString, ContainsSubstring("fakeTag"s) + + + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: compact + + + + listingString, ContainsSubstring("fake reporter"s) + + + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: compact + + + + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) + + + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: console + + + + listingString, ContainsSubstring("fakeTag"s) + + + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: console + + + + listingString, ContainsSubstring("fake reporter"s) + + + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: console + + + + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) + + + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: JSON + + + + listingString, ContainsSubstring("fakeTag"s) + + + "{ + "version": 1, + "metadata": { + "name": "", + "rng-seed": 1234, + "catch2-version": "" + }, + "listings": { + "tags": [ + { + "aliases": [ + "fakeTag" + ], + "count": 1 + } + ]" contains: "fakeTag" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: JSON + + + + listingString, ContainsSubstring("fake reporter"s) + + + "{ + "version": 1, + "metadata": { + "name": "", + "rng-seed": 1234, + "catch2-version": "" + }, + "listings": { + "reporters": [ + { + "name": "fake reporter", + "description": "fake description" + } + ]" contains: "fake reporter" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: JSON + + + + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) + + + "{ + "version": 1, + "metadata": { + "name": "", + "rng-seed": 1234, + "catch2-version": "" + }, + "listings": { + "tests": [ + { + "name": "fake test name", + "class-name": "", + "tags": [ + "fakeTestTag" + ], + "source-location": { + "filename": "fake-file.cpp", + "line": 123456789 + } + } + ]" ( contains: "fake test name" and contains: "fakeTestTag" ) + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: JUnit + + + + listingString, ContainsSubstring("fakeTag"s) + + + "<?xml version="1.0" encoding="UTF-8"?> +All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: JUnit + + + + listingString, ContainsSubstring("fake reporter"s) + + + "<?xml version="1.0" encoding="UTF-8"?> +Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: JUnit + + + + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) + + + "<?xml version="1.0" encoding="UTF-8"?> +All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: SonarQube + + + + listingString, ContainsSubstring("fakeTag"s) + + + "<?xml version="1.0" encoding="UTF-8"?> +All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: SonarQube + + + + listingString, ContainsSubstring("fake reporter"s) + + + "<?xml version="1.0" encoding="UTF-8"?> +Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: SonarQube + + + + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) + + + "<?xml version="1.0" encoding="UTF-8"?> +All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: TAP + + + + listingString, ContainsSubstring("fakeTag"s) + + + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: TAP + + + + listingString, ContainsSubstring("fake reporter"s) + + + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: TAP + + + + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) + + + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: TeamCity + + + + listingString, ContainsSubstring("fakeTag"s) + + + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: TeamCity + + + + listingString, ContainsSubstring("fake reporter"s) + + + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: TeamCity + + + + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) + + + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: XML + + + + listingString, ContainsSubstring("fakeTag"s) + + + "<?xml version="1.0" encoding="UTF-8"?> +<TagsFromMatchingTests> + <Tag> + <Count>1</Count> + <Aliases> + <Alias>fakeTag</Alias> + </Aliases> + </Tag> +</TagsFromMatchingTests>" contains: "fakeTag" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: XML + + + + listingString, ContainsSubstring("fake reporter"s) + + + "<?xml version="1.0" encoding="UTF-8"?> +<AvailableReporters> + <Reporter> + <Name>fake reporter</Name> + <Description>fake description</Description> + </Reporter> +</AvailableReporters>" contains: "fake reporter" + + + +
+ + + !(factories.empty()) + + + !false + + +
+ + Tested reporter: XML + + + + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) + + + "<?xml version="1.0" encoding="UTF-8"?> +<MatchingTests> + <TestCase> + <Name>fake test name</Name> + <ClassName/> + <Tags>[fakeTestTag]</Tags> + <SourceInfo> + <File>fake-file.cpp</File> + <Line>123456789</Line> + </SourceInfo> + </TestCase> +</MatchingTests>" ( contains: "fake test name" and contains: "fakeTestTag" ) + + + +
+ +
+ + + + + + + + + + +
+ + + before == 0 + + + 0 == 0 + + +
+
+ + + after > before + + + 1 > 0 + + + +
+ +
+ +
+ +
+ +
+
+
+
+ + + itDoesThis() + + + true + + +
+ + + itDoesThat() + + + true + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ + + v.size() == 0 + + + 0 == 0 + + +
+
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + +
+
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ +
+ +
+ +
+ +
+
+ + + v.size() == 0 + + + 0 == 0 + + +
+
+ + + v.capacity() >= 10 + + + 10 >= 10 + + + + + v.size() == 0 + + + 0 == 0 + + + +
+ +
+ +
+ +
+ + + +A string sent directly to stdout + + +A string sent directly to stderr +A string sent to stderr via clog + + + + + + + d == Approx( 1.23 ) + + + 1.22999999999999998 +== +Approx( 1.22999999999999998 ) + + + + + d != Approx( 1.22 ) + + + 1.22999999999999998 +!= +Approx( 1.21999999999999997 ) + + + + + d != Approx( 1.24 ) + + + 1.22999999999999998 +!= +Approx( 1.23999999999999999 ) + + + + + d == 1.23_a + + + 1.22999999999999998 +== +Approx( 1.22999999999999998 ) + + + + + d != 1.22_a + + + 1.22999999999999998 +!= +Approx( 1.21999999999999997 ) + + + + + Approx( d ) == 1.23 + + + Approx( 1.22999999999999998 ) +== +1.22999999999999998 + + + + + Approx( d ) != 1.22 + + + Approx( 1.22999999999999998 ) +!= +1.21999999999999997 + + + + + Approx( d ) != 1.24 + + + Approx( 1.22999999999999998 ) +!= +1.23999999999999999 + + + + + +
+ +
+
+ +
+ + +Message from section one +Message from section two + + +
+ + + + testStringForMatching(), StartsWith( "This String" ) + + + "this string contains 'abc' as a substring" starts with: "This String" + + + + + testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" starts with: "string" (case insensitive) + + + + + +
+ + + Catch::Detail::stringify(singular) == "{ 1 }" + + + "{ 1 }" == "{ 1 }" + + + +
+
+ + + Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" + + + "{ 3, 2, 1 }" == "{ 3, 2, 1 }" + + + +
+
+ + + Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })" + + + "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" +== +"{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" + + + +
+ +
+ + + + testStringForMatching(), ContainsSubstring( "string" ) + + + "this string contains 'abc' as a substring" contains: "string" + + + + + testStringForMatching(), ContainsSubstring( "string", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" contains: "string" (case insensitive) + + + + + testStringForMatching(), ContainsSubstring( "abc" ) + + + "this string contains 'abc' as a substring" contains: "abc" + + + + + testStringForMatching(), ContainsSubstring( "aBC", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" contains: "abc" (case insensitive) + + + + + testStringForMatching(), StartsWith( "this" ) + + + "this string contains 'abc' as a substring" starts with: "this" + + + + + testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" starts with: "this" (case insensitive) + + + + + testStringForMatching(), EndsWith( "substring" ) + + + "this string contains 'abc' as a substring" ends with: "substring" + + + + + testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) + + + + + +
+ + + empty.empty() + + + true + + + + + empty.size() == 0 + + + 0 == 0 + + + + + std::strcmp( empty.data(), "" ) == 0 + + + 0 == 0 + + + +
+
+ + + s.empty() == false + + + false == false + + + + + s.size() == 5 + + + 5 == 5 + + + + + std::strcmp( rawChars, "hello" ) == 0 + + + 0 == 0 + + + + + s.data() == rawChars + + + "hello" == "hello" + + + +
+
+ + + original == "original" + + + original == "original" + + + + + original.data() + + + original.data() + + + +
+
+ + + original.begin() == copy.begin() + + + "original string" == "original string" + + + +
+
+ + + original.begin() == copy.begin() + + + "original string" == "original string" + + + +
+
+
+ + + ss.empty() == false + + + false == false + + + + + ss.size() == 5 + + + 5 == 5 + + + + + std::strncmp( ss.data(), "hello", 5 ) == 0 + + + 0 == 0 + + + + + ss == "hello" + + + hello == "hello" + + + +
+ +
+
+
+ + + ss.size() == 6 + + + 6 == 6 + + + + + std::strcmp( ss.data(), "world!" ) == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + s.data() == s2.data() + + + "hello world!" == "hello world!" + + + +
+ +
+
+
+ + + s.data() == ss.data() + + + "hello world!" == "hello world!" + + + +
+ +
+
+
+ + + s.substr(s.size() + 1, 123).empty() + + + true + + + +
+ +
+
+
+ + + std::strcmp(ss.data(), "world!") == 0 + + + 0 == 0 + + + +
+ +
+
+
+ + + s.substr(1'000'000, 1).empty() + + + true + + + +
+ +
+
+ + + reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) + + + "Hello" != "Hello" + + + + + left == right + + + Hello == Hello + + + + + left != left.substr(0, 3) + + + Hello != Hel + + + +
+
+
+ + + sr == "a standard string" + + + a standard string == "a standard string" + + + + + sr.size() == stdStr.size() + + + 17 == 17 + + + +
+ +
+
+
+ + + sr == "a standard string" + + + a standard string == "a standard string" + + + + + sr.size() == stdStr.size() + + + 17 == 17 + + + +
+ +
+
+
+ + + sr == "a standard string" + + + a standard string == "a standard string" + + + + + sr.size() == stdStr.size() + + + 17 == 17 + + + +
+ +
+
+
+ + + stdStr == "a stringref" + + + "a stringref" == "a stringref" + + + + + stdStr.size() == sr.size() + + + 11 == 11 + + + +
+ +
+
+
+ + + stdStr == "a stringref" + + + "a stringref" == "a stringref" + + + + + stdStr.size() == sr.size() + + + 11 == 11 + + + +
+ +
+
+ + + lhs == "some string += the stringref contents" + + + "some string += the stringref contents" +== +"some string += the stringref contents" + + + +
+
+ + + together == "abrakadabra" + + + "abrakadabra" == "abrakadabra" + + + +
+ +
+ +
+ +
+
+ +
+ +
+ + + + ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s + + + ""abc"" == ""abc"" + + + + + ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + + + ""abc"" == ""abc"" + + + + + + + + ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s + + + ""abc"" == ""abc"" + + + + + ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + + + ""abc"" == ""abc"" + + + + + + + + ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s + + + ""abc"" == ""abc"" + + + + + ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + + + ""abc"" == ""abc"" + + + + + + + + minute == seconds + + + 1 m == 60 s + + + + + hour != seconds + + + 1 h != 60 s + + + + + micro != milli + + + 1 us != 1 ms + + + + + nano != micro + + + 1 ns != 1 us + + + + + + + + half_minute != femto_second + + + 1 [30/1]s != 1 fs + + + + + pico_second != atto_second + + + 1 ps != 1 as + + + + + + + + now != later + + + {iso8601-timestamp} +!= +{iso8601-timestamp} + + + + + + + + s1 == s2 + + + "if ($b == 10) { + $a = 20; +}" +== +"if ($b == 10) { + $a = 20; +} +" + + + + + +
+ + + what, ContainsSubstring( "[@zzz]" ) + + + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "[@zzz]" + + + + + what, ContainsSubstring( "file" ) + + + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "file" + + + + + what, ContainsSubstring( "2" ) + + + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "2" + + + + + what, ContainsSubstring( "10" ) + + + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "10" + + + +
+
+ + + registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + + + registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + + + registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) + + + + + registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) + + + registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) + + + +
+ +
+ + + + testCase.tags.size() == 2 + + + 2 == 2 + + + + + testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) + + + { {?}, {?} } ( Contains: {?} and Contains: {?} ) + + + + + + + + Template_Fixture<TestType>::m_a == 1 + + + 1 == 1 + + + + + + + + Template_Fixture<TestType>::m_a == 1 + + + 1 == 1 + + + + + + + + Template_Fixture<TestType>::m_a == 1 + + + 1.0 == 1 + + + + + + + + std::is_default_constructible<TestType>::value + + + true + + + + + + + + std::is_default_constructible<TestType>::value + + + true + + + + + + + + std::is_trivially_copyable<TestType>::value + + + true + + + + + + + + std::is_trivially_copyable<TestType>::value + + + true + + + + + + + + std::is_arithmetic<TestType>::value + + + true + + + + + + + + std::is_arithmetic<TestType>::value + + + true + + + + + + + + std::is_arithmetic<TestType>::value + + + true + + + + + + + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.capacity() == 0 + + + 0 == 0 + + + +
+ +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + + +
+ +
+ + + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.capacity() == 0 + + + 0 == 0 + + + +
+ +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + + +
+ +
+ + + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.capacity() == 0 + + + 0 == 0 + + + +
+ +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + + +
+ +
+ + + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.capacity() == 0 + + + 0 == 0 + + + +
+ +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + + +
+ +
+ + + + v.size() == V + + + 6 == 6 + + + + + v.capacity() >= V + + + 6 >= 6 + + +
+ + + v.size() == 2 * V + + + 12 == 12 + + + + + v.capacity() >= 2 * V + + + 12 >= 12 + + + +
+ + + v.size() == V + + + 6 == 6 + + + + + v.capacity() >= V + + + 6 >= 6 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= V + + + 6 >= 6 + + +
+ + + v.capacity() == 0 + + + 0 == 0 + + + +
+ +
+ + + v.size() == V + + + 6 == 6 + + + + + v.capacity() >= V + + + 6 >= 6 + + +
+ + + v.size() == V + + + 6 == 6 + + + + + v.capacity() >= 2 * V + + + 12 >= 12 + + + +
+ + + v.size() == V + + + 6 == 6 + + + + + v.capacity() >= V + + + 6 >= 6 + + +
+ + + v.size() == V + + + 6 == 6 + + + + + v.capacity() >= V + + + 6 >= 6 + + + +
+ +
+ + + + v.size() == V + + + 4 == 4 + + + + + v.capacity() >= V + + + 4 >= 4 + + +
+ + + v.size() == 2 * V + + + 8 == 8 + + + + + v.capacity() >= 2 * V + + + 8 >= 8 + + + +
+ + + v.size() == V + + + 4 == 4 + + + + + v.capacity() >= V + + + 4 >= 4 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= V + + + 4 >= 4 + + +
+ + + v.capacity() == 0 + + + 0 == 0 + + + +
+ +
+ + + v.size() == V + + + 4 == 4 + + + + + v.capacity() >= V + + + 4 >= 4 + + +
+ + + v.size() == V + + + 4 == 4 + + + + + v.capacity() >= 2 * V + + + 8 >= 8 + + + +
+ + + v.size() == V + + + 4 == 4 + + + + + v.capacity() >= V + + + 4 >= 4 + + +
+ + + v.size() == V + + + 4 == 4 + + + + + v.capacity() >= V + + + 4 >= 4 + + + +
+ +
+ + + + v.size() == V + + + 5 == 5 + + + + + v.capacity() >= V + + + 5 >= 5 + + +
+ + + v.size() == 2 * V + + + 10 == 10 + + + + + v.capacity() >= 2 * V + + + 10 >= 10 + + + +
+ + + v.size() == V + + + 5 == 5 + + + + + v.capacity() >= V + + + 5 >= 5 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= V + + + 5 >= 5 + + +
+ + + v.capacity() == 0 + + + 0 == 0 + + + +
+ +
+ + + v.size() == V + + + 5 == 5 + + + + + v.capacity() >= V + + + 5 >= 5 + + +
+ + + v.size() == V + + + 5 == 5 + + + + + v.capacity() >= 2 * V + + + 10 >= 10 + + + +
+ + + v.size() == V + + + 5 == 5 + + + + + v.capacity() >= V + + + 5 >= 5 + + +
+ + + v.size() == V + + + 5 == 5 + + + + + v.capacity() >= V + + + 5 >= 5 + + + +
+ +
+ + + + v.size() == V + + + 15 == 15 + + + + + v.capacity() >= V + + + 15 >= 15 + + +
+ + + v.size() == 2 * V + + + 30 == 30 + + + + + v.capacity() >= 2 * V + + + 30 >= 30 + + + +
+ + + v.size() == V + + + 15 == 15 + + + + + v.capacity() >= V + + + 15 >= 15 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= V + + + 15 >= 15 + + +
+ + + v.capacity() == 0 + + + 0 == 0 + + + +
+ +
+ + + v.size() == V + + + 15 == 15 + + + + + v.capacity() >= V + + + 15 >= 15 + + +
+ + + v.size() == V + + + 15 == 15 + + + + + v.capacity() >= 2 * V + + + 30 >= 30 + + + +
+ + + v.size() == V + + + 15 == 15 + + + + + v.capacity() >= V + + + 15 >= 15 + + +
+ + + v.size() == V + + + 15 == 15 + + + + + v.capacity() >= V + + + 15 >= 15 + + + +
+ +
+ + + + testCase.tags.size() == 1 + + + 1 == 1 + + + + + testCase.tags[0] == Tag( "tag1" ) + + + {?} == {?} + + + + + + + + + + + 0x == bit30and31 + + + 3221225472 (0x) == 3221225472 + + + + + + + + + + + true + + + true + + + + + false + + + false + + + + + true + + + true + + + + + false + + + false + + + + + + + + true + + + true + + + + + + + + + false + + + false + + + + + + + + + true + + + true + + + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + Uncaught exception should fail! + + + + + + + + false + + + false + + + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + Uncaught exception should fail! + + + + + + + + 1 == 2 + + + 1 == 2 + + + + + +
+ + + listingString, ContainsSubstring("[fakeTag]"s) + + + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "[fakeTag]" + + + +
+
+ + + listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) + + + "Available reporters: + fake reporter: fake description + +" ( contains: "fake reporter" and contains: "fake description" ) + + + +
+
+ + + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) + + + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + + + +
+
+ + + listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) + + + "Registered listeners: + fakeListener: fake description + +" ( contains: "fakeListener" and contains: "fake description" ) + + + +
+ +
+ + + + + + For some reason someone is throwing a string literal! + + + + + + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s1.isSuccessfullyCompleted() + + + true + + + + + testCase.isComplete() == false + + + false == false + + + + + ctx.completedCycle() + + + true + + + + + testCase.isSuccessfullyCompleted() + + + true + + + +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s1.isComplete() + + + true + + + + + s1.isSuccessfullyCompleted() == false + + + false == false + + + + + testCase.isComplete() == false + + + false == false + + + + + ctx.completedCycle() + + + true + + + + + testCase.isSuccessfullyCompleted() == false + + + false == false + + +
+ + + testCase2.isOpen() + + + true + + + + + s1b.isOpen() == false + + + false == false + + + + + ctx.completedCycle() + + + true + + + + + testCase.isComplete() + + + true + + + + + testCase.isSuccessfullyCompleted() + + + true + + + +
+ +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s1.isComplete() + + + true + + + + + s1.isSuccessfullyCompleted() == false + + + false == false + + + + + testCase.isComplete() == false + + + false == false + + + + + ctx.completedCycle() + + + true + + + + + testCase.isSuccessfullyCompleted() == false + + + false == false + + +
+ + + testCase2.isOpen() + + + true + + + + + s1b.isOpen() == false + + + false == false + + + + + s2.isOpen() + + + true + + + + + ctx.completedCycle() + + + true + + + + + testCase.isComplete() + + + true + + + + + testCase.isSuccessfullyCompleted() + + + true + + + +
+ +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s2.isOpen() == false + + + false == false + + + + + testCase.isComplete() == false + + + false == false + + +
+ + + testCase2.isOpen() + + + true + + + + + s1b.isOpen() == false + + + false == false + + + + + s2b.isOpen() + + + true + + + + + ctx.completedCycle() == false + + + false == false + + +
+ + + ctx.completedCycle() + + + true + + + + + s2b.isSuccessfullyCompleted() + + + true + + + + + testCase2.isComplete() == false + + + false == false + + + + + testCase2.isSuccessfullyCompleted() + + + true + + + +
+ +
+ +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s2.isOpen() == false + + + false == false + + + + + testCase.isComplete() == false + + + false == false + + +
+ + + testCase2.isOpen() + + + true + + + + + s1b.isOpen() == false + + + false == false + + + + + s2b.isOpen() + + + true + + + + + ctx.completedCycle() == false + + + false == false + + +
+ + + ctx.completedCycle() + + + true + + + + + s2b.isComplete() + + + true + + + + + s2b.isSuccessfullyCompleted() == false + + + false == false + + + + + testCase2.isSuccessfullyCompleted() == false + + + false == false + + + + + testCase3.isOpen() + + + true + + + + + s1c.isOpen() == false + + + false == false + + + + + s2c.isOpen() == false + + + false == false + + + + + testCase3.isSuccessfullyCompleted() + + + true + + + +
+ +
+ +
+ + + testCase.isOpen() + + + true + + + + + s1.isOpen() + + + true + + +
+ + + s2.isOpen() + + + true + + + + + s2.isComplete() + + + true + + + + + s1.isComplete() == false + + + false == false + + + + + s1.isComplete() + + + true + + + + + testCase.isComplete() == false + + + false == false + + + + + testCase.isComplete() + + + true + + + +
+ +
+ + + + trim(std::string(no_whitespace)) == no_whitespace + + + "There is no extra whitespace here" +== +"There is no extra whitespace here" + + + + + trim(std::string(leading_whitespace)) == no_whitespace + + + "There is no extra whitespace here" +== +"There is no extra whitespace here" + + + + + trim(std::string(trailing_whitespace)) == no_whitespace + + + "There is no extra whitespace here" +== +"There is no extra whitespace here" + + + + + trim(std::string(whitespace_at_both_ends)) == no_whitespace + + + "There is no extra whitespace here" +== +"There is no extra whitespace here" + + + + + trim(StringRef(no_whitespace)) == StringRef(no_whitespace) + + + There is no extra whitespace here +== +There is no extra whitespace here + + + + + trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) + + + There is no extra whitespace here +== +There is no extra whitespace here + + + + + trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) + + + There is no extra whitespace here +== +There is no extra whitespace here + + + + + trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) + + + There is no extra whitespace here +== +There is no extra whitespace here + + + + + +
+
+ + + array_int_a, RangeEquals( c_array ) + + + { 1, 2, 3 } elements are { 1, 2, 3 } + + + + + array_int_a, UnorderedRangeEquals( c_array ) + + + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + + + +
+ +
+
+
+ + + array_int_3, !RangeEquals( array_int_4 ) + + + { 1, 2, 3 } not elements are { 1, 2, 3, 4 } + + + + + array_int_3, !UnorderedRangeEquals( array_int_4 ) + + + { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } + + + +
+ +
+
+
+ + + array_int_a, RangeEquals( vector_char_a ) + + + { 1, 2, 3 } elements are { 1, 2, 3 } + + + + + array_int_a, UnorderedRangeEquals( vector_char_a ) + + + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + + + +
+ +
+
+
+ + + array_int_a, RangeEquals( list_char_a ) + + + { 1, 2, 3 } elements are { 1, 2, 3 } + + + + + array_int_a, UnorderedRangeEquals( list_char_a ) + + + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + + + +
+ +
+
+
+ + + vector_int_a, RangeEquals( vector_char_a ) + + + { 1, 2, 3 } elements are { 1, 2, 3 } + + + + + vector_int_a, UnorderedRangeEquals( vector_char_a ) + + + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + + + +
+ +
+
+
+ + + vector_int_a, !RangeEquals( vector_char_b ) + + + { 1, 2, 3 } not elements are { 1, 2, 2 } + + + + + vector_int_a, !UnorderedRangeEquals( vector_char_b ) + + + { 1, 2, 3 } not unordered elements are { 1, 2, 2 } + + + +
+ +
+
+ + + a, !RangeEquals( b ) + + + { 1, 2, 3 } not elements are { 3, 2, 1 } + + + + + a, UnorderedRangeEquals( b ) + + + { 1, 2, 3 } unordered elements are { 3, 2, 1 } + + + +
+
+
+ + + vector_a, RangeEquals( array_a_plus_1, close_enough ) + + + { 1, 2, 3 } elements are { 2, 3, 4 } + + + + + vector_a, UnorderedRangeEquals( array_a_plus_1, close_enough ) + + + { 1, 2, 3 } unordered elements are { 2, 3, 4 } + + + +
+ +
+ +
+ + + 3.14000000000000012 + + + + +
+ + + bptr->i == 3 + + + 3 == 3 + + + +
+
+ + + bptr->i == 3 + + + 3 == 3 + + + +
+ +
+ +
+ + + data, AllMatch(SizeIs(5)) + + + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } all match has size == 5 + + + + + data, !AllMatch(Contains(0) && Contains(1)) + + + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains element 1 ) + + + +
+
+ + + needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) + + + { 1, 2, 3, 4, 5 } all match matches undescribed predicate + + + +
+
+
+ + + mocked, allMatch + + + { 1, 2, 3, 4, 5 } all match matches undescribed predicate + + + + + mocked.m_derefed[0] + + + true + + + + + mocked.m_derefed[1] + + + true + + + + + mocked.m_derefed[2] + + + true + + + + + mocked.m_derefed[3] + + + true + + + + + mocked.m_derefed[4] + + + true + + + +
+ +
+
+
+ + + mocked, !allMatch + + + { 1, 2, 3, 4, 5 } not all match matches undescribed predicate + + + + + mocked.m_derefed[0] + + + true + + + + + mocked.m_derefed[1] + + + true + + + + + mocked.m_derefed[2] + + + true + + + + + !(mocked.m_derefed[3]) + + + !false + + + + + !(mocked.m_derefed[4]) + + + !false + + + +
+ +
+ +
+ +
+
+ + + data, AllTrue() + + + { true, true, true, true, true } contains only true + + + +
+ +
+
+
+ + + data, AllTrue() + + + { } contains only true + + + +
+ +
+
+
+ + + data, !AllTrue() + + + { true, true, false, true, true } not contains only true + + + +
+ +
+
+
+ + + data, !AllTrue() + + + { false, false, false, false, false } not contains only true + + + +
+ +
+
+
+ + + data, AllTrue() + + + { true, true, true, true, true } contains only true + + + +
+ +
+
+
+ + + data, !AllTrue() + + + { true, true, false, true, true } not contains only true + + + +
+ +
+
+
+ + + data, !AllTrue() + + + { false, false, false, false, false } not contains only true + + + +
+ +
+
+
+ + + mocked, AllTrue() + + + { true, true, true, true, true } contains only true + + + + + mocked.m_derefed[0] + + + true + + + + + mocked.m_derefed[1] + + + true + + + + + mocked.m_derefed[2] + + + true + + + + + mocked.m_derefed[3] + + + true + + + + + mocked.m_derefed[4] + + + true + + + +
+ +
+
+
+ + + mocked, !AllTrue() + + + { true, true, false, true, true } not contains only true + + + + + mocked.m_derefed[0] + + + true + + + + + mocked.m_derefed[1] + + + true + + + + + mocked.m_derefed[2] + + + true + + + + + !(mocked.m_derefed[3]) + + + !false + + + + + !(mocked.m_derefed[4]) + + + !false + + + +
+ +
+ +
+ +
+ + + data, AnyMatch(SizeIs(5)) + + + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } any match has size == 5 + + + + + data, !AnyMatch(Contains(0) && Contains(10)) + + + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains element 10 ) + + + +
+
+ + + needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) + + + { 1, 2, 3, 4, 5 } any match matches undescribed predicate + + + +
+
+
+ + + mocked, !anyMatch + + + { 1, 2, 3, 4, 5 } not any match matches undescribed predicate + + + + + mocked.m_derefed[0] + + + true + + + + + mocked.m_derefed[1] + + + true + + + + + mocked.m_derefed[2] + + + true + + + + + mocked.m_derefed[3] + + + true + + + + + mocked.m_derefed[4] + + + true + + + +
+ +
+
+
+ + + mocked, anyMatch + + + { 1, 2, 3, 4, 5 } any match matches undescribed predicate + + + + + mocked.m_derefed[0] + + + true + + + + + !(mocked.m_derefed[1]) + + + !false + + + + + !(mocked.m_derefed[2]) + + + !false + + + + + !(mocked.m_derefed[3]) + + + !false + + + + + !(mocked.m_derefed[4]) + + + !false + + + +
+ +
+ +
+ +
+
+ + + data, AnyTrue() + + + { true, true, true, true, true } contains at least one true + + + +
+ +
+
+
+ + + data, !AnyTrue() + + + { } not contains at least one true + + + +
+ +
+
+
+ + + data, AnyTrue() + + + { false, false, true, false, false } contains at least one true + + + +
+ +
+
+
+ + + data, !AnyTrue() + + + { false, false, false, false, false } not contains at least one true + + + +
+ +
+
+
+ + + data, AnyTrue() + + + { true, true, true, true, true } contains at least one true + + + +
+ +
+
+
+ + + data, AnyTrue() + + + { false, false, true, false, false } contains at least one true + + + +
+ +
+
+
+ + + data, !AnyTrue() + + + { false, false, false, false, false } not contains at least one true + + + +
+ +
+
+
+ + + mocked, AnyTrue() + + + { false, false, false, false, true } contains at least one true + + + + + mocked.m_derefed[0] + + + true + + + + + mocked.m_derefed[1] + + + true + + + + + mocked.m_derefed[2] + + + true + + + + + mocked.m_derefed[3] + + + true + + + + + mocked.m_derefed[4] + + + true + + + +
+ +
+
+
+ + + mocked, AnyTrue() + + + { false, false, true, true, true } contains at least one true + + + + + mocked.m_derefed[0] + + + true + + + + + mocked.m_derefed[1] + + + true + + + + + mocked.m_derefed[2] + + + true + + + + + !(mocked.m_derefed[3]) + + + !false + + + + + !(mocked.m_derefed[4]) + + + !false + + + +
+ +
+ +
+ +
+ + + data, NoneMatch(SizeIs(6)) + + + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } none match has size == 6 + + + + + data, !NoneMatch(Contains(0) && Contains(1)) + + + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains element 1 ) + + + +
+
+ + + needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) + + + { 1, 2, 3, 4, 5 } none match matches undescribed predicate + + + +
+
+
+ + + mocked, noneMatch + + + { 1, 2, 3, 4, 5 } none match matches undescribed predicate + + + + + mocked.m_derefed[0] + + + true + + + + + mocked.m_derefed[1] + + + true + + + + + mocked.m_derefed[2] + + + true + + + + + mocked.m_derefed[3] + + + true + + + + + mocked.m_derefed[4] + + + true + + + +
+ +
+
+
+ + + mocked, !noneMatch + + + { 1, 2, 3, 4, 5 } not none match matches undescribed predicate + + + + + mocked.m_derefed[0] + + + true + + + + + !(mocked.m_derefed[1]) + + + !false + + + + + !(mocked.m_derefed[2]) + + + !false + + + + + !(mocked.m_derefed[3]) + + + !false + + + + + !(mocked.m_derefed[4]) + + + !false + + + +
+ +
+ +
+ +
+
+ + + data, !NoneTrue() + + + { true, true, true, true, true } not contains no true + + + +
+ +
+
+
+ + + data, NoneTrue() + + + { } contains no true + + + +
+ +
+
+
+ + + data, !NoneTrue() + + + { false, false, true, false, false } not contains no true + + + +
+ +
+
+
+ + + data, NoneTrue() + + + { false, false, false, false, false } contains no true + + + +
+ +
+
+
+ + + data, !NoneTrue() + + + { true, true, true, true, true } not contains no true + + + +
+ +
+
+
+ + + data, !NoneTrue() + + + { false, false, true, false, false } not contains no true + + + +
+ +
+
+
+ + + data, NoneTrue() + + + { false, false, false, false, false } contains no true + + + +
+ +
+
+
+ + + mocked, NoneTrue() + + + { false, false, false, false, false } contains no true + + + + + mocked.m_derefed[0] + + + true + + + + + mocked.m_derefed[1] + + + true + + + + + mocked.m_derefed[2] + + + true + + + + + mocked.m_derefed[3] + + + true + + + + + mocked.m_derefed[4] + + + true + + + +
+ +
+
+
+ + + mocked, !NoneTrue() + + + { false, false, true, true, true } not contains no true + + + + + mocked.m_derefed[0] + + + true + + + + + mocked.m_derefed[1] + + + true + + + + + mocked.m_derefed[2] + + + true + + + + + !(mocked.m_derefed[3]) + + + !false + + + + + !(mocked.m_derefed[4]) + + + !false + + + +
+ +
+ +
+ +
+
+ + + empty_vector, RangeEquals( empty_vector ) + + + { } elements are { } + + + +
+ +
+
+
+ + + empty_vector, !RangeEquals( non_empty_vector ) + + + { } not elements are { 1 } + + + + + non_empty_vector, !RangeEquals( empty_vector ) + + + { 1 } not elements are { } + + + +
+ +
+
+
+ + + non_empty_array, RangeEquals( non_empty_array ) + + + { 1 } elements are { 1 } + + + +
+ +
+
+
+ + + array_a, RangeEquals( array_a ) + + + { 1, 2, 3 } elements are { 1, 2, 3 } + + + +
+ +
+
+
+ + + array_a, !RangeEquals( array_b ) + + + { 1, 2, 3 } not elements are { 2, 2, 3 } + + + + + array_a, !RangeEquals( array_c ) + + + { 1, 2, 3 } not elements are { 1, 2, 2 } + + + +
+ +
+
+
+ + + vector_a, !RangeEquals( vector_b ) + + + { 1, 2, 3 } not elements are { 1, 2, 3, 4 } + + + +
+ +
+
+
+ + + vector_a, RangeEquals( vector_a_plus_1, close_enough ) + + + { 1, 2, 3 } elements are { 2, 3, 4 } + + + +
+ +
+
+
+ + + vector_a, !RangeEquals( vector_b, close_enough ) + + + { 1, 2, 3 } not elements are { 3, 3, 4 } + + + +
+ +
+
+ + + needs_adl1, RangeEquals( needs_adl2 ) + + + { 1, 2, 3, 4, 5 } elements are { 1, 2, 3, 4, 5 } + + + + + needs_adl1, RangeEquals( needs_adl3, []( int l, int r ) { return l + 1 == r; } ) + + + { 1, 2, 3, 4, 5 } elements are { 2, 3, 4, 5, 6 } + + + +
+
+
+ + + mocked1, !RangeEquals( arr ) + + + { 1, 2, 3, 4 } not elements are { 1, 2, 4, 4 } + + + + + mocked1.m_derefed[0] + + + true + + + + + mocked1.m_derefed[1] + + + true + + + + + mocked1.m_derefed[2] + + + true + + + + + !(mocked1.m_derefed[3]) + + + !false + + + +
+ +
+
+
+ + + mocked1, RangeEquals( arr ) + + + { 1, 2, 3, 4 } elements are { 1, 2, 3, 4 } + + + + + mocked1.m_derefed[0] + + + true + + + + + mocked1.m_derefed[1] + + + true + + + + + mocked1.m_derefed[2] + + + true + + + + + mocked1.m_derefed[3] + + + true + + + +
+ +
+ +
+ +
+
+ + + empty_vector, UnorderedRangeEquals( empty_vector ) + + + { } unordered elements are { } + + + +
+ +
+
+
+ + + empty_vector, !UnorderedRangeEquals( non_empty_vector ) + + + { } not unordered elements are { 1 } + + + + + non_empty_vector, !UnorderedRangeEquals( empty_vector ) + + + { 1 } not unordered elements are { } + + + +
+ +
+
+
+ + + non_empty_array, UnorderedRangeEquals( non_empty_array ) + + + { 1 } unordered elements are { 1 } + + + +
+ +
+
+
+ + + array_a, UnorderedRangeEquals( array_a ) + + + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + + + +
+ +
+
+
+ + + array_a, !UnorderedRangeEquals( array_b ) + + + { 1, 2, 3 } not unordered elements are { 2, 2, 3 } + + + +
+ +
+
+
+ + + vector_a, !UnorderedRangeEquals( vector_b ) + + + { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } + + + +
+ +
+
+
+ + + vector_a, UnorderedRangeEquals( vector_a_plus_1, close_enough ) + + + { 1, 10, 20 } unordered elements are { 11, 21, 2 } + + + +
+ +
+
+
+ + + vector_a, !UnorderedRangeEquals( vector_b, close_enough ) + + + { 1, 10, 21 } not unordered elements are { 11, 21, 3 } + + + +
+ +
+
+ + + needs_adl1, UnorderedRangeEquals( needs_adl2 ) + + + { 1, 2, 3, 4, 5 } unordered elements are { 1, 2, 3, 4, 5 } + + + +
+ +
+ +
+ + + empty_vec, SizeIs(0) + + + { } has size == 0 + + + + + empty_vec, !SizeIs(2) + + + { } not has size == 2 + + + + + empty_vec, SizeIs(Lt(2)) + + + { } size matches is less than 2 + + + + + arr, SizeIs(2) + + + { 0, 0 } has size == 2 + + + + + arr, SizeIs( Lt(3)) + + + { 0, 0 } size matches is less than 3 + + + + + arr, !SizeIs(!Lt(3)) + + + { 0, 0 } not size matches not is less than 3 + + + + + map, SizeIs(3) + + + { {?}, {?}, {?} } has size == 3 + + + +
+
+ + + unrelated::ADL_size{}, SizeIs(12) + + + {?} has size == 12 + + + +
+
+ + + has_size{}, SizeIs(13) + + + {?} has size == 13 + + + +
+ +
+ + + + d == approx( 1.23 ) + + + 1.22999999999999998 +== +Approx( 1.22999999999999998 ) + + + + + d == approx( 1.22 ) + + + 1.22999999999999998 +== +Approx( 1.21999999999999997 ) + + + + + d == approx( 1.24 ) + + + 1.22999999999999998 +== +Approx( 1.23999999999999999 ) + + + + + d != approx( 1.25 ) + + + 1.22999999999999998 != Approx( 1.25 ) + + + + + approx( d ) == 1.23 + + + Approx( 1.22999999999999998 ) +== +1.22999999999999998 + + + + + approx( d ) == 1.22 + + + Approx( 1.22999999999999998 ) +== +1.21999999999999997 + + + + + approx( d ) == 1.24 + + + Approx( 1.22999999999999998 ) +== +1.23999999999999999 + + + + + approx( d ) != 1.25 + + + Approx( 1.22999999999999998 ) != 1.25 + + + + + +
+ +
+ +
+ +
+ + + empty, Approx( empty ) + + + { } is approx: { } + + + +
+
+
+ + + v1, Approx( v1 ) + + + { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } + + + + + v1, Approx<double>( { 1., 2., 3. } ) + + + { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } + + + +
+ +
+
+
+ + + v1, !Approx( temp ) + + + { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } + + + +
+ +
+
+
+ + + v1, !Approx( v2 ) + + + { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } + + + + + v1, Approx( v2 ).margin( 0.5 ) + + + { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } + + + + + v1, Approx( v2 ).epsilon( 0.5 ) + + + { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } + + + + + v1, Approx( v2 ).epsilon( 0.1 ).scale( 500 ) + + + { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } + + + +
+ +
+ +
+ +
+ + + empty, Approx( t1 ) + + + { } is approx: { 1.0, 2.0 } + + + +
+
+ + + v1, Approx( v2 ) + + + { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } + + + +
+ +
+ +
+ + + v, VectorContains( 1 ) + + + { 1, 2, 3 } Contains: 1 + + + + + v, VectorContains( 2 ) + + + { 1, 2, 3 } Contains: 2 + + + + + v5, ( VectorContains<int, CustomAllocator<int>>( 2 ) ) + + + { 1, 2, 3 } Contains: 2 + + + +
+
+ + + v, Contains( v2 ) + + + { 1, 2, 3 } Contains: { 1, 2 } + + + + + v, Contains<int>( { 1, 2 } ) + + + { 1, 2, 3 } Contains: { 1, 2 } + + + + + v5, ( Contains<int, std::allocator<int>, CustomAllocator<int>>( v2 ) ) + + + { 1, 2, 3 } Contains: { 1, 2 } + + + + + v, Contains( v2 ) + + + { 1, 2, 3 } Contains: { 1, 2, 3 } + + + + + v, Contains( empty ) + + + { 1, 2, 3 } Contains: { } + + + + + empty, Contains( empty ) + + + { } Contains: { } + + + + + v5, ( Contains<int, std::allocator<int>, CustomAllocator<int>>( v2 ) ) + + + { 1, 2, 3 } Contains: { 1, 2, 3 } + + + + + v5, Contains( v6 ) + + + { 1, 2, 3 } Contains: { 1, 2 } + + + +
+
+ + + v, VectorContains( 1 ) && VectorContains( 2 ) + + + { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) + + + +
+
+ + + v, Equals( v ) + + + { 1, 2, 3 } Equals: { 1, 2, 3 } + + + + + empty, Equals( empty ) + + + { } Equals: { } + + + + + v, Equals<int>( { 1, 2, 3 } ) + + + { 1, 2, 3 } Equals: { 1, 2, 3 } + + + + + v, Equals( v2 ) + + + { 1, 2, 3 } Equals: { 1, 2, 3 } + + + + + v5, ( Equals<int, std::allocator<int>, CustomAllocator<int>>( v2 ) ) + + + { 1, 2, 3 } Equals: { 1, 2, 3 } + + + + + v5, Equals( v6 ) + + + { 1, 2, 3 } Equals: { 1, 2, 3 } + + + +
+
+ + + v, UnorderedEquals( v ) + + + { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 } + + + + + v, UnorderedEquals<int>( { 3, 2, 1 } ) + + + { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } + + + + + empty, UnorderedEquals( empty ) + + + { } UnorderedEquals: { } + + + + + permuted, UnorderedEquals( v ) + + + { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } + + + + + permuted, UnorderedEquals( v ) + + + { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 } + + + + + v5, ( UnorderedEquals<int, std::allocator<int>, CustomAllocator<int>>( permuted ) ) + + + { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } + + + + + v5_permuted, UnorderedEquals( v5 ) + + + { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } + + + +
+ +
+ +
+ + + v, VectorContains( -1 ) + + + { 1, 2, 3 } Contains: -1 + + + + + empty, VectorContains( 1 ) + + + { } Contains: 1 + + + +
+
+ + + empty, Contains( v ) + + + { } Contains: { 1, 2, 3 } + + + + + v, Contains( v2 ) + + + { 1, 2, 3 } Contains: { 1, 2, 4 } + + + +
+
+ + + v, Equals( v2 ) + + + { 1, 2, 3 } Equals: { 1, 2 } + + + + + v2, Equals( v ) + + + { 1, 2 } Equals: { 1, 2, 3 } + + + + + empty, Equals( v ) + + + { } Equals: { 1, 2, 3 } + + + + + v, Equals( empty ) + + + { 1, 2, 3 } Equals: { } + + + +
+
+ + + v, UnorderedEquals( empty ) + + + { 1, 2, 3 } UnorderedEquals: { } + + + + + empty, UnorderedEquals( v ) + + + { } UnorderedEquals: { 1, 2, 3 } + + + + + permuted, UnorderedEquals( v ) + + + { 1, 3 } UnorderedEquals: { 1, 2, 3 } + + + + + permuted, UnorderedEquals( v ) + + + { 3, 1 } UnorderedEquals: { 1, 2, 3 } + + + +
+ +
+ + + + thisThrows(), std::domain_error + + + thisThrows(), std::domain_error + + + + + thisDoesntThrow() + + + thisDoesntThrow() + + + + + thisThrows() + + + thisThrows() + + + + + + + unexpected exception + + + + + + + thisThrows() == 0 + + + thisThrows() == 0 + + + expected exception + + + + + + + + thisThrows() == 0 + + + thisThrows() == 0 + + + expected exception + + + + + + + + thisThrows() == 0 + + + thisThrows() == 0 + + + expected exception + + + + + +
+ + unexpected exception + + +
+ +
+ + + + + + + + + + + + + + + + +
+ + + encode( "normal string" ) == "normal string" + + + "normal string" == "normal string" + + + +
+
+ + + encode( "" ) == "" + + + "" == "" + + + +
+
+ + + encode( "smith & jones" ) == "smith &amp; jones" + + + "smith &amp; jones" == "smith &amp; jones" + + + +
+
+ + + encode( "smith < jones" ) == "smith &lt; jones" + + + "smith &lt; jones" == "smith &lt; jones" + + + +
+
+ + + encode( "smith > jones" ) == "smith > jones" + + + "smith > jones" == "smith > jones" + + + + + encode( "smith ]]> jones" ) == "smith ]]&gt; jones" + + + "smith ]]&gt; jones" +== +"smith ]]&gt; jones" + + + +
+
+ + + encode( stringWithQuotes ) == stringWithQuotes + + + "don't "quote" me on that" +== +"don't "quote" me on that" + + + + + encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't &quot;quote&quot; me on that" + + + "don't &quot;quote&quot; me on that" +== +"don't &quot;quote&quot; me on that" + + + +
+
+ + + encode( "[\x01]" ) == "[\\x01]" + + + "[\x01]" == "[\x01]" + + + +
+
+ + + encode( "[\x7F]" ) == "[\\x7F]" + + + "[\x7F]" == "[\x7F]" + + + +
+ +
+ + + + stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") + + + "<?xml version="1.0" encoding="UTF-8"?> +<Element1 attr1="true" attr2="false"/> +" ( contains: "attr1="true"" and contains: "attr2="false"" ) + + + + + + + + + + + + analysis.mean.point.count() == 23 + + + 23.0 == 23 + + + + + analysis.mean.lower_bound.count() == 23 + + + 23.0 == 23 + + + + + analysis.mean.upper_bound.count() == 23 + + + 23.0 == 23 + + + + + analysis.standard_deviation.point.count() == 0 + + + 0.0 == 0 + + + + + analysis.standard_deviation.lower_bound.count() == 0 + + + 0.0 == 0 + + + + + analysis.standard_deviation.upper_bound.count() == 0 + + + 0.0 == 0 + + + + + analysis.outliers.total() == 0 + + + 0 == 0 + + + + + analysis.outliers.low_mild == 0 + + + 0 == 0 + + + + + analysis.outliers.low_severe == 0 + + + 0 == 0 + + + + + analysis.outliers.high_mild == 0 + + + 0 == 0 + + + + + analysis.outliers.high_severe == 0 + + + 0 == 0 + + + + + analysis.outliers.samples_seen == 0 + + + 0 == 0 + + + + + analysis.outlier_variance == 0 + + + 0.0 == 0 + + + + + + + + Catch::Detail::stringify( empty ) == "{ }" + + + "{ }" == "{ }" + + + + + Catch::Detail::stringify( oneValue ) == "{ 42 }" + + + "{ 42 }" == "{ 42 }" + + + + + Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" + + + "{ 42, 250 }" == "{ 42, 250 }" + + + + + +
+ + + model.started == 1 + + + 1 == 1 + + + + + model.finished == 0 + + + 0 == 0 + + + + + model.started == 1 + + + 1 == 1 + + + + + model.finished == 1 + + + 1 == 1 + + + + + called == 1 + + + 1 == 1 + + + +
+
+ + + model.started == 0 + + + 0 == 0 + + + + + model.finished == 0 + + + 0 == 0 + + + + + model.started == 0 + + + 0 == 0 + + + + + model.finished == 0 + + + 0 == 0 + + + + + called == 1 + + + 1 == 1 + + + +
+ +
+ + + + obj.prop != 0 + + + 0x != 0 + + + + + + + + flag + + + true + + + + + testCheckedElse( true ) + + + true + + + + + + + + flag + + + false + + + + + testCheckedElse( false ) + + + false + + + + + + + + flag + + + true + + + + + testCheckedIf( true ) + + + true + + + + + + + + flag + + + false + + + + + testCheckedIf( false ) + + + false + + + + + +
+ + + o.samples_seen == static_cast<int>(x.size()) + + + 6 == 6 + + + + + o.low_severe == los + + + 0 == 0 + + + + + o.low_mild == lom + + + 0 == 0 + + + + + o.high_mild == him + + + 0 == 0 + + + + + o.high_severe == his + + + 0 == 0 + + + + + o.total() == los + lom + him + his + + + 0 == 0 + + + +
+
+ + + o.samples_seen == static_cast<int>(x.size()) + + + 6 == 6 + + + + + o.low_severe == los + + + 1 == 1 + + + + + o.low_mild == lom + + + 0 == 0 + + + + + o.high_mild == him + + + 0 == 0 + + + + + o.high_severe == his + + + 0 == 0 + + + + + o.total() == los + lom + him + his + + + 1 == 1 + + + +
+
+ + + o.samples_seen == static_cast<int>(x.size()) + + + 6 == 6 + + + + + o.low_severe == los + + + 0 == 0 + + + + + o.low_mild == lom + + + 1 == 1 + + + + + o.high_mild == him + + + 0 == 0 + + + + + o.high_severe == his + + + 0 == 0 + + + + + o.total() == los + lom + him + his + + + 1 == 1 + + + +
+
+ + + o.samples_seen == static_cast<int>(x.size()) + + + 6 == 6 + + + + + o.low_severe == los + + + 0 == 0 + + + + + o.low_mild == lom + + + 0 == 0 + + + + + o.high_mild == him + + + 1 == 1 + + + + + o.high_severe == his + + + 0 == 0 + + + + + o.total() == los + lom + him + his + + + 1 == 1 + + + +
+
+ + + o.samples_seen == static_cast<int>(x.size()) + + + 6 == 6 + + + + + o.low_severe == los + + + 0 == 0 + + + + + o.low_mild == lom + + + 0 == 0 + + + + + o.high_mild == him + + + 0 == 0 + + + + + o.high_severe == his + + + 1 == 1 + + + + + o.total() == los + lom + him + his + + + 1 == 1 + + + +
+
+ + + o.samples_seen == static_cast<int>(x.size()) + + + 6 == 6 + + + + + o.low_severe == los + + + 1 == 1 + + + + + o.low_mild == lom + + + 0 == 0 + + + + + o.high_mild == him + + + 1 == 1 + + + + + o.high_severe == his + + + 0 == 0 + + + + + o.total() == los + lom + him + his + + + 2 == 2 + + + +
+ +
+ + + + unsigned_char_var == 1 + + + 1 == 1 + + + + + unsigned_short_var == 1 + + + 1 == 1 + + + + + unsigned_int_var == 1 + + + 1 == 1 + + + + + unsigned_long_var == 1 + + + 1 == 1 + + + + + + + + long_var == unsigned_char_var + + + 1 == 1 + + + + + long_var == unsigned_short_var + + + 1 == 1 + + + + + long_var == unsigned_int_var + + + 1 == 1 + + + + + long_var == unsigned_long_var + + + 1 == 1 + + + + + + + + convertToBits( 0.f ) == 0 + + + 0 == 0 + + + + + convertToBits( -0.f ) == ( 1ULL << 31 ) + + + 2147483648 (0x) +== +2147483648 (0x) + + + + + convertToBits( 0. ) == 0 + + + 0 == 0 + + + + + convertToBits( -0. ) == ( 1ULL << 63 ) + + + 9223372036854775808 (0x) +== +9223372036854775808 (0x) + + + + + convertToBits( std::numeric_limits<float>::denorm_min() ) == 1 + + + 1 == 1 + + + + + convertToBits( std::numeric_limits<double>::denorm_min() ) == 1 + + + 1 == 1 + + + + + + + skipping because answer = 41 + + + skipping because answer = 43 + + + + + + + Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) + + + Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) + + + + + + + + erfc_inv(1.103560) == Approx(-0.09203687623843015) + + + -0.09203687623843014 +== +Approx( -0.09203687623843015 ) + + + + + erfc_inv(1.067400) == Approx(-0.05980291115763361) + + + -0.05980291115763361 +== +Approx( -0.05980291115763361 ) + + + + + erfc_inv(0.050000) == Approx(1.38590382434967796) + + + 1.38590382434967774 +== +Approx( 1.38590382434967796 ) + + + + + + + + res.mean.count() == rate + + + 2000.0 == 2000 (0x) + + + + + res.outliers.total() == 0 + + + 0 == 0 + + + + + +
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ + + + 3 == 4 + + + 3 == 4 + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+ + + + +loose text artifact + + + + + + + + Previous info should not be seen + + + + + + previous unscoped info SHOULD not be seen + + + + + + + + + + + + + l == std::numeric_limits<long long>::max() + + + 9223372036854775807 (0x) +== +9223372036854775807 (0x) + + + + + +
+ + + b > a + + + 0 > 1 + + + +
+
+ + + b > a + + + 1 > 1 + + + +
+
+ + + b > a + + + 2 > 1 + + + +
+
+ + + b > a + + + 3 > 1 + + + +
+
+ + + b > a + + + 4 > 1 + + + +
+
+ + + b > a + + + 5 > 1 + + + +
+
+ + + b > a + + + 6 > 1 + + + +
+
+ + + b > a + + + 7 > 1 + + + +
+
+ + + b > a + + + 8 > 1 + + + +
+
+ + + b > a + + + 9 > 1 + + + +
+ +
+ + + Testing if fib[0] (1) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[1] (1) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[2] (2) is even + + + + ( fib[i] % 2 ) == 0 + + + 0 == 0 + + + + Testing if fib[3] (3) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[4] (5) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[5] (8) is even + + + + ( fib[i] % 2 ) == 0 + + + 0 == 0 + + + + Testing if fib[6] (13) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[7] (21) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + + + + + Catch::makeStream( "%debug" ) + + + Catch::makeStream( "%debug" ) + + + + + +
+ + + !(lval.has_moved) + + + !false + + + +
+
+ + + rval.has_moved + + + true + + + +
+
+ + + *ptr == std::tuple<int, double, int>{1, 2., 3} + + + {?} == {?} + + + +
+ +
+ + + + m == 19. + + + 19.0 == 19.0 + + + + + + + + x == 17 + + + 17 == 17 + + + + + x == 23 + + + 23 == 23 + + + + + r.elapsed.count() == 42 + + + 42 == 42 + + + + + r.result == 23 + + + 23 == 23 + + + + + r.iterations == 1 + + + 1 == 1 + + + + + s.elapsed.count() == 69 + + + 69 == 69 + + + + + s.result == 17 + + + 17 == 17 + + + + + s.iterations == 1 + + + 1 == 1 + + + + + + + info + + + unscoped info + + + and warn may mix + + + info + + + unscoped info + + + they are not cleared after warnings + + + + +
+
+ + + a == b + + + 1 == 2 + + + +
+ +
+
+
+ + + a != b + + + 1 != 2 + + + +
+ +
+
+
+ + + a < b + + + 1 < 2 + + + +
+ +
+ +
+ +
+ + + a != b + + + 1 != 2 + + + + + b != a + + + 2 != 1 + + +
+ + + a != b + + + 1 != 2 + + + +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+ +
+
+ +
+ + +a! +b1! +! + + +
+ + + + s == "7" + + + "7" == "7" + + + + + + + + ti == typeid(int) + + + {?} == {?} + + + + + + + + normal_quantile(0.551780) == Approx(0.13015979861484198) + + + 0.13015979861484195 +== +Approx( 0.13015979861484198 ) + + + + + normal_quantile(0.533700) == Approx(0.08457408802851875) + + + 0.08457408802851875 +== +Approx( 0.08457408802851875 ) + + + + + normal_quantile(0.025000) == Approx(-1.95996398454005449) + + + -1.95996398454005405 +== +Approx( -1.95996398454005449 ) + + + + + + + + + + this MAY be seen only for the FIRST assertion IF info is printed for passing assertions + + + + true + + + true + + + + this MAY be seen only for the SECOND assertion IF info is printed for passing assertions + + + + true + + + true + + + + this SHOULD be seen + + + + false + + + false + + + + + + + + makeString( false ) != static_cast<char*>(0) + + + "valid string" != {null string} + + + + + makeString( true ) == static_cast<char*>(0) + + + {null string} == {null string} + + + + + + + + ptr.get() == 0 + + + 0 == 0 + + + + + + + + ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" + + + "{ { 42, "Arthur" }, { "Ford", 24 } }" +== +"{ { 42, "Arthur" }, { "Ford", 24 } }" + + + + + +
+ + + parseEnums( "" ), Equals( std::vector<Catch::StringRef>{} ) + + + { } Equals: { } + + + +
+
+ + + parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) + + + { Value1 } Equals: { Value1 } + + + + + parseEnums( "Value1" ), Equals( std::vector<Catch::StringRef>{"Value1"} ) + + + { Value1 } Equals: { Value1 } + + + + + parseEnums( "EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) + + + { Value1 } Equals: { Value1 } + + + +
+
+ + + parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2"} ) + + + { Value1, Value2 } Equals: { Value1, Value2 } + + + + + parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) + + + { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } + + + + + parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) + + + { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } + + + +
+ +
+ + + + p == 0 + + + 0 == 0 + + + + + + + this MAY be seen IF info is printed for passing assertions + + + + true + + + true + + + + + + + this SHOULD be seen + + + this SHOULD also be seen + + + + false + + + false + + + + + + + this SHOULD be seen only ONCE + + + + false + + + false + + + + + true + + + true + + + + this MAY also be seen only ONCE IF info is printed for passing assertions + + + + true + + + true + + + + + true + + + true + + + + + +
+ + + a != b + + + 1 != 2 + + + + + b != a + + + 2 != 1 + + + +
+
+ + + a != b + + + 1 != 2 + + + +
+ +
+ +
+ + + Catch::replaceInPlace(letters, "b", "z") + + + true + + + + + letters == "azcdefcg" + + + "azcdefcg" == "azcdefcg" + + + +
+
+ + + Catch::replaceInPlace(letters, "c", "z") + + + true + + + + + letters == "abzdefzg" + + + "abzdefzg" == "abzdefzg" + + + +
+
+ + + Catch::replaceInPlace(letters, "a", "z") + + + true + + + + + letters == "zbcdefcg" + + + "zbcdefcg" == "zbcdefcg" + + + +
+
+ + + Catch::replaceInPlace(letters, "g", "z") + + + true + + + + + letters == "abcdefcz" + + + "abcdefcz" == "abcdefcz" + + + +
+
+ + + Catch::replaceInPlace(letters, letters, "replaced") + + + true + + + + + letters == "replaced" + + + "replaced" == "replaced" + + + +
+
+ + + !(Catch::replaceInPlace(letters, "x", "z")) + + + !false + + + + + letters == letters + + + "abcdefcg" == "abcdefcg" + + + +
+
+
+ + + Catch::replaceInPlace(letters, "c", "cc") + + + true + + + + + letters == "abccdefccg" + + + "abccdefccg" == "abccdefccg" + + + +
+ +
+
+
+ + + Catch::replaceInPlace(s, "--", "-") + + + true + + + + + s == "--" + + + "--" == "--" + + + +
+ +
+
+ + + Catch::replaceInPlace(s, "'", "|'") + + + true + + + + + s == "didn|'t" + + + "didn|'t" == "didn|'t" + + + +
+ +
+ + + + Catch::makeStream( "%somestream" ) + + + Catch::makeStream( "%somestream" ) + + + + + + + + res.size() == count + + + 10 == 10 + + + + + res[i] == rate + + + 1000.0 == 1000 (0x) + + + + + res[i] == rate + + + 1000.0 == 1000 (0x) + + + + + res[i] == rate + + + 1000.0 == 1000 (0x) + + + + + res[i] == rate + + + 1000.0 == 1000 (0x) + + + + + res[i] == rate + + + 1000.0 == 1000 (0x) + + + + + res[i] == rate + + + 1000.0 == 1000 (0x) + + + + + res[i] == rate + + + 1000.0 == 1000 (0x) + + + + + res[i] == rate + + + 1000.0 == 1000 (0x) + + + + + res[i] == rate + + + 1000.0 == 1000 (0x) + + + + + + + + meter.runs() >= old_runs + + + 1 >= 1 + + + + + meter.runs() >= old_runs + + + 2 >= 1 + + + + + meter.runs() >= old_runs + + + 4 >= 2 + + + + + meter.runs() >= old_runs + + + 8 >= 4 + + + + + meter.runs() >= old_runs + + + 16 >= 8 + + + + + meter.runs() >= old_runs + + + 32 >= 16 + + + + + meter.runs() >= old_runs + + + 64 >= 32 + + + + + meter.runs() >= old_runs + + + 128 >= 64 + + + + + Timing.elapsed >= time + + + 128 ns >= 100 ns + + + + + Timing.result == Timing.iterations + 17 + + + 145 == 145 + + + + + Timing.iterations >= time.count() + + + 128 >= 100 + + + + + + + + x >= old_x + + + 1 >= 1 + + + + + x >= old_x + + + 2 >= 1 + + + + + x >= old_x + + + 4 >= 2 + + + + + x >= old_x + + + 8 >= 4 + + + + + x >= old_x + + + 16 >= 8 + + + + + x >= old_x + + + 32 >= 16 + + + + + x >= old_x + + + 64 >= 32 + + + + + x >= old_x + + + 128 >= 64 + + + + + Timing.elapsed >= time + + + 128 ns >= 100 ns + + + + + Timing.result == Timing.iterations + 17 + + + 145 == 145 + + + + + Timing.iterations >= time.count() + + + 128 >= 100 + + + + + + + + +
+ +
+
+ + +
+
+ +
+ +
+ + + 3 + + + + false + + + false + + + + + + + hi + + + i := 7 + + + + false + + + false + + + + + + + + testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) + + + { {?}, {?} } ( Contains: {?} and Contains: {?} ) + + + + + + + skipping because answer = 43 + + + + + + + splitStringRef("", ','), Equals(std::vector<StringRef>()) + + + { } Equals: { } + + + + + splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) + + + { abc } Equals: { abc } + + + + + splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) + + + { abc, def } Equals: { abc, def } + + + + + + + Count 1 to 3... + + + 1 + + + 2 + + + 3 + + + + false + + + false + + + + Count 4 to 6... + + + 4 + + + 5 + + + 6 + + + + false + + + false + + + + + + + + !(startsWith("", 'c')) + + + !false + + + + + startsWith(std::string("abc"), 'a') + + + true + + + + + startsWith("def"_catch_sr, 'd') + + + true + + + + + +
+ + + Catch::Detail::stringify( emptyMap ) == "{ }" + + + "{ }" == "{ }" + + + +
+
+ + + Catch::Detail::stringify( map ) == "{ { \"one\", 1 } }" + + + "{ { "one", 1 } }" == "{ { "one", 1 } }" + + + +
+
+ + + Catch::Detail::stringify( map ) == "{ { \"abc\", 1 }, { \"def\", 2 }, { \"ghi\", 3 } }" + + + "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }" +== +"{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }" + + + +
+ +
+ + + + ::Catch::Detail::stringify(value) == "{ 34, \"xyzzy\" }" + + + "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" + + + + + + + + ::Catch::Detail::stringify( value ) == "{ 34, \"xyzzy\" }" + + + "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" + + + + + +
+ + + Catch::Detail::stringify( emptySet ) == "{ }" + + + "{ }" == "{ }" + + + +
+
+ + + Catch::Detail::stringify( set ) == "{ \"one\" }" + + + "{ "one" }" == "{ "one" }" + + + +
+
+ + + Catch::Detail::stringify( set ) == "{ \"abc\", \"def\", \"ghi\" }" + + + "{ "abc", "def", "ghi" }" +== +"{ "abc", "def", "ghi" }" + + + +
+ +
+ + + + ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" + + + "{ { "green", 55 } }" +== +"{ { "green", 55 } }" + + + + + + + + Catch::makeStream( "%stderr" )->isConsole() + + + true + + + + + Catch::makeStream( "%stdout" )->isConsole() + + + true + + + + + + + + ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" + + + "op<<(streamable_range)" +== +"op<<(streamable_range)" + + + + + ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)" + + + "stringmaker(streamable_range)" +== +"stringmaker(streamable_range)" + + + + + ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" + + + "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }" + + + + + ::Catch::Detail::stringify(disabled_range{}) == "{?}" + + + "{?}" == "{?}" + + + + + + + + ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>" + + + "StringMaker<has_maker>" +== +"StringMaker<has_maker>" + + + + + + + + ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" + + + "StringMaker<has_maker_and_operator>" +== +"StringMaker<has_maker_and_operator>" + + + + + + + + ::Catch::Detail::stringify(item) == "{?}" + + + "{?}" == "{?}" + + + + + + + + ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" + + + "operator<<( has_operator )" +== +"operator<<( has_operator )" + + + + + + + + ::Catch::Detail::stringify( item ) == "operator<<( has_template_operator )" + + + "operator<<( has_template_operator )" +== +"operator<<( has_template_operator )" + + + + + + + + ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" + + + "{ StringMaker<has_maker> }" +== +"{ StringMaker<has_maker> }" + + + + + + + + ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_operator> }" + + + "{ StringMaker<has_maker_and_operator> }" +== +"{ StringMaker<has_maker_and_operator> }" + + + + + + + + ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" + + + "{ operator<<( has_operator ) }" +== +"{ operator<<( has_operator ) }" + + + + + + + + data.str.size() == data.len + + + 3 == 3 + + + + + data.str.size() == data.len + + + 3 == 3 + + + + + data.str.size() == data.len + + + 5 == 5 + + + + + data.str.size() == data.len + + + 4 == 4 + + + + + + + + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + + + 5 == 5 + + + + + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + + + 6 == 6 + + + + + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + + + 5 == 5 + + + + + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + + + 6 == 6 + + + + + + + + testcase.tags.size() == 1 + + + 1 == 1 + + + + + testcase.tags[0].original == "magic.tag"_catch_sr + + + magic.tag == magic.tag + + + + + + + + + + + Why would you throw a std::string? + + + + + + + result == "\"wide load\"" + + + ""wide load"" == ""wide load"" + + + + + + + + result == "\"wide load\"" + + + ""wide load"" == ""wide load"" + + + + + + + + result == "\"wide load\"" + + + ""wide load"" == ""wide load"" + + + + + + + + result == "\"wide load\"" + + + ""wide load"" == ""wide load"" + + + + + + + + ::Catch::Detail::stringify(e0) == "E2/V0" + + + "E2/V0" == "E2/V0" + + + + + ::Catch::Detail::stringify(e1) == "E2/V1" + + + "E2/V1" == "E2/V1" + + + + + ::Catch::Detail::stringify(e3) == "Unknown enum value 10" + + + "Unknown enum value 10" +== +"Unknown enum value 10" + + + + + + + + ::Catch::Detail::stringify(e0) == "0" + + + "0" == "0" + + + + + ::Catch::Detail::stringify(e1) == "1" + + + "1" == "1" + + + + + + + + ::Catch::Detail::stringify(e0) == "E2{0}" + + + "E2{0}" == "E2{0}" + + + + + ::Catch::Detail::stringify(e1) == "E2{1}" + + + "E2{1}" == "E2{1}" + + + + + + + + ::Catch::Detail::stringify(e0) == "0" + + + "0" == "0" + + + + + ::Catch::Detail::stringify(e1) == "1" + + + "1" == "1" + + + + + + + + "{ }" == ::Catch::Detail::stringify(type{}) + + + "{ }" == "{ }" + + + + + "{ }" == ::Catch::Detail::stringify(value) + + + "{ }" == "{ }" + + + + + + + + "1.5f" == ::Catch::Detail::stringify(float(1.5)) + + + "1.5f" == "1.5f" + + + + + "{ 1.5f, 0 }" == ::Catch::Detail::stringify(type{1.5f,0}) + + + "{ 1.5f, 0 }" == "{ 1.5f, 0 }" + + + + + + + + "{ 0 }" == ::Catch::Detail::stringify(type{0}) + + + "{ 0 }" == "{ 0 }" + + + + + + + + "{ \"hello\", \"world\" }" == ::Catch::Detail::stringify(type{"hello","world"}) + + + "{ "hello", "world" }" +== +"{ "hello", "world" }" + + + + + + + + "{ { 42 }, { }, 1.5f }" == ::Catch::Detail::stringify(value) + + + "{ { 42 }, { }, 1.5f }" +== +"{ { 42 }, { }, 1.5f }" + + + + + + + + e.point == 23 + + + 23.0 == 23 + + + + + e.upper_bound == 23 + + + 23.0 == 23 + + + + + e.lower_bound == 23 + + + 23.0 == 23 + + + + + e.confidence_interval == 0.95 + + + 0.94999999999999996 == 0.94999999999999996 + + + + + + + + dist.a() == -10 + + + -10 == -10 + + + + + dist.b() == 10 + + + 10 == 10 + + + + + +
+ + + !(ptr) + + + !{?} + + + + + ptr.get() == 0 + + + 0 == 0 + + + +
+
+ + + ptr + + + {?} + + + + + *ptr == 0 + + + 0 == 0 + + + + + ptr.get() == naked_ptr + + + 0x == 0x + + +
+ + + !(ptr) + + + !{?} + + + + + ptr.get() == 0 + + + 0 == 0 + + + +
+ +
+
+ + + ptr + + + {?} + + + + + *ptr == 0 + + + 0 == 0 + + + + + ptr.get() == naked_ptr + + + 0x == 0x + + +
+ + + ptr + + + {?} + + + + + ptr.get() != 0 + + + 0x != 0 + + + + + *ptr == 2 + + + 2 == 2 + + + +
+ +
+
+ + + !(ptr) + + + !{?} + + + + + ptr.get() == 0 + + + 0 == 0 + + + +
+
+ + + !(ptr1) + + + !{?} + + + + + ptr2 + + + {?} + + + + + *ptr2 == 1 + + + 1 == 1 + + + +
+
+ + + !(ptr2) + + + !{?} + + + + + ptr1 + + + {?} + + + + + *ptr1 == 2 + + + 2 == 2 + + + +
+
+ + + *ptr1 == 2 + + + 2 == 2 + + + + + *ptr2 == 1 + + + 1 == 1 + + + +
+ +
+ + + + ::Catch::Detail::stringify(v) == "{ }" + + + "{ }" == "{ }" + + + + + ::Catch::Detail::stringify(v) == "{ { \"hello\" }, { \"world\" } }" + + + "{ { "hello" }, { "world" } }" +== +"{ { "hello" }, { "world" } }" + + + + + + + + ::Catch::Detail::stringify(bools) == "{ }" + + + "{ }" == "{ }" + + + + + ::Catch::Detail::stringify(bools) == "{ true }" + + + "{ true }" == "{ true }" + + + + + ::Catch::Detail::stringify(bools) == "{ true, false }" + + + "{ true, false }" == "{ true, false }" + + + + + + + + ::Catch::Detail::stringify(vv) == "{ }" + + + "{ }" == "{ }" + + + + + ::Catch::Detail::stringify(vv) == "{ 42 }" + + + "{ 42 }" == "{ 42 }" + + + + + ::Catch::Detail::stringify(vv) == "{ 42, 250 }" + + + "{ 42, 250 }" == "{ 42, 250 }" + + + + + + + + ::Catch::Detail::stringify(vv) == "{ }" + + + "{ }" == "{ }" + + + + + ::Catch::Detail::stringify(vv) == "{ 42 }" + + + "{ 42 }" == "{ 42 }" + + + + + ::Catch::Detail::stringify(vv) == "{ 42, 250 }" + + + "{ 42, 250 }" == "{ 42, 250 }" + + + + + + + + ::Catch::Detail::stringify(vv) == "{ }" + + + "{ }" == "{ }" + + + + + ::Catch::Detail::stringify(vv) == "{ \"hello\" }" + + + "{ "hello" }" == "{ "hello" }" + + + + + ::Catch::Detail::stringify(vv) == "{ \"hello\", \"world\" }" + + + "{ "hello", "world" }" +== +"{ "hello", "world" }" + + + + + + + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.capacity() == 0 + + + 0 == 0 + + + +
+ +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + + +
+ +
+ + + + (iterations * rate) > Catch::Benchmark::Detail::warmup_time.count() + + + 160000000 (0x) > 100 + + + + + (end - start) > Catch::Benchmark::Detail::warmup_time + + + 310016000 ns > 100 ms + + + + + + + + q1 == 14.5 + + + 14.5 == 14.5 + + + + + med == 18. + + + 18.0 == 18.0 + + + + + q3 == 23. + + + 23.0 == 23.0 + + + + + +
+ +
+
+ +
+ +
+ + +
diff --git a/tests/SelfTest/UsageTests/Class.tests.cpp b/tests/SelfTest/UsageTests/Class.tests.cpp index 682171daea..2a9d766664 100644 --- a/tests/SelfTest/UsageTests/Class.tests.cpp +++ b/tests/SelfTest/UsageTests/Class.tests.cpp @@ -32,6 +32,10 @@ namespace { int m_a; }; + struct Persistent_Fixture { + int m_a = 0; + }; + template struct Template_Fixture { Template_Fixture(): m_a( 1 ) {} @@ -64,6 +68,17 @@ TEST_CASE_METHOD( Fixture, "A TEST_CASE_METHOD based test run that succeeds", "[ REQUIRE( m_a == 1 ); } +TEST_CASE_FIXTURE( Persistent_Fixture, "A TEST_CASE_FIXTURE based test run that succeeds", "[class]" ) +{ + SECTION( "First partial run" ) { + REQUIRE( m_a++ == 0 ); + } + + SECTION( "Second partial run" ) { + REQUIRE( m_a == 1 ); + } +} + TEMPLATE_TEST_CASE_METHOD(Template_Fixture, "A TEMPLATE_TEST_CASE_METHOD based test run that succeeds", "[class][template]", int, float, double) { REQUIRE( Template_Fixture::m_a == 1 ); } @@ -96,6 +111,17 @@ namespace Inner REQUIRE( m_a == 2 ); } + TEST_CASE_FIXTURE( Persistent_Fixture, "A TEST_CASE_FIXTURE based test run that fails", "[.][class][failing]" ) + { + SECTION( "First partial run" ) { + REQUIRE( m_a++ == 0 ); + } + + SECTION( "Second partial run" ) { + REQUIRE( m_a == 0 ); + } + } + TEMPLATE_TEST_CASE_METHOD(Template_Fixture,"A TEMPLATE_TEST_CASE_METHOD based test run that fails", "[.][class][template][failing]", int, float, double) { REQUIRE( Template_Fixture::m_a == 2 ); From 031cd554ab110d4a87ab37cfc5540dd39a0811e5 Mon Sep 17 00:00:00 2001 From: KStocky Date: Sat, 6 Jul 2024 22:33:34 +0100 Subject: [PATCH 04/16] Adding unapproved.txt files to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index be955e6cd9..51af14e3ec 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ msvc-sln* docs/doxygen *.cache compile_commands.json +**/*.unapproved.txt From 390a39e08f0df1ba86a578e6a0ff59d6271ea50e Mon Sep 17 00:00:00 2001 From: KStocky Date: Sun, 7 Jul 2024 14:19:07 +0100 Subject: [PATCH 05/16] Make Fixture example clearer --- examples/Fixture.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/Fixture.cpp b/examples/Fixture.cpp index 82a12d1dcb..dde1d50306 100644 --- a/examples/Fixture.cpp +++ b/examples/Fixture.cpp @@ -15,12 +15,15 @@ struct MyFixture{ int MyInt = 0; }; -TEST_CASE_FIXTURE(MyFixture, "Tests with MyFixture") { +TEST_CASE_FIXTURE(MyFixture, "Tests with MyFixture") { + + const int val = MyInt++; + SECTION("First partial run") { - REQUIRE(MyInt++ == 0); + REQUIRE(val == 0); } SECTION("Second partial run") { - REQUIRE(MyInt == 1); + REQUIRE(val == 1); } } \ No newline at end of file From bbb7313a64257ec6ef1ca1ff04655daa9900c714 Mon Sep 17 00:00:00 2001 From: KStocky Date: Sun, 7 Jul 2024 14:31:02 +0100 Subject: [PATCH 06/16] Added documentation for TEST_CASE_FIXTURE as well as reorganised some of the existing documentation around the existing test fixture macros. --- docs/other-macros.md | 24 ---------------- docs/test-fixtures.md | 66 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 27 deletions(-) diff --git a/docs/other-macros.md b/docs/other-macros.md index 24a0fb6e6f..79990a6a5f 100644 --- a/docs/other-macros.md +++ b/docs/other-macros.md @@ -93,30 +93,6 @@ TEST_CASE("STATIC_CHECK showcase", "[traits]") { ## Test case related macros -* `METHOD_AS_TEST_CASE` - -`METHOD_AS_TEST_CASE( member-function-pointer, description )` lets you -register a member function of a class as a Catch2 test case. The class -will be separately instantiated for each method registered in this way. - -```cpp -class TestClass { - std::string s; - -public: - TestClass() - :s( "hello" ) - {} - - void testCase() { - REQUIRE( s == "hello" ); - } -}; - - -METHOD_AS_TEST_CASE( TestClass::testCase, "Use class's method as a test case", "[class]" ) -``` - * `REGISTER_TEST_CASE` `REGISTER_TEST_CASE( function, description )` let's you register diff --git a/docs/test-fixtures.md b/docs/test-fixtures.md index 9c9eaa18c0..3a0bfcb7b7 100644 --- a/docs/test-fixtures.md +++ b/docs/test-fixtures.md @@ -1,9 +1,20 @@ # Test fixtures -## Defining test fixtures +## Non-Templated test fixtures -Although Catch allows you to group tests together as [sections within a test case](test-cases-and-sections.md), it can still be convenient, sometimes, to group them using a more traditional test fixture. Catch fully supports this too. You define the test fixture as a simple structure: +Although Catch allows you to group tests together as [sections within a test case](test-cases-and-sections.md), it can still be convenient, sometimes, to group them using a more traditional test fixture. Catch fully supports this too with 3 different macros for non-templated test fixtures. They are: + +| Macro | Description | +|----------|-------------| +|1. `TEST_CASE_METHOD(className, ...)`| Creates a uniquely named class which inherits from the class specified by `className`. The test function will be a member of this derived class. An instance of the derived class will be created for every partial run of the test case. | +|2. `METHOD_AS_TEST_CASE(member-function, ...)`| Uses `member-function` as the test function. An instance of the class will be created for each partial run of the test case. | +|3. `TEST_CASE_FIXTURE(className, ...)`| Creates a uniquely named class which inherits from the class specified by `className`. The test function will be a member of this derived class. An instance of the derived class will be created at the start of the test run. That instance will be destroyed once the entire test case has ended. | + +### 1. `TEST_CASE_METHOD` + + +You define a `TEST_CASE_METHOD` test fixture as a simple structure: ```c++ class UniqueTestsFixture { @@ -30,8 +41,57 @@ class UniqueTestsFixture { } ``` -The two test cases here will create uniquely-named derived classes of UniqueTestsFixture and thus can access the `getID()` protected method and `conn` member variables. This ensures that both the test cases are able to create a DBConnection using the same method (DRY principle) and that any ID's created are unique such that the order that tests are executed does not matter. +The two test cases here will create uniquely-named derived classes of UniqueTestsFixture and thus can access the `getID()` protected method and `conn` member variables. This ensures that both the test cases are able to create a DBConnection using the same method (DRY principle) and that any ID's created are unique such that the order that tests are executed does not matter. + +### 2. `METHOD_AS_TEST_CASE` + +`METHOD_AS_TEST_CASE` lets you register a member function of a class as a Catch2 test case. The class will be separately instantiated for each method registered in this way. + +```cpp +class TestClass { + std::string s; + +public: + TestClass() + :s( "hello" ) + {} + + void testCase() { + REQUIRE( s == "hello" ); + } +}; + + +METHOD_AS_TEST_CASE( TestClass::testCase, "Use class's method as a test case", "[class]" ) +``` + +This type of fixture is similar to [TEST_CASE_METHOD](#1-test_case_method) except in this case it will directly use the provided class to create an object rather than a derived class. + +### 3. `TEST_CASE_FIXTURE` + +`TEST_CASE_FIXTURE` behaves in the same way as [TEST_CASE_METHOD](#1-test_case_method) except that there will only be one instance created throughout the entire run of a test case. To demonstrate this have a look at the following example: + +```cpp +struct MyFixture{ + int MyInt = 0; +}; + +TEST_CASE_FIXTURE(MyFixture, "Tests with MyFixture") { + + const int val = MyInt++; + + SECTION("First partial run") { + REQUIRE(val == 0); + } + + SECTION("Second partial run") { + REQUIRE(val == 1); + } +} +``` +This test case will be executed twice as there are two leaf sections. On the first run `val` will be `0` and on the second run `val` will be `1`. This is useful if you would like to share some expensive setup code with all runs of your test case which can't be done at static initialization time. +## Templated test fixtures Catch2 also provides `TEMPLATE_TEST_CASE_METHOD` and `TEMPLATE_PRODUCT_TEST_CASE_METHOD` that can be used together From 8c777bc20b2278abd77971eb96852883700202c5 Mon Sep 17 00:00:00 2001 From: KStocky Date: Sun, 7 Jul 2024 14:38:49 +0100 Subject: [PATCH 07/16] Ran updateDocumentToC.py to generate new tables of contents --- docs/cmake-integration.md | 1 + docs/test-fixtures.md | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/cmake-integration.md b/docs/cmake-integration.md index a1bb435838..ad6ca00455 100644 --- a/docs/cmake-integration.md +++ b/docs/cmake-integration.md @@ -8,6 +8,7 @@ [`CATCH_CONFIG_*` customization options in CMake](#catch_config_-customization-options-in-cmake)
[Installing Catch2 from git repository](#installing-catch2-from-git-repository)
[Installing Catch2 from vcpkg](#installing-catch2-from-vcpkg)
+[Installing Catch2 from Bazel](#installing-catch2-from-bazel)
Because we use CMake to build Catch2, we also provide a couple of integration points for our users. diff --git a/docs/test-fixtures.md b/docs/test-fixtures.md index 3a0bfcb7b7..ec259c6b5f 100644 --- a/docs/test-fixtures.md +++ b/docs/test-fixtures.md @@ -1,6 +1,12 @@ # Test fixtures +**Contents**
+[Non-Templated test fixtures](#non-templated-test-fixtures)
+[Templated test fixtures](#templated-test-fixtures)
+[Signature-based parameterised test fixtures](#signature-based-parametrised-test-fixtures)
+[Template fixtures with types specified in template type lists](#template-fixtures-with-types-specified-in-template-type-lists)
+ ## Non-Templated test fixtures Although Catch allows you to group tests together as [sections within a test case](test-cases-and-sections.md), it can still be convenient, sometimes, to group them using a more traditional test fixture. Catch fully supports this too with 3 different macros for non-templated test fixtures. They are: @@ -153,7 +159,7 @@ _While there is an upper limit on the number of types you can specify in single `TEMPLATE_TEST_CASE_METHOD` or `TEMPLATE_PRODUCT_TEST_CASE_METHOD`, the limit is very high and should not be encountered in practice._ -## Signature-based parametrised test fixtures +## Signature-based parameterised test fixtures > [Introduced](https://github.com/catchorg/Catch2/issues/1609) in Catch2 2.8.0. From 2680cb0e09462f00416c0adadcc78e5091b800f1 Mon Sep 17 00:00:00 2001 From: KStocky Date: Sun, 7 Jul 2024 14:40:59 +0100 Subject: [PATCH 08/16] Add version placeholder for TEST_CASE_FIXTURE macro --- docs/test-fixtures.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/test-fixtures.md b/docs/test-fixtures.md index ec259c6b5f..63a6774b87 100644 --- a/docs/test-fixtures.md +++ b/docs/test-fixtures.md @@ -75,6 +75,8 @@ This type of fixture is similar to [TEST_CASE_METHOD](#1-test_case_method) excep ### 3. `TEST_CASE_FIXTURE` +> [Introduced](link-to-issue-or-PR) in Catch2 X.Y.Z + `TEST_CASE_FIXTURE` behaves in the same way as [TEST_CASE_METHOD](#1-test_case_method) except that there will only be one instance created throughout the entire run of a test case. To demonstrate this have a look at the following example: ```cpp From e83ff3fe65a263bd6f1dfdcfd7769e35160d61e4 Mon Sep 17 00:00:00 2001 From: KStocky Date: Sun, 7 Jul 2024 15:23:43 +0100 Subject: [PATCH 09/16] Remove unapproved.txt that was accidently committed --- .../SelfTest/Baselines/xml.sw.unapproved.txt | 21887 ---------------- 1 file changed, 21887 deletions(-) delete mode 100644 tests/SelfTest/Baselines/xml.sw.unapproved.txt diff --git a/tests/SelfTest/Baselines/xml.sw.unapproved.txt b/tests/SelfTest/Baselines/xml.sw.unapproved.txt deleted file mode 100644 index dffc0e617a..0000000000 --- a/tests/SelfTest/Baselines/xml.sw.unapproved.txt +++ /dev/null @@ -1,21887 +0,0 @@ - - - - - - - - - y.v == 0 - - - 0 == 0 - - - - - 0 == y.v - - - 0 == 0 - - - - - - - - t1 == t2 - - - {?} == {?} - - - - - t1 != t2 - - - {?} != {?} - - - - - t1 < t2 - - - {?} < {?} - - - - - t1 > t2 - - - {?} > {?} - - - - - t1 <= t2 - - - {?} <= {?} - - - - - t1 >= t2 - - - {?} >= {?} - - - - - - - - - - uarr := "123" - - - sarr := "456" - - - - std::memcmp(uarr, "123", sizeof(uarr)) == 0 - - - 0 == 0 - - - - uarr := "123" - - - sarr := "456" - - - - std::memcmp(sarr, "456", sizeof(sarr)) == 0 - - - 0 == 0 - - - - - - - - -
- -
- -
- - - - h1 == h2 - - - [1403 helper] == [1403 helper] - - - - - - - -This info message starts with a linebreak - - - -This warning message starts with a linebreak - - - - - - 1514 - - - -This would not be caught previously - - -Nor would this - - - - - - - std::is_same<TypeList<int>, TypeList<int>>::value - - - true - - - - - - - - spec.matches(*fakeTestCase("spec . char")) - - - true - - - - - spec.matches(*fakeTestCase("spec , char")) - - - true - - - - - !(spec.matches(*fakeTestCase(R"(spec \, char)"))) - - - !false - - - - - -
- - - spec.matches(*fakeTestCase(R"(spec {a} char)")) - - - true - - - - - spec.matches(*fakeTestCase(R"(spec [a] char)")) - - - true - - - - - !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) - - - !false - - - -
-
- - - spec.matches(*fakeTestCase(R"(spec \ char)")) - - - true - - - -
- -
- - - - counter < 7 - - - 3 < 7 - - - - - counter < 7 - - - 6 < 7 - - - - - - - - i != j - - - 1 != 3 - - - - - i != j - - - 1 != 4 - - - - - i != j - - - 2 != 3 - - - - - i != j - - - 2 != 4 - - - - - -
- -
-
- - - m - - - 1 - - - -
-
- - - m - - - 2 - - - -
-
- - - m - - - 3 - - - -
- -
- -
- - - 1 - - - 1 - - - -
- - - m - - - 2 - - - - - m - - - 3 - - - -
- - - - m - - - 1 - - - - - m - - - 2 - - - - - m - - - 3 - - - - - -
- -
- - i := 1 - - - j := 3 - - - k := 5 - -
- -
- - i := 1 - - - j := 3 - - - k := 6 - -
- -
- - i := 1 - - - j := 4 - - - k := 5 - - - i := 1 - - - j := 4 - - - k := 6 - -
- -
- - i := 2 - - - j := 3 - - - k := 5 - -
- -
- - i := 2 - - - j := 3 - - - k := 6 - -
- -
- - i := 2 - - - j := 4 - - - k := 5 - - - i := 2 - - - j := 4 - - - k := 6 - - -
- - - - m - - - 1 - - - - - n - - - 1 - - - - - m - - - 1 - - - - - n - - - 2 - - - - - m - - - 1 - - - - - n - - - 3 - - - - - m - - - 2 - - - - - n - - - 1 - - - - - m - - - 2 - - - - - n - - - 2 - - - - - m - - - 2 - - - - - n - - - 3 - - - - - m - - - 3 - - - - - n - - - 1 - - - - - m - - - 3 - - - - - n - - - 2 - - - - - m - - - 3 - - - - - n - - - 3 - - - - - - - - - - - - - - - - - smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) - - - 0.0 is within 2 ULPs of -4.9406564584124654e-324 ([-1.4821969375237396e-323, 4.9406564584124654e-324]) - - - - - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) - - - 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e-324, -0.0000000000000000e+00]) - - - - - - - - smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) - - - 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) - - - - - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) - - - 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) - - - - - - - failure to init - - - - -
- - answer := 42 - - - expected exception - - -
-
- - answer := 42 - - - - thisThrows() - - - thisThrows() - - - expected exception - - - -
-
- - answer := 42 - - - - thisThrows() - - - thisThrows() - - - -
- -
- - - - 42 == f - - - 42 == {?} - - - - - - - - a == t - - - 3 == 3 - - - - - a == t - - - 3 == 3 - - - - - throws_int(true) - - - throws_int(true) - - - - - throws_int(true), int - - - throws_int(true), int - - - - - throws_int(false) - - - throws_int(false) - - - - - "aaa", Catch::Matchers::EndsWith("aaa") - - - "aaa" ends with: "aaa" - - - - - templated_tests<int>(3) - - - true - - - - - - - - f() == 0 - - - 1 == 0 - - - - - errno_after == 1 - - - 1 == 1 - - - - - - - dummy := 0 - - - - x == 4 - - - {?} == 4 - - - - - -
- -
-
- -
-
- -
-
- -
-
- -
- -
- - - - false != false - - - false != false - - - - - true != true - - - true != true - - - - - !true - - - false - - - - - !(true) - - - !true - - - - - !trueValue - - - false - - - - - !(trueValue) - - - !true - - - - - !(1 == 1) - - - false - - - - - !(1 == 1) - - - !(1 == 1) - - - - - - - - false == false - - - false == false - - - - - true == true - - - true == true - - - - - !false - - - true - - - - - !(false) - - - !false - - - - - !falseValue - - - true - - - - - !(falseValue) - - - !false - - - - - !(1 == 2) - - - true - - - - - !(1 == 2) - - - !(1 == 2) - - - - - -
- - - is_true<true>::value == true - - - true == true - - - - - true == is_true<true>::value - - - true == true - - - -
-
- - - is_true<false>::value == false - - - false == false - - - - - false == is_true<false>::value - - - false == false - - - -
-
- - - !is_true<false>::value - - - true - - - -
-
- - - !!is_true<true>::value - - - true - - - -
-
- - - is_true<true>::value - - - true - - - - - !(is_true<false>::value) - - - !false - - - -
- -
- - - - x < y - - - 1 < 4 - - - - - y < z - - - 4 < 7 - - - - - x < z - - - 1 < 7 - - - - - x < y - - - 1 < 4 - - - - - y < z - - - 4 < 8 - - - - - x < z - - - 1 < 8 - - - - - x < y - - - 1 < 4 - - - - - y < z - - - 4 < 9 - - - - - x < z - - - 1 < 9 - - - - - x < y - - - 1 < 5 - - - - - y < z - - - 5 < 7 - - - - - x < z - - - 1 < 7 - - - - - x < y - - - 1 < 5 - - - - - y < z - - - 5 < 8 - - - - - x < z - - - 1 < 8 - - - - - x < y - - - 1 < 5 - - - - - y < z - - - 5 < 9 - - - - - x < z - - - 1 < 9 - - - - - x < y - - - 1 < 6 - - - - - y < z - - - 6 < 7 - - - - - x < z - - - 1 < 7 - - - - - x < y - - - 1 < 6 - - - - - y < z - - - 6 < 8 - - - - - x < z - - - 1 < 8 - - - - - x < y - - - 1 < 6 - - - - - y < z - - - 6 < 9 - - - - - x < z - - - 1 < 9 - - - - - x < y - - - 2 < 4 - - - - - y < z - - - 4 < 7 - - - - - x < z - - - 2 < 7 - - - - - x < y - - - 2 < 4 - - - - - y < z - - - 4 < 8 - - - - - x < z - - - 2 < 8 - - - - - x < y - - - 2 < 4 - - - - - y < z - - - 4 < 9 - - - - - x < z - - - 2 < 9 - - - - - x < y - - - 2 < 5 - - - - - y < z - - - 5 < 7 - - - - - x < z - - - 2 < 7 - - - - - x < y - - - 2 < 5 - - - - - y < z - - - 5 < 8 - - - - - x < z - - - 2 < 8 - - - - - x < y - - - 2 < 5 - - - - - y < z - - - 5 < 9 - - - - - x < z - - - 2 < 9 - - - - - x < y - - - 2 < 6 - - - - - y < z - - - 6 < 7 - - - - - x < z - - - 2 < 7 - - - - - x < y - - - 2 < 6 - - - - - y < z - - - 6 < 8 - - - - - x < z - - - 2 < 8 - - - - - x < y - - - 2 < 6 - - - - - y < z - - - 6 < 9 - - - - - x < z - - - 2 < 9 - - - - - x < y - - - 3 < 4 - - - - - y < z - - - 4 < 7 - - - - - x < z - - - 3 < 7 - - - - - x < y - - - 3 < 4 - - - - - y < z - - - 4 < 8 - - - - - x < z - - - 3 < 8 - - - - - x < y - - - 3 < 4 - - - - - y < z - - - 4 < 9 - - - - - x < z - - - 3 < 9 - - - - - x < y - - - 3 < 5 - - - - - y < z - - - 5 < 7 - - - - - x < z - - - 3 < 7 - - - - - x < y - - - 3 < 5 - - - - - y < z - - - 5 < 8 - - - - - x < z - - - 3 < 8 - - - - - x < y - - - 3 < 5 - - - - - y < z - - - 5 < 9 - - - - - x < z - - - 3 < 9 - - - - - x < y - - - 3 < 6 - - - - - y < z - - - 6 < 7 - - - - - x < z - - - 3 < 7 - - - - - x < y - - - 3 < 6 - - - - - y < z - - - 6 < 8 - - - - - x < z - - - 3 < 8 - - - - - x < y - - - 3 < 6 - - - - - y < z - - - 6 < 9 - - - - - x < z - - - 3 < 9 - - - - - - - - s == "world" - - - "hello" == "world" - - - - - - - - s == "hello" - - - "hello" == "hello" - - - - - - - - Template_Fixture_2<TestType>::m_a.size() == 1 - - - 0 == 1 - - - - - - - - Template_Fixture_2<TestType>::m_a.size() == 1 - - - 0 == 1 - - - - - - - - Template_Fixture_2<TestType>::m_a.size() == 1 - - - 0 == 1 - - - - - - - - Template_Fixture_2<TestType>::m_a.size() == 1 - - - 0 == 1 - - - - - - - - Template_Fixture_2<TestType>::m_a.size() == 0 - - - 0 == 0 - - - - - - - - Template_Fixture_2<TestType>::m_a.size() == 0 - - - 0 == 0 - - - - - - - - Template_Fixture_2<TestType>::m_a.size() == 0 - - - 0 == 0 - - - - - - - - Template_Fixture_2<TestType>::m_a.size() == 0 - - - 0 == 0 - - - - - - - - Template_Fixture_2<TestType>{}.m_a.size() < 2 - - - 6 < 2 - - - - - - - - Template_Fixture_2<TestType>{}.m_a.size() < 2 - - - 2 < 2 - - - - - - - - Template_Fixture_2<TestType>{}.m_a.size() < 2 - - - 6 < 2 - - - - - - - - Template_Fixture_2<TestType>{}.m_a.size() < 2 - - - 2 < 2 - - - - - - - - Template_Fixture_2<TestType>{}.m_a.size() >= 2 - - - 6 >= 2 - - - - - - - - Template_Fixture_2<TestType>{}.m_a.size() >= 2 - - - 2 >= 2 - - - - - - - - Template_Fixture_2<TestType>{}.m_a.size() >= 2 - - - 6 >= 2 - - - - - - - - Template_Fixture_2<TestType>{}.m_a.size() >= 2 - - - 2 >= 2 - - - - - - - - Template_Fixture<TestType>::m_a == 2 - - - 1.0 == 2 - - - - - - - - Template_Fixture<TestType>::m_a == 2 - - - 1.0f == 2 - - - - - - - - Template_Fixture<TestType>::m_a == 2 - - - 1 == 2 - - - - - - - - Template_Fixture<TestType>::m_a == 1 - - - 1.0 == 1 - - - - - - - - Template_Fixture<TestType>::m_a == 1 - - - 1.0f == 1 - - - - - - - - Template_Fixture<TestType>::m_a == 1 - - - 1 == 1 - - - - - - - - Nttp_Fixture<V>::value == 0 - - - 1 == 0 - - - - - - - - Nttp_Fixture<V>::value == 0 - - - 3 == 0 - - - - - - - - Nttp_Fixture<V>::value == 0 - - - 6 == 0 - - - - - - - - Nttp_Fixture<V>::value > 0 - - - 1 > 0 - - - - - - - - Nttp_Fixture<V>::value > 0 - - - 3 > 0 - - - - - - - - Nttp_Fixture<V>::value > 0 - - - 6 > 0 - - - - - -
- - - m_a++ == 0 - - - 0 == 0 - - - -
-
- - - m_a == 0 - - - 1 == 0 - - - -
- -
- -
- - - m_a++ == 0 - - - 0 == 0 - - - -
-
- - - m_a == 1 - - - 1 == 1 - - - -
- -
- - - - m_a == 2 - - - 1 == 2 - - - - - - - - m_a == 1 - - - 1 == 1 - - - - - - - - x.size() == 0 - - - 0 == 0 - - - - - - - - x.size() == 0 - - - 0 == 0 - - - - - - - - x.size() == 0 - - - 0 == 0 - - - - - - - - x.size() == 0 - - - 0 == 0 - - - - - - - - x.size() > 0 - - - 42 > 0 - - - - - - - - x.size() > 0 - - - 9 > 0 - - - - - - - - x.size() > 0 - - - 42 > 0 - - - - - - - - x.size() > 0 - - - 9 > 0 - - - - - - - - d == 1.23_a - - - 1.22999999999999998 -== -Approx( 1.22999999999999998 ) - - - - - d != 1.22_a - - - 1.22999999999999998 -!= -Approx( 1.21999999999999997 ) - - - - - -d == -1.23_a - - - -1.22999999999999998 -== -Approx( -1.22999999999999998 ) - - - - - d == 1.2_a .epsilon(.1) - - - 1.22999999999999998 -== -Approx( 1.19999999999999996 ) - - - - - d != 1.2_a .epsilon(.001) - - - 1.22999999999999998 -!= -Approx( 1.19999999999999996 ) - - - - - d == 1_a .epsilon(.3) - - - 1.22999999999999998 == Approx( 1.0 ) - - - - - -
-
- -
- -
- - to infinity and beyond - - -
- - - - &o1 == &o2 - - - 0x == 0x - - - - - o1 == o2 - - - {?} == {?} - - - - - - - - 104.0 != Approx(100.0) - - - 104.0 != Approx( 100.0 ) - - - - - 104.0 == Approx(100.0).margin(5) - - - 104.0 == Approx( 100.0 ) - - - - - 104.0 == Approx(100.0).margin(4) - - - 104.0 == Approx( 100.0 ) - - - - - 104.0 != Approx(100.0).margin(3) - - - 104.0 != Approx( 100.0 ) - - - - - 100.3 != Approx(100.0) - - - 100.29999999999999716 != Approx( 100.0 ) - - - - - 100.3 == Approx(100.0).margin(0.5) - - - 100.29999999999999716 == Approx( 100.0 ) - - - - - - - - - - - i++ == 7 - - - 7 == 7 - - - - - i++ == 8 - - - 8 == 8 - - - - - - - - 1 == 1 - - - 1 == 1 - - - - - {Unknown expression after the reported line} - - - {Unknown expression after the reported line} - - - unexpected exception - - - - - - - - - - - Approx(0).margin(0) - - - Approx(0).margin(0) - - - - - Approx(0).margin(1234656) - - - Approx(0).margin(1234656) - - - - - Approx(0).margin(-2), std::domain_error - - - Approx(0).margin(-2), std::domain_error - - - - - Approx(0).epsilon(0) - - - Approx(0).epsilon(0) - - - - - Approx(0).epsilon(1) - - - Approx(0).epsilon(1) - - - - - Approx(0).epsilon(-0.001), std::domain_error - - - Approx(0).epsilon(-0.001), std::domain_error - - - - - Approx(0).epsilon(1.0001), std::domain_error - - - Approx(0).epsilon(1.0001), std::domain_error - - - - - - - - 0.25f == Approx(0.0f).margin(0.25f) - - - 0.25f == Approx( 0.0 ) - - - - - 0.0f == Approx(0.25f).margin(0.25f) - - - 0.0f == Approx( 0.25 ) - - - - - 0.5f == Approx(0.25f).margin(0.25f) - - - 0.5f == Approx( 0.25 ) - - - - - 245.0f == Approx(245.25f).margin(0.25f) - - - 245.0f == Approx( 245.25 ) - - - - - 245.5f == Approx(245.25f).margin(0.25f) - - - 245.5f == Approx( 245.25 ) - - - - - - - - divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) - - - 3.14285714285714279 -== -Approx( 3.14100000000000001 ) - - - - - divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) - - - 3.14285714285714279 -!= -Approx( 3.14100000000000001 ) - - - - - - - - d != Approx( 1.231 ) - - - 1.22999999999999998 -!= -Approx( 1.23100000000000009 ) - - - - - d == Approx( 1.231 ).epsilon( 0.1 ) - - - 1.22999999999999998 -== -Approx( 1.23100000000000009 ) - - - - - - - - 1.23f == Approx( 1.23f ) - - - 1.230000019f -== -Approx( 1.23000001907348633 ) - - - - - 0.0f == Approx( 0.0f ) - - - 0.0f == Approx( 0.0 ) - - - - - - - - 1 == Approx( 1 ) - - - 1 == Approx( 1.0 ) - - - - - 0 == Approx( 0 ) - - - 0 == Approx( 0.0 ) - - - - - - - - 1.0f == Approx( 1 ) - - - 1.0f == Approx( 1.0 ) - - - - - 0 == Approx( dZero) - - - 0 == Approx( 0.0 ) - - - - - 0 == Approx( dSmall ).margin( 0.001 ) - - - 0 == Approx( 0.00001 ) - - - - - 1.234f == Approx( dMedium ) - - - 1.233999968f -== -Approx( 1.23399999999999999 ) - - - - - dMedium == Approx( 1.234f ) - - - 1.23399999999999999 -== -Approx( 1.23399996757507324 ) - - - - - -
- - - 1, Predicate<int>( alwaysTrue, "always true" ) - - - 1 matches predicate: "always true" - - - - - 1, !Predicate<int>( alwaysFalse, "always false" ) - - - 1 not matches predicate: "always false" - - - -
-
- - - "Hello olleH", Predicate<std::string>( []( std::string const& str ) -> bool { return str.front() == str.back(); }, "First and last character should be equal" ) - - - "Hello olleH" matches predicate: "First and last character should be equal" - - - - - "This wouldn't pass", !Predicate<std::string>( []( std::string const& str ) -> bool { return str.front() == str.back(); } ) - - - "This wouldn't pass" not matches undescribed predicate - - - -
- -
- - - - lhs | rhs - - - Val: 1 | Val: 2 - - - - - !(lhs & rhs) - - - !(Val: 1 & Val: 2) - - - - - HasBitOperators{ 1 } & HasBitOperators{ 1 } - - - Val: 1 & Val: 1 - - - - - lhs ^ rhs - - - Val: 1 ^ Val: 2 - - - - - !(lhs ^ lhs) - - - !(Val: 1 ^ Val: 1) - - - - - - - - true - - - true - - -
- - - true - - - true - - -
- - - true - - - true - - - -
- -
- - - true - - - true - - -
- - - true - - - true - - -
- - - true - - - true - - - -
- -
- -
- -
- - - a, Contains(1) - - - { 1, 2, 3 } contains element 1 - - - - - b, Contains(1) - - - { 0, 1, 2 } contains element 1 - - - - - c, !Contains(1) - - - { 4, 5, 6 } not contains element 1 - - - -
-
- - - a, Contains(0, close_enough) - - - { 1, 2, 3 } contains element 0 - - - - - b, Contains(0, close_enough) - - - { 0, 1, 2 } contains element 0 - - - - - c, !Contains(0, close_enough) - - - { 4, 5, 6 } not contains element 0 - - - -
-
- - - a, Contains(4, [](auto&& lhs, size_t sz) { return lhs.size() == sz; }) - - - { "abc", "abcd", "abcde" } contains element 4 - - - -
-
- - - in, Contains(1) - - - { 1, 2, 3, 4, 5 } contains element 1 - - - - - in, !Contains(8) - - - { 1, 2, 3, 4, 5 } not contains element 8 - - - -
-
- - - in, Contains(MoveOnlyTestElement{ 2 }) - - - { 1, 2, 3 } contains element 2 - - - - - in, !Contains(MoveOnlyTestElement{ 9 }) - - - { 1, 2, 3 } not contains element 9 - - - -
-
- - - in, Contains(Catch::Matchers::WithinAbs(0.5, 0.5)) - - - { 1.0, 2.0, 3.0, 0.0 } contains element matching is within 0.5 of 0.5 - - - -
- -
- -
- - - empty_array, IsEmpty() - - - { } is empty - - - - - non_empty_array, !IsEmpty() - - - { 0.0 } not is empty - - - - - empty_vec, IsEmpty() - - - { } is empty - - - - - non_empty_vec, !IsEmpty() - - - { 'a', 'b', 'c' } not is empty - - - - - inner_lists_are_empty, !IsEmpty() - - - { { } } not is empty - - - - - inner_lists_are_empty.front(), IsEmpty() - - - { } is empty - - - -
-
- - - has_empty{}, !IsEmpty() - - - {?} not is empty - - - -
-
- - - unrelated::ADL_empty{}, IsEmpty() - - - {?} is empty - - - -
- -
- - - a := 1 - - - b := 2 - - - c := 3 - - - a + b := 3 - - - a+b := 3 - - - c > b := true - - - a == 1 := true - - - - - - custom_index_op<int>{1, 2, 3}[0, 1, 2] := 0 - - - custom_index_op<int>{1, 2, 3}[(0, 1)] := 0 - - - custom_index_op<int>{1, 2, 3}[0] := 0 - - - (helper_1436<int, int>{12, -12}) := { 12, -12 } - - - (helper_1436<int, int>(-12, 12)) := { -12, 12 } - - - (1, 2) := 2 - - - (2, 3) := 3 - - - - - - ("comma, in string", "escaped, \", ") := "escaped, ", " - - - "single quote in string,'," := "single quote in string,'," - - - "some escapes, \\,\\\\" := "some escapes, \,\\" - - - "some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<" - - - '"' := '"' - - - '\'' := ''' - - - ',' := ',' - - - '}' := '}' - - - ')' := ')' - - - '(' := '(' - - - '{' := '{' - - - - -
- - i := 2 - - - - true - - - true - - - -
-
- - 3 - - - - true - - - true - - - -
- -
- -
- - - eq( "", "" ) - - - true - - - - - !(eq( "", "a" )) - - - !false - - - -
-
- - - eq( "a", "a" ) - - - true - - - - - eq( "a", "A" ) - - - true - - - - - eq( "A", "a" ) - - - true - - - - - eq( "A", "A" ) - - - true - - - - - !(eq( "a", "b" )) - - - !false - - - - - !(eq( "a", "B" )) - - - !false - - - -
- -
- -
- - - lt( "", "a" ) - - - true - - - - - !(lt( "a", "a" )) - - - !false - - - - - !(lt( "", "" )) - - - !false - - - -
-
- - - lt( "a", "b" ) - - - true - - - - - lt( "a", "B" ) - - - true - - - - - lt( "A", "b" ) - - - true - - - - - lt( "A", "B" ) - - - true - - - -
- -
- -
- - - ::Catch::Detail::stringify('\t') == "'\\t'" - - - "'\t'" == "'\t'" - - - - - ::Catch::Detail::stringify('\n') == "'\\n'" - - - "'\n'" == "'\n'" - - - - - ::Catch::Detail::stringify('\r') == "'\\r'" - - - "'\r'" == "'\r'" - - - - - ::Catch::Detail::stringify('\f') == "'\\f'" - - - "'\f'" == "'\f'" - - - -
-
- - - ::Catch::Detail::stringify( ' ' ) == "' '" - - - "' '" == "' '" - - - - - ::Catch::Detail::stringify( 'A' ) == "'A'" - - - "'A'" == "'A'" - - - - - ::Catch::Detail::stringify( 'z' ) == "'z'" - - - "'z'" == "'z'" - - - -
-
- - - ::Catch::Detail::stringify( '\0' ) == "0" - - - "0" == "0" - - - - - ::Catch::Detail::stringify( static_cast<char>(2) ) == "2" - - - "2" == "2" - - - - - ::Catch::Detail::stringify( static_cast<char>(5) ) == "5" - - - "5" == "5" - - - -
- -
- - - - name.empty() - - - true - - - - - name == "foo" - - - "foo" == "foo" - - - - - -
- - - !(parse_result) - - - !{?} - - - -
-
- - - parse_result - - - {?} - - - - - res == std::vector<std::string>{ "aaa", "bbb" } - - - { "aaa", "bbb" } == { "aaa", "bbb" } - - - -
- -
- -
- - - streamWrapper.str().empty() - - - true - - - -
-
- - - streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3\n" - - - "1 -Using code: 2 -2 -Using code: 0 -3 -" -== -"1 -Using code: 2 -2 -Using code: 0 -3 -" - - - -
-
- - - streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" - - - "Using code: 2 -A -B -Using code: 0 -C -" -== -"Using code: 2 -A -B -Using code: 0 -C -" - - - -
- -
- - - - 1, ( MatcherA() && MatcherB() ) && MatcherC() - - - 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) - - - - - 1, MatcherA() && ( MatcherB() && MatcherC() ) - - - 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) - - - - - 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) - - - 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) - - - - - - - - 1, ( MatcherA() || MatcherB() ) || MatcherC() - - - 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) - - - - - 1, MatcherA() || ( MatcherB() || MatcherC() ) - - - 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) - - - - - 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) - - - 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) - - - - - - - - 0, !MatcherA() - - - 0 not equals: (int) 1 or (string) "1" - - - - - 1, !!MatcherA() - - - 1 equals: (int) 1 or (string) "1" - - - - - 0, !!!MatcherA() - - - 0 not equals: (int) 1 or (string) "1" - - - - - 1, !!!!MatcherA() - - - 1 equals: (int) 1 or (string) "1" - - - - - - - - - - - 1, MatcherA() || MatcherB() - - - 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) - - - - - 1, MatcherA() && MatcherB() - - - 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) - - - - - 1, MatcherA() || !MatcherB() - - - 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) - - - - - - - - vec, Predicate<std::vector<int>>( []( auto const& v ) { return std::all_of( v.begin(), v.end(), []( int elem ) { return elem % 2 == 1; } ); }, "All elements are odd" ) && !EqualsRange( a ) - - - { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) - - - - - str, StartsWith( "foo" ) && EqualsRange( arr ) && EndsWith( "bar" ) - - - "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) - - - - - str, StartsWith( "foo" ) && !EqualsRange( bad_arr ) && EndsWith( "bar" ) - - - "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and ends with: "bar" ) - - - - - str, EqualsRange( arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) - - - "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) - - - - - str, !EqualsRange( bad_arr ) && StartsWith( "foo" ) && EndsWith( "bar" ) - - - "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) - - - - - str, EqualsRange( bad_arr ) || ( StartsWith( "foo" ) && EndsWith( "bar" ) ) - - - "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" and ends with: "bar" ) ) - - - - - str, ( StartsWith( "foo" ) && EndsWith( "bar" ) ) || EqualsRange( bad_arr ) - - - "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) - - - - - - - - container, EqualsRange( a ) || EqualsRange( b ) || EqualsRange( c ) - - - { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) - - - - - - - - std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} - - - std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} - - - - - std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} - - - std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} - - - - - std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} - - - std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} - - - - - std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} - - - std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} - - - - - std::vector<int>{1, 2} == std::vector<int>{1, 2} - - - { 1, 2 } == { 1, 2 } - - - - - std::vector<int>{1, 2} == std::vector<int>{1, 2} - - - { 1, 2 } == { 1, 2 } - - - - - !(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3}) - - - !({ 1, 2 } == { 1, 2, 3 }) - - - - - !(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3}) - - - !({ 1, 2 } == { 1, 2, 3 }) - - - - - std::vector<int>{1, 2} == std::vector<int>{1, 2} - - - { 1, 2 } == { 1, 2 } - - - - - std::vector<int>{1, 2} == std::vector<int>{1, 2} - - - { 1, 2 } == { 1, 2 } - - - - - true - - - true - - - - - std::vector<int>{1, 2} == std::vector<int>{1, 2} - - - { 1, 2 } == { 1, 2 } - - - - - - - - a - - - 0x - - - - - a == &foo - - - 0x == 0x - - - - - - - - SimplePcg32{} == SimplePcg32{} - - - {?} == {?} - - - - - SimplePcg32{ 0 } != SimplePcg32{} - - - {?} != {?} - - - - - !(SimplePcg32{ 1 } == SimplePcg32{ 2 }) - - - !({?} == {?}) - - - - - !(SimplePcg32{ 1 } != SimplePcg32{ 1 }) - - - !({?} != {?}) - - - - - - - - td == Approx(10.0) - - - StrongDoubleTypedef(10) == Approx( 10.0 ) - - - - - Approx(10.0) == td - - - Approx( 10.0 ) == StrongDoubleTypedef(10) - - - - - td != Approx(11.0) - - - StrongDoubleTypedef(10) != Approx( 11.0 ) - - - - - Approx(11.0) != td - - - Approx( 11.0 ) != StrongDoubleTypedef(10) - - - - - td <= Approx(10.0) - - - StrongDoubleTypedef(10) <= Approx( 10.0 ) - - - - - td <= Approx(11.0) - - - StrongDoubleTypedef(10) <= Approx( 11.0 ) - - - - - Approx(10.0) <= td - - - Approx( 10.0 ) <= StrongDoubleTypedef(10) - - - - - Approx(9.0) <= td - - - Approx( 9.0 ) <= StrongDoubleTypedef(10) - - - - - td >= Approx(9.0) - - - StrongDoubleTypedef(10) >= Approx( 9.0 ) - - - - - td >= Approx(td) - - - StrongDoubleTypedef(10) >= Approx( 10.0 ) - - - - - Approx(td) >= td - - - Approx( 10.0 ) >= StrongDoubleTypedef(10) - - - - - Approx(11.0) >= td - - - Approx( 11.0 ) >= StrongDoubleTypedef(10) - - - - - - - - 54 == 6*9 - - - 54 == 54 - - - - - - - - ( -1 > 2u ) - - - true - - - - - -1 > 2u - - - -1 > 2 - - - - - ( 2u < -1 ) - - - true - - - - - 2u < -1 - - - 2 < -1 - - - - - ( minInt > 2u ) - - - true - - - - - minInt > 2u - - - -2147483648 > 2 - - - - - - - - i == 1 - - - 1 == 1 - - - - - ui == 2 - - - 2 == 2 - - - - - l == 3 - - - 3 == 3 - - - - - ul == 4 - - - 4 == 4 - - - - - c == 5 - - - 5 == 5 - - - - - uc == 6 - - - 6 == 6 - - - - - 1 == i - - - 1 == 1 - - - - - 2 == ui - - - 2 == 2 - - - - - 3 == l - - - 3 == 3 - - - - - 4 == ul - - - 4 == 4 - - - - - 5 == c - - - 5 == 5 - - - - - 6 == uc - - - 6 == 6 - - - - - (std::numeric_limits<uint32_t>::max)() > ul - - - 4294967295 (0x) > 4 - - - - - -
- - - !(matcher.match( 1 )) - - - !false - - - - - first.matchCalled - - - true - - - - - !second.matchCalled - - - true - - - -
-
- - - matcher.match( 1 ) - - - true - - - - - first.matchCalled - - - true - - - - - !second.matchCalled - - - true - - - -
- -
- -
- - - !(matcher.match( 1 )) - - - !false - - - - - first.matchCalled - - - true - - - - - !second.matchCalled - - - true - - - -
-
- - - matcher.match( 1 ) - - - true - - - - - first.matchCalled - - - true - - - - - !second.matchCalled - - - true - - - -
- -
- - - - testStringForMatching(), ContainsSubstring( "not there", Catch::CaseSensitive::No ) - - - "this string contains 'abc' as a substring" contains: "not there" (case insensitive) - - - - - testStringForMatching(), ContainsSubstring( "STRING" ) - - - "this string contains 'abc' as a substring" contains: "STRING" - - - - - -
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - elem % 2 == 1 - - - 1 == 1 - - - -
-
- - - call_count == 1 - - - 1 == 1 - - - - - make_data().size() == test_count - - - 6 == 6 - - - -
- -
- - - - Catch::makeStream( "-" )->isConsole() - - - true - - - - - - - - throwCustom() - - - throwCustom() - - - custom exception - not std - - - - - - - - throwCustom(), std::exception - - - throwCustom(), std::exception - - - custom exception - not std - - - - - - - custom std exception - - - - - - - 101.000001 != Approx(100).epsilon(0.01) - - - 101.00000099999999748 != Approx( 100.0 ) - - - - - std::pow(10, -5) != Approx(std::pow(10, -7)) - - - 0.00001 != Approx( 0.0000001 ) - - - - - - - - enumInfo->lookup(0) == "Value1" - - - Value1 == "Value1" - - - - - enumInfo->lookup(1) == "Value2" - - - Value2 == "Value2" - - - - - enumInfo->lookup(3) == "{** unexpected enum value **}" - - - {** unexpected enum value **} -== -"{** unexpected enum value **}" - - - - - - - This generator is empty - - - - - - - Catch::makeStream( "" )->isConsole() - - - true - - - - - - - - testStringForMatching(), EndsWith( "Substring" ) - - - "this string contains 'abc' as a substring" ends with: "Substring" - - - - - testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) - - - "this string contains 'abc' as a substring" ends with: "this" (case insensitive) - - - - - - - - stringify( EnumClass3::Value1 ) == "Value1" - - - "Value1" == "Value1" - - - - - stringify( EnumClass3::Value2 ) == "Value2" - - - "Value2" == "Value2" - - - - - stringify( EnumClass3::Value3 ) == "Value3" - - - "Value3" == "Value3" - - - - - stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" - - - "{** unexpected enum value **}" -== -"{** unexpected enum value **}" - - - - - stringify( ec3 ) == "Value2" - - - "Value2" == "Value2" - - - - - - - - stringify( Bikeshed::Colours::Red ) == "Red" - - - "Red" == "Red" - - - - - stringify( Bikeshed::Colours::Blue ) == "Blue" - - - "Blue" == "Blue" - - - - - - - - 101.01 != Approx(100).epsilon(0.01) - - - 101.01000000000000512 != Approx( 100.0 ) - - - - - - - - data.int_seven == 6 - - - 7 == 6 - - - - - data.int_seven == 8 - - - 7 == 8 - - - - - data.int_seven == 0 - - - 7 == 0 - - - - - data.float_nine_point_one == Approx( 9.11f ) - - - 9.100000381f -== -Approx( 9.10999965667724609 ) - - - - - data.float_nine_point_one == Approx( 9.0f ) - - - 9.100000381f == Approx( 9.0 ) - - - - - data.float_nine_point_one == Approx( 1 ) - - - 9.100000381f == Approx( 1.0 ) - - - - - data.float_nine_point_one == Approx( 0 ) - - - 9.100000381f == Approx( 0.0 ) - - - - - data.double_pi == Approx( 3.1415 ) - - - 3.14159265350000005 -== -Approx( 3.14150000000000018 ) - - - - - data.str_hello == "goodbye" - - - "hello" == "goodbye" - - - - - data.str_hello == "hell" - - - "hello" == "hell" - - - - - data.str_hello == "hello1" - - - "hello" == "hello1" - - - - - data.str_hello.size() == 6 - - - 5 == 6 - - - - - x == Approx( 1.301 ) - - - 1.30000000000000027 -== -Approx( 1.30099999999999993 ) - - - - - - - - data.int_seven == 7 - - - 7 == 7 - - - - - data.float_nine_point_one == Approx( 9.1f ) - - - 9.100000381f -== -Approx( 9.10000038146972656 ) - - - - - data.double_pi == Approx( 3.1415926535 ) - - - 3.14159265350000005 -== -Approx( 3.14159265350000005 ) - - - - - data.str_hello == "hello" - - - "hello" == "hello" - - - - - "hello" == data.str_hello - - - "hello" == "hello" - - - - - data.str_hello.size() == 5 - - - 5 == 5 - - - - - x == Approx( 1.3 ) - - - 1.30000000000000027 -== -Approx( 1.30000000000000004 ) - - - - - - - - testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) - - - "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" - - - - - testStringForMatching(), Equals( "this string contains 'ABC' as a substring", Catch::CaseSensitive::No ) - - - "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive) - - - - - - - - testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) - - - "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" - - - - - testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) - - - "this string contains 'abc' as a substring" equals: "something else" (case insensitive) - - - - - - - - ::Catch::Detail::stringify(WhatException{}) == "This exception has overridden what() method" - - - "This exception has overridden what() method" -== -"This exception has overridden what() method" - - - - - ::Catch::Detail::stringify(OperatorException{}) == "OperatorException" - - - "OperatorException" == "OperatorException" - - - - - ::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException" - - - "StringMakerException" -== -"StringMakerException" - - - - - -
- - - doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } - - - doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } - - - - - doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } - - - doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } - - - -
-
- - - throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } - - - throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } - - - Unknown exception - - - - - throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } - - - throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } - - - Unknown exception - - - -
-
- - - throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } - - - SpecialException::what special exception has value of 1 - - - - - throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } - - - SpecialException::what special exception has value of 1 - - - -
- -
- - - - throwsSpecialException( 1 ), SpecialException, ExceptionMatcher{ 1 } - - - SpecialException::what special exception has value of 1 - - - - - throwsSpecialException( 2 ), SpecialException, ExceptionMatcher{ 2 } - - - SpecialException::what special exception has value of 2 - - - - - - - - throwsDerivedException(), DerivedException, MessageMatches( StartsWith( "Derived" ) ) - - - DerivedException::what matches "starts with: "Derived"" - - - - - throwsDerivedException(), DerivedException, MessageMatches( EndsWith( "::what" ) ) - - - DerivedException::what matches "ends with: "::what"" - - - - - throwsDerivedException(), DerivedException, MessageMatches( !StartsWith( "::what" ) ) - - - DerivedException::what matches "not starts with: "::what"" - - - - - throwsSpecialException( 2 ), SpecialException, MessageMatches( StartsWith( "Special" ) ) - - - SpecialException::what matches "starts with: "Special"" - - - - - -
- - - thisThrows(), "expected exception" - - - "expected exception" equals: "expected exception" - - - -
-
- - - thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) - - - "expected exception" equals: "expected exception" (case insensitive) - - - -
-
- - - thisThrows(), StartsWith( "expected" ) - - - "expected exception" starts with: "expected" - - - - - thisThrows(), EndsWith( "exception" ) - - - "expected exception" ends with: "exception" - - - - - thisThrows(), ContainsSubstring( "except" ) - - - "expected exception" contains: "except" - - - - - thisThrows(), ContainsSubstring( "exCept", Catch::CaseSensitive::No ) - - - "expected exception" contains: "except" (case insensitive) - - - -
- -
- - - - throwsDerivedException(), DerivedException, Message( "DerivedException::what" ) - - - DerivedException::what exception message matches "DerivedException::what" - - - - - throwsDerivedException(), DerivedException, !Message( "derivedexception::what" ) - - - DerivedException::what not exception message matches "derivedexception::what" - - - - - throwsSpecialException( 2 ), SpecialException, !Message( "DerivedException::what" ) - - - SpecialException::what not exception message matches "DerivedException::what" - - - - - throwsSpecialException( 2 ), SpecialException, Message( "SpecialException::what" ) - - - SpecialException::what exception message matches "SpecialException::what" - - - - - - - - thisThrows(), std::string - - - thisThrows(), std::string - - - expected exception - - - - - thisDoesntThrow(), std::domain_error - - - thisDoesntThrow(), std::domain_error - - - - - thisThrows() - - - thisThrows() - - - expected exception - - - - - - - This is a failure - - - - - - - - - - This is a failure - - - This message appears in the output - - - - - - - Factorial(0) == 1 - - - 1 == 1 - - - - - Factorial(1) == 1 - - - 1 == 1 - - - - - Factorial(2) == 2 - - - 2 == 2 - - - - - Factorial(3) == 6 - - - 6 == 6 - - - - - Factorial(10) == 3628800 - - - 3628800 (0x) == 3628800 (0x) - - - - - - - - filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException - - - filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException - - - - - -
- - - 10., WithinRel( 11.1, 0.1 ) - - - 10.0 and 11.09999999999999964 are within 10% of each other - - - - - 10., !WithinRel( 11.2, 0.1 ) - - - 10.0 not and 11.19999999999999929 are within 10% of each other - - - - - 1., !WithinRel( 0., 0.99 ) - - - 1.0 not and 0.0 are within 99% of each other - - - - - -0., WithinRel( 0. ) - - - -0.0 and 0.0 are within 2.22045e-12% of each other - - -
- - - v1, WithinRel( v2 ) - - - 0.0 and 0.0 are within 2.22045e-12% of each other - - - -
- -
-
- - - 1., WithinAbs( 1., 0 ) - - - 1.0 is within 0.0 of 1.0 - - - - - 0., WithinAbs( 1., 1 ) - - - 0.0 is within 1.0 of 1.0 - - - - - 0., !WithinAbs( 1., 0.99 ) - - - 0.0 not is within 0.98999999999999999 of 1.0 - - - - - 0., !WithinAbs( 1., 0.99 ) - - - 0.0 not is within 0.98999999999999999 of 1.0 - - - - - 11., !WithinAbs( 10., 0.5 ) - - - 11.0 not is within 0.5 of 10.0 - - - - - 10., !WithinAbs( 11., 0.5 ) - - - 10.0 not is within 0.5 of 11.0 - - - - - -10., WithinAbs( -10., 0.5 ) - - - -10.0 is within 0.5 of -10.0 - - - - - -10., WithinAbs( -9.6, 0.5 ) - - - -10.0 is within 0.5 of -9.59999999999999964 - - - -
-
- - - 1., WithinULP( 1., 0 ) - - - 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) - - - - - nextafter( 1., 2. ), WithinULP( 1., 1 ) - - - 1.00000000000000022 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1.0000000000000002e+00]) - - - - - 0., WithinULP( nextafter( 0., 1. ), 1 ) - - - 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9.8813129168249309e-324]) - - - - - 1., WithinULP( nextafter( 1., 0. ), 1 ) - - - 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1.0000000000000000e+00]) - - - - - 1., !WithinULP( nextafter( 1., 2. ), 0 ) - - - 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, 1.0000000000000002e+00]) - - - - - 1., WithinULP( 1., 0 ) - - - 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) - - - - - -0., WithinULP( 0., 0 ) - - - -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) - - - -
-
- - - 1., WithinAbs( 1., 0.5 ) || WithinULP( 2., 1 ) - - - 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) - - - - - 1., WithinAbs( 2., 0.5 ) || WithinULP( 1., 0 ) - - - 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) - - - - - 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) - - - 0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) - - - -
-
- - - WithinAbs( 1., 0. ) - - - WithinAbs( 1., 0. ) - - - - - WithinAbs( 1., -1. ), std::domain_error - - - WithinAbs( 1., -1. ), std::domain_error - - - - - WithinULP( 1., 0 ) - - - WithinULP( 1., 0 ) - - - - - WithinRel( 1., 0. ) - - - WithinRel( 1., 0. ) - - - - - WithinRel( 1., -0.2 ), std::domain_error - - - WithinRel( 1., -0.2 ), std::domain_error - - - - - WithinRel( 1., 1. ), std::domain_error - - - WithinRel( 1., 1. ), std::domain_error - - - -
-
- - - 1., !IsNaN() - - - 1.0 not is NaN - - - -
- -
- -
- - - 10.f, WithinRel( 11.1f, 0.1f ) - - - 10.0f and 11.10000038146972656 are within 10% of each other - - - - - 10.f, !WithinRel( 11.2f, 0.1f ) - - - 10.0f not and 11.19999980926513672 are within 10% of each other - - - - - 1.f, !WithinRel( 0.f, 0.99f ) - - - 1.0f not and 0.0 are within 99% of each other - - - - - -0.f, WithinRel( 0.f ) - - - -0.0f and 0.0 are within 0.00119209% of each other - - -
- - - v1, WithinRel( v2 ) - - - 0.0f and 0.0 are within 0.00119209% of each other - - - -
- -
-
- - - 1.f, WithinAbs( 1.f, 0 ) - - - 1.0f is within 0.0 of 1.0 - - - - - 0.f, WithinAbs( 1.f, 1 ) - - - 0.0f is within 1.0 of 1.0 - - - - - 0.f, !WithinAbs( 1.f, 0.99f ) - - - 0.0f not is within 0.99000000953674316 of 1.0 - - - - - 0.f, !WithinAbs( 1.f, 0.99f ) - - - 0.0f not is within 0.99000000953674316 of 1.0 - - - - - 0.f, WithinAbs( -0.f, 0 ) - - - 0.0f is within 0.0 of -0.0 - - - - - 11.f, !WithinAbs( 10.f, 0.5f ) - - - 11.0f not is within 0.5 of 10.0 - - - - - 10.f, !WithinAbs( 11.f, 0.5f ) - - - 10.0f not is within 0.5 of 11.0 - - - - - -10.f, WithinAbs( -10.f, 0.5f ) - - - -10.0f is within 0.5 of -10.0 - - - - - -10.f, WithinAbs( -9.6f, 0.5f ) - - - -10.0f is within 0.5 of -9.60000038146972656 - - - -
-
- - - 1.f, WithinULP( 1.f, 0 ) - - - 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) - - - - - -1.f, WithinULP( -1.f, 0 ) - - - -1.0f is within 0 ULPs of -1.00000000e+00f ([-1.00000000e+00, -1.00000000e+00]) - - - - - nextafter( 1.f, 2.f ), WithinULP( 1.f, 1 ) - - - 1.000000119f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) - - - - - 0.f, WithinULP( nextafter( 0.f, 1.f ), 1 ) - - - 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) - - - - - 1.f, WithinULP( nextafter( 1.f, 0.f ), 1 ) - - - 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) - - - - - 1.f, !WithinULP( nextafter( 1.f, 2.f ), 0 ) - - - 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+00]) - - - - - 1.f, WithinULP( 1.f, 0 ) - - - 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) - - - - - -0.f, WithinULP( 0.f, 0 ) - - - -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) - - - -
-
- - - 1.f, WithinAbs( 1.f, 0.5 ) || WithinULP( 1.f, 1 ) - - - 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) - - - - - 1.f, WithinAbs( 2.f, 0.5 ) || WithinULP( 1.f, 0 ) - - - 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) - - - - - 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) - - - 0.0001f ( is within 0.00100000004749745 of 0.0 or and 0.0 are within 10% of each other ) - - - -
-
- - - WithinAbs( 1.f, 0.f ) - - - WithinAbs( 1.f, 0.f ) - - - - - WithinAbs( 1.f, -1.f ), std::domain_error - - - WithinAbs( 1.f, -1.f ), std::domain_error - - - - - WithinULP( 1.f, 0 ) - - - WithinULP( 1.f, 0 ) - - - - - WithinULP( 1.f, static_cast<uint64_t>( -1 ) ), std::domain_error - - - WithinULP( 1.f, static_cast<uint64_t>( -1 ) ), std::domain_error - - - - - WithinRel( 1.f, 0.f ) - - - WithinRel( 1.f, 0.f ) - - - - - WithinRel( 1.f, -0.2f ), std::domain_error - - - WithinRel( 1.f, -0.2f ), std::domain_error - - - - - WithinRel( 1.f, 1.f ), std::domain_error - - - WithinRel( 1.f, 1.f ), std::domain_error - - - -
-
- - - 1., !IsNaN() - - - 1.0 not is NaN - - - -
- -
- - - - i % 2 == 0 - - - 0 == 0 - - - - - i % 2 == 0 - - - 0 == 0 - - - - - i % 2 == 0 - - - 0 == 0 - - - - - i % 2 == 0 - - - 0 == 0 - - - - - -
-
- - - i % 2 == 0 - - - 0 == 0 - - - -
- -
-
-
- - - i % 2 == 0 - - - 0 == 0 - - - -
- -
-
-
- - - i % 2 == 0 - - - 0 == 0 - - - -
- -
-
-
- - - filter([] (int) {return false; }, value(1)), Catch::GeneratorException - - - filter([] (int) {return false; }, value(1)), Catch::GeneratorException - - - -
- -
-
- - - i < 4 - - - 1 < 4 - - - -
-
- - - i < 4 - - - 2 < 4 - - - -
-
- - - i < 4 - - - 3 < 4 - - - -
-
-
- - - i % 2 == 0 - - - 0 == 0 - - - -
- -
-
-
- - - i % 2 == 0 - - - 0 == 0 - - - -
- -
-
-
- - - i % 2 == 0 - - - 0 == 0 - - - -
- -
-
-
- - - i.size() == 1 - - - 1 == 1 - - - -
- -
-
-
- - - i.size() == 1 - - - 1 == 1 - - - -
- -
-
-
- - - i.size() == 1 - - - 1 == 1 - - - -
- -
-
-
- - - i.size() == 1 - - - 1 == 1 - - - -
- -
-
-
- - - i.size() == 1 - - - 1 == 1 - - - -
- -
-
-
- - - i.size() == 1 - - - 1 == 1 - - - -
- -
-
- - - j > 0 - - - 1 > 0 - - - -
-
- - - j > 0 - - - 2 > 0 - - - -
-
- - - j > 0 - - - 3 > 0 - - - -
-
- - - j > 0 - - - 1 > 0 - - - -
-
- - - j > 0 - - - 2 > 0 - - - -
-
- - - j > 0 - - - 3 > 0 - - - -
-
-
- - - chunk2.size() == 2 - - - 2 == 2 - - - - - chunk2.front() == chunk2.back() - - - 1 == 1 - - - -
- -
-
-
- - - chunk2.size() == 2 - - - 2 == 2 - - - - - chunk2.front() == chunk2.back() - - - 2 == 2 - - - -
- -
-
-
- - - chunk2.size() == 2 - - - 2 == 2 - - - - - chunk2.front() == chunk2.back() - - - 3 == 3 - - - -
- -
-
-
- - - chunk2.size() == 2 - - - 2 == 2 - - - - - chunk2.front() == chunk2.back() - - - 1 == 1 - - - - - chunk2.front() < 3 - - - 1 < 3 - - - -
- -
-
-
- - - chunk2.size() == 2 - - - 2 == 2 - - - - - chunk2.front() == chunk2.back() - - - 2 == 2 - - - - - chunk2.front() < 3 - - - 2 < 3 - - - -
- -
-
-
- - - chunk2.size() == 0 - - - 0 == 0 - - - -
- -
-
-
- - - chunk2.size() == 0 - - - 0 == 0 - - - -
- -
-
-
- - - chunk2.size() == 0 - - - 0 == 0 - - - -
- -
-
-
- - - chunk(2, value(1)), Catch::GeneratorException - - - chunk(2, value(1)), Catch::GeneratorException - - - -
- -
- -
- -
- - - j < i - - - -3 < 1 - - - -
-
- - - j < i - - - -2 < 1 - - - -
-
- - - j < i - - - -1 < 1 - - - -
-
- - - 4u * i > str.size() - - - 4 > 1 - - - -
-
- - - 4u * i > str.size() - - - 4 > 2 - - - -
-
- - - 4u * i > str.size() - - - 4 > 3 - - - -
-
- - - j < i - - - -3 < 2 - - - -
-
- - - j < i - - - -2 < 2 - - - -
-
- - - j < i - - - -1 < 2 - - - -
-
- - - 4u * i > str.size() - - - 8 > 1 - - - -
-
- - - 4u * i > str.size() - - - 8 > 2 - - - -
-
- - - 4u * i > str.size() - - - 8 > 3 - - - -
-
- - - j < i - - - -3 < 3 - - - -
-
- - - j < i - - - -2 < 3 - - - -
-
- - - j < i - - - -1 < 3 - - - -
-
- - - 4u * i > str.size() - - - 12 > 1 - - - -
-
- - - 4u * i > str.size() - - - 12 > 2 - - - -
-
- - - 4u * i > str.size() - - - 12 > 3 - - - -
- -
- -
- - - gen.get() == 123 - - - 123 == 123 - - - - - !(gen.next()) - - - !false - - - -
-
- - - gen.get() == 1 - - - 1 == 1 - - - - - gen.next() - - - true - - - - - gen.get() == 3 - - - 3 == 3 - - - - - gen.next() - - - true - - - - - gen.get() == 5 - - - 5 == 5 - - - - - !(gen.next()) - - - !false - - - -
-
- - - gen.get() == 1 - - - 1 == 1 - - - - - gen.next() - - - true - - - - - gen.get() == 5 - - - 5 == 5 - - - - - gen.next() - - - true - - - - - gen.get() == 2 - - - 2 == 2 - - - - - gen.next() - - - true - - - - - gen.get() == 4 - - - 4 == 4 - - - - - gen.next() - - - true - - - - - gen.get() == 0 - - - 0 == 0 - - - - - !(gen.next()) - - - !false - - - -
-
- - - gen.get().size() == 2 - - - 2 == 2 - - - - - gen.get() == "aa" - - - "aa" == "aa" - - - - - gen.next() - - - true - - - - - gen.get() == "bb" - - - "bb" == "bb" - - - - - gen.next() - - - true - - - - - gen.get() == "cc" - - - "cc" == "cc" - - - - - !(gen.next()) - - - !false - - - -
-
-
- - - gen.get() == 1 - - - 1 == 1 - - - - - gen.next() - - - true - - - - - gen.get() == 3 - - - 3 == 3 - - - - - !(gen.next()) - - - !false - - - -
- -
-
-
- - - gen.get() == 1 - - - 1 == 1 - - - - - gen.next() - - - true - - - - - gen.get() == 3 - - - 3 == 3 - - - - - !(gen.next()) - - - !false - - - -
- -
-
-
- - - filter([](int) { return false; }, value(1)), Catch::GeneratorException - - - filter([](int) { return false; }, value(1)), Catch::GeneratorException - - - - - filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException - - - filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException - - - -
- -
-
-
- - - gen.get() == 1 - - - 1 == 1 - - - - - gen.next() - - - true - - - - - gen.get() == 2 - - - 2 == 2 - - - - - !(gen.next()) - - - !false - - - -
- -
-
-
- - - gen.get() == 1 - - - 1 == 1 - - - - - !(gen.next()) - - - !false - - - -
- -
-
- - - gen.get() == 2.0 - - - 2.0 == 2.0 - - - - - gen.next() - - - true - - - - - gen.get() == 4.0 - - - 4.0 == 4.0 - - - - - gen.next() - - - true - - - - - gen.get() == 6.0 - - - 6.0 == 6.0 - - - - - !(gen.next()) - - - !false - - - -
-
- - - gen.get() == 2.0 - - - 2.0 == 2.0 - - - - - gen.next() - - - true - - - - - gen.get() == 4.0 - - - 4.0 == 4.0 - - - - - gen.next() - - - true - - - - - gen.get() == 6.0 - - - 6.0 == 6.0 - - - - - !(gen.next()) - - - !false - - - -
-
-
- - - gen.get() == 3 - - - 3 == 3 - - - - - !(gen.next()) - - - !false - - - -
- -
-
-
- - - gen.get() == 1 - - - 1 == 1 - - - - - gen.next() - - - true - - - - - gen.get() == 2 - - - 2 == 2 - - - - - gen.next() - - - true - - - - - gen.get() == 3 - - - 3 == 3 - - - - - gen.next() - - - true - - - - - gen.get() == 1 - - - 1 == 1 - - - - - gen.next() - - - true - - - - - gen.get() == 2 - - - 2 == 2 - - - - - gen.next() - - - true - - - - - gen.get() == 3 - - - 3 == 3 - - - - - !(gen.next()) - - - !false - - - -
- -
-
-
-
- - - gen.get() == -2 - - - -2 == -2 - - - - - gen.next() - - - true - - - - - gen.get() == -1 - - - -1 == -1 - - - - - gen.next() - - - true - - - - - gen.get() == 0 - - - 0 == 0 - - - - - gen.next() - - - true - - - - - gen.get() == 1 - - - 1 == 1 - - - - - !(gen.next()) - - - !false - - - -
- -
- -
-
-
-
- - - gen.get() == 2 - - - 2 == 2 - - - - - gen.next() - - - true - - - - - gen.get() == 1 - - - 1 == 1 - - - - - gen.next() - - - true - - - - - gen.get() == 0 - - - 0 == 0 - - - - - gen.next() - - - true - - - - - gen.get() == -1 - - - -1 == -1 - - - - - !(gen.next()) - - - !false - - - -
- -
- -
-
-
-
-
- - - gen.get() == -7 - - - -7 == -7 - - - - - gen.next() - - - true - - - - - gen.get() == -4 - - - -4 == -4 - - - - - gen.next() - - - true - - - - - gen.get() == -1 - - - -1 == -1 - - - - - gen.next() - - - true - - - - - gen.get() == 2 - - - 2 == 2 - - - - - !(gen.next()) - - - !false - - - -
- -
- -
- -
-
-
-
-
- - - gen.get() == -7 - - - -7 == -7 - - - - - gen.next() - - - true - - - - - gen.get() == -4 - - - -4 == -4 - - - - - gen.next() - - - true - - - - - gen.get() == -1 - - - -1 == -1 - - - - - gen.next() - - - true - - - - - gen.get() == 2 - - - 2 == 2 - - - - - !(gen.next()) - - - !false - - - -
- -
- -
- -
-
-
-
-
- - - gen.get() == -7 - - - -7 == -7 - - - - - gen.next() - - - true - - - - - gen.get() == -4 - - - -4 == -4 - - - - - gen.next() - - - true - - - - - gen.get() == -1 - - - -1 == -1 - - - - - gen.next() - - - true - - - - - gen.get() == 2 - - - 2 == 2 - - - - - gen.next() - - - true - - - - - gen.get() == 5 - - - 5 == 5 - - - - - !(gen.next()) - - - !false - - - -
- -
- -
- -
-
-
-
-
- - Current expected value is -1 - - - - gen.get() == Approx(expected) - - - -1.0 == Approx( -1.0 ) - - - - Current expected value is -1 - - - - gen.next() - - - true - - - - Current expected value is -0.9 - - - - gen.get() == Approx(expected) - - - -0.90000000000000002 -== -Approx( -0.90000000000000002 ) - - - - Current expected value is -0.9 - - - - gen.next() - - - true - - - - Current expected value is -0.8 - - - - gen.get() == Approx(expected) - - - -0.80000000000000004 -== -Approx( -0.80000000000000004 ) - - - - Current expected value is -0.8 - - - - gen.next() - - - true - - - - Current expected value is -0.7 - - - - gen.get() == Approx(expected) - - - -0.70000000000000007 -== -Approx( -0.70000000000000007 ) - - - - Current expected value is -0.7 - - - - gen.next() - - - true - - - - Current expected value is -0.6 - - - - gen.get() == Approx(expected) - - - -0.60000000000000009 -== -Approx( -0.60000000000000009 ) - - - - Current expected value is -0.6 - - - - gen.next() - - - true - - - - Current expected value is -0.5 - - - - gen.get() == Approx(expected) - - - -0.50000000000000011 -== -Approx( -0.50000000000000011 ) - - - - Current expected value is -0.5 - - - - gen.next() - - - true - - - - Current expected value is -0.4 - - - - gen.get() == Approx(expected) - - - -0.40000000000000013 -== -Approx( -0.40000000000000013 ) - - - - Current expected value is -0.4 - - - - gen.next() - - - true - - - - Current expected value is -0.3 - - - - gen.get() == Approx(expected) - - - -0.30000000000000016 -== -Approx( -0.30000000000000016 ) - - - - Current expected value is -0.3 - - - - gen.next() - - - true - - - - Current expected value is -0.2 - - - - gen.get() == Approx(expected) - - - -0.20000000000000015 -== -Approx( -0.20000000000000015 ) - - - - Current expected value is -0.2 - - - - gen.next() - - - true - - - - Current expected value is -0.1 - - - - gen.get() == Approx(expected) - - - -0.10000000000000014 -== -Approx( -0.10000000000000014 ) - - - - Current expected value is -0.1 - - - - gen.next() - - - true - - - - Current expected value is -1.38778e-16 - - - - gen.get() == Approx(expected) - - - -0.00000000000000014 -== -Approx( -0.00000000000000014 ) - - - - Current expected value is -1.38778e-16 - - - - gen.next() - - - true - - - - Current expected value is 0.1 - - - - gen.get() == Approx(expected) - - - 0.09999999999999987 -== -Approx( 0.09999999999999987 ) - - - - Current expected value is 0.1 - - - - gen.next() - - - true - - - - Current expected value is 0.2 - - - - gen.get() == Approx(expected) - - - 0.19999999999999987 -== -Approx( 0.19999999999999987 ) - - - - Current expected value is 0.2 - - - - gen.next() - - - true - - - - Current expected value is 0.3 - - - - gen.get() == Approx(expected) - - - 0.29999999999999988 -== -Approx( 0.29999999999999988 ) - - - - Current expected value is 0.3 - - - - gen.next() - - - true - - - - Current expected value is 0.4 - - - - gen.get() == Approx(expected) - - - 0.39999999999999991 -== -Approx( 0.39999999999999991 ) - - - - Current expected value is 0.4 - - - - gen.next() - - - true - - - - Current expected value is 0.5 - - - - gen.get() == Approx(expected) - - - 0.49999999999999989 -== -Approx( 0.49999999999999989 ) - - - - Current expected value is 0.5 - - - - gen.next() - - - true - - - - Current expected value is 0.6 - - - - gen.get() == Approx(expected) - - - 0.59999999999999987 -== -Approx( 0.59999999999999987 ) - - - - Current expected value is 0.6 - - - - gen.next() - - - true - - - - Current expected value is 0.7 - - - - gen.get() == Approx(expected) - - - 0.69999999999999984 -== -Approx( 0.69999999999999984 ) - - - - Current expected value is 0.7 - - - - gen.next() - - - true - - - - Current expected value is 0.8 - - - - gen.get() == Approx(expected) - - - 0.79999999999999982 -== -Approx( 0.79999999999999982 ) - - - - Current expected value is 0.8 - - - - gen.next() - - - true - - - - Current expected value is 0.9 - - - - gen.get() == Approx(expected) - - - 0.8999999999999998 -== -Approx( 0.8999999999999998 ) - - - - Current expected value is 0.9 - - - - gen.next() - - - true - - - - - gen.get() == Approx( rangeEnd ) - - - 0.99999999999999978 == Approx( 1.0 ) - - - - - !(gen.next()) - - - !false - - - -
- -
- -
- -
-
-
-
-
- - Current expected value is -1 - - - - gen.get() == Approx(expected) - - - -1.0 == Approx( -1.0 ) - - - - Current expected value is -1 - - - - gen.next() - - - true - - - - Current expected value is -0.7 - - - - gen.get() == Approx(expected) - - - -0.69999999999999996 -== -Approx( -0.69999999999999996 ) - - - - Current expected value is -0.7 - - - - gen.next() - - - true - - - - Current expected value is -0.4 - - - - gen.get() == Approx(expected) - - - -0.39999999999999997 -== -Approx( -0.39999999999999997 ) - - - - Current expected value is -0.4 - - - - gen.next() - - - true - - - - Current expected value is -0.1 - - - - gen.get() == Approx(expected) - - - -0.09999999999999998 -== -Approx( -0.09999999999999998 ) - - - - Current expected value is -0.1 - - - - gen.next() - - - true - - - - Current expected value is 0.2 - - - - gen.get() == Approx(expected) - - - 0.20000000000000001 -== -Approx( 0.20000000000000001 ) - - - - Current expected value is 0.2 - - - - gen.next() - - - true - - - - Current expected value is 0.5 - - - - gen.get() == Approx(expected) - - - 0.5 == Approx( 0.5 ) - - - - Current expected value is 0.5 - - - - gen.next() - - - true - - - - - !(gen.next()) - - - !false - - - -
- -
- -
- -
-
-
-
-
- - Current expected value is -1 - - - - gen.get() == Approx(expected) - - - -1.0 == Approx( -1.0 ) - - - - Current expected value is -1 - - - - gen.next() - - - true - - - - Current expected value is -0.7 - - - - gen.get() == Approx(expected) - - - -0.69999999999999996 -== -Approx( -0.69999999999999996 ) - - - - Current expected value is -0.7 - - - - gen.next() - - - true - - - - Current expected value is -0.4 - - - - gen.get() == Approx(expected) - - - -0.39999999999999997 -== -Approx( -0.39999999999999997 ) - - - - Current expected value is -0.4 - - - - gen.next() - - - true - - - - Current expected value is -0.1 - - - - gen.get() == Approx(expected) - - - -0.09999999999999998 -== -Approx( -0.09999999999999998 ) - - - - Current expected value is -0.1 - - - - gen.next() - - - true - - - - Current expected value is 0.2 - - - - gen.get() == Approx(expected) - - - 0.20000000000000001 -== -Approx( 0.20000000000000001 ) - - - - Current expected value is 0.2 - - - - gen.next() - - - true - - - - Current expected value is 0.5 - - - - gen.get() == Approx(expected) - - - 0.5 == Approx( 0.5 ) - - - - Current expected value is 0.5 - - - - gen.next() - - - true - - - - - !(gen.next()) - - - !false - - - -
- -
- -
- -
-
-
-
-
- - - gen.get() == 5 - - - 5 == 5 - - - - - gen.next() - - - true - - - - - gen.get() == 2 - - - 2 == 2 - - - - - gen.next() - - - true - - - - - gen.get() == -1 - - - -1 == -1 - - - - - gen.next() - - - true - - - - - gen.get() == -4 - - - -4 == -4 - - - - - !(gen.next()) - - - !false - - - -
- -
- -
- -
-
-
-
-
- - - gen.get() == 5 - - - 5 == 5 - - - - - gen.next() - - - true - - - - - gen.get() == 2 - - - 2 == 2 - - - - - gen.next() - - - true - - - - - gen.get() == -1 - - - -1 == -1 - - - - - gen.next() - - - true - - - - - gen.get() == -4 - - - -4 == -4 - - - - - !(gen.next()) - - - !false - - - -
- -
- -
- -
-
-
-
-
- - - gen.get() == 5 - - - 5 == 5 - - - - - gen.next() - - - true - - - - - gen.get() == 2 - - - 2 == 2 - - - - - gen.next() - - - true - - - - - gen.get() == -1 - - - -1 == -1 - - - - - gen.next() - - - true - - - - - gen.get() == -4 - - - -4 == -4 - - - - - gen.next() - - - true - - - - - gen.get() == -7 - - - -7 == -7 - - - - - !(gen.next()) - - - !false - - - -
- -
- -
- -
- -
- - - - d >= Approx( 1.22 ) - - - 1.22999999999999998 ->= -Approx( 1.21999999999999997 ) - - - - - d >= Approx( 1.23 ) - - - 1.22999999999999998 ->= -Approx( 1.22999999999999998 ) - - - - - !(d >= Approx( 1.24 )) - - - !(1.22999999999999998 ->= -Approx( 1.23999999999999999 )) - - - - - d >= Approx( 1.24 ).epsilon(0.1) - - - 1.22999999999999998 ->= -Approx( 1.23999999999999999 ) - - - - - - - - h1( dummy ) != h2( dummy ) - - - 3422778688 (0x) -!= -130711275 (0x) - - - - - - - - h1( dummy ) == h2( dummy ) - - - 3422778688 (0x) -== -3422778688 (0x) - - - - - -
- - - h( dummy1 ) != h( dummy2 ) - - - 2903002874 (0x) -!= -2668622104 (0x) - - - -
-
- - - h( dummy1 ) != h( dummy2 ) - - - 2673152918 (0x) -!= -3916075712 (0x) - - - -
-
- - - h( dummy1 ) != h( dummy2 ) - - - 2074929312 (0x) -!= -3429949824 (0x) - - - -
- -
- - - - h( dummy ) == h( dummy ) - - - 3422778688 (0x) -== -3422778688 (0x) - - - - - - - This info has multiple parts. - - - This unscoped info has multiple parts. - - - Show infos! - - - - - - this is a message - - - this is a warning - - - - - - this message should be logged - - - so should this - - - - a == 1 - - - 2 == 1 - - - - - - - this message may be logged later - - - - a == 2 - - - 2 == 2 - - - - this message may be logged later - - - this message should be logged - - - - a == 1 - - - 2 == 1 - - - - this message may be logged later - - - this message should be logged - - - and this, but later - - - - a == 0 - - - 2 == 0 - - - - this message may be logged later - - - this message should be logged - - - and this, but later - - - but not this - - - - a == 2 - - - 2 == 2 - - - - - - - current counter 0 - - - i := 0 - - - - i < 10 - - - 0 < 10 - - - - current counter 1 - - - i := 1 - - - - i < 10 - - - 1 < 10 - - - - current counter 2 - - - i := 2 - - - - i < 10 - - - 2 < 10 - - - - current counter 3 - - - i := 3 - - - - i < 10 - - - 3 < 10 - - - - current counter 4 - - - i := 4 - - - - i < 10 - - - 4 < 10 - - - - current counter 5 - - - i := 5 - - - - i < 10 - - - 5 < 10 - - - - current counter 6 - - - i := 6 - - - - i < 10 - - - 6 < 10 - - - - current counter 7 - - - i := 7 - - - - i < 10 - - - 7 < 10 - - - - current counter 8 - - - i := 8 - - - - i < 10 - - - 8 < 10 - - - - current counter 9 - - - i := 9 - - - - i < 10 - - - 9 < 10 - - - - current counter 10 - - - i := 10 - - - - i < 10 - - - 10 < 10 - - - - - - - - Dummy - - - Dummy - - - Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE - - - - - - - - data.int_seven != 7 - - - 7 != 7 - - - - - data.float_nine_point_one != Approx( 9.1f ) - - - 9.100000381f -!= -Approx( 9.10000038146972656 ) - - - - - data.double_pi != Approx( 3.1415926535 ) - - - 3.14159265350000005 -!= -Approx( 3.14159265350000005 ) - - - - - data.str_hello != "hello" - - - "hello" != "hello" - - - - - data.str_hello.size() != 5 - - - 5 != 5 - - - - - - - - data.int_seven != 6 - - - 7 != 6 - - - - - data.int_seven != 8 - - - 7 != 8 - - - - - data.float_nine_point_one != Approx( 9.11f ) - - - 9.100000381f -!= -Approx( 9.10999965667724609 ) - - - - - data.float_nine_point_one != Approx( 9.0f ) - - - 9.100000381f != Approx( 9.0 ) - - - - - data.float_nine_point_one != Approx( 1 ) - - - 9.100000381f != Approx( 1.0 ) - - - - - data.float_nine_point_one != Approx( 0 ) - - - 9.100000381f != Approx( 0.0 ) - - - - - data.double_pi != Approx( 3.1415 ) - - - 3.14159265350000005 -!= -Approx( 3.14150000000000018 ) - - - - - data.str_hello != "goodbye" - - - "hello" != "goodbye" - - - - - data.str_hello != "hell" - - - "hello" != "hell" - - - - - data.str_hello != "hello1" - - - "hello" != "hello1" - - - - - data.str_hello.size() != 6 - - - 5 != 6 - - - - - -
- - - stream.str() == "" - - - "" == "" - - - -
-
- - - stream.str() == "{\n}" - - - "{ -}" -== -"{ -}" - - - -
-
- - - stream.str(), ContainsSubstring( "\"int\": 1," ) && ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"true\": true," ) && ContainsSubstring( "\"false\": false," ) && ContainsSubstring( "\"string\": \"this is a string\"," ) && ContainsSubstring( "\"array\": [\n 1,\n 2\n ]\n}" ) - - - "{ - "int": 1, - "double": 1.5, - "true": true, - "false": false, - "string": "this is a string", - "array": [ - 1, - 2 - ] -}" ( contains: ""int": 1," and contains: ""double": 1.5," and contains: ""true": true," and contains: ""false": false," and contains: ""string": "this is a string"," and contains: ""array": [ - 1, - 2 - ] -}" ) - - - -
-
- - - stream.str(), ContainsSubstring( "\"empty_object\": {\n }," ) && ContainsSubstring( "\"fully_object\": {\n \"key\": 1\n }" ) - - - "{ - "empty_object": { - }, - "fully_object": { - "key": 1 - } -}" ( contains: ""empty_object": { - }," and contains: ""fully_object": { - "key": 1 - }" ) - - - -
-
- - - stream.str() == "[\n]" - - - "[ -]" -== -"[ -]" - - - -
-
- - - stream.str() == "[\n 1,\n 1.5,\n true,\n false,\n \"this is a string\",\n {\n \"object\": 42\n },\n [\n \"array\",\n 42.5\n ]\n]" - - - "[ - 1, - 1.5, - true, - false, - "this is a string", - { - "object": 42 - }, - [ - "array", - 42.5 - ] -]" -== -"[ - 1, - 1.5, - true, - false, - "this is a string", - { - "object": 42 - }, - [ - "array", - 42.5 - ] -]" - - - -
-
- - - stream.str() == "{\n}" - - - "{ -}" -== -"{ -}" - - - -
-
- - - stream.str() == "[\n]" - - - "[ -]" -== -"[ -]" - - - -
-
- - - stream.str() == "\"custom\"" - - - ""custom"" == ""custom"" - - - -
- -
- -
- - - sstream.str() == "\"\\\"\"" - - - ""\""" == ""\""" - - - -
-
- - - sstream.str() == "\"\\\\\"" - - - ""\\"" == ""\\"" - - - -
-
- - - sstream.str() == "\"/\"" - - - ""/"" == ""/"" - - - -
-
- - - sstream.str() == "\"\\b\"" - - - ""\b"" == ""\b"" - - - -
-
- - - sstream.str() == "\"\\f\"" - - - ""\f"" == ""\f"" - - - -
-
- - - sstream.str() == "\"\\n\"" - - - ""\n"" == ""\n"" - - - -
-
- - - sstream.str() == "\"\\r\"" - - - ""\r"" == ""\r"" - - - -
-
- - - sstream.str() == "\"\\t\"" - - - ""\t"" == ""\t"" - - - -
-
- - - sstream.str() == "\"\\\\/\\t\\r\\n\"" - - - ""\\/\t\r\n"" == ""\\/\t\r\n"" - - - -
- -
- - - - []() { return true; }() - - - true - - - - - - - - d <= Approx( 1.24 ) - - - 1.22999999999999998 -<= -Approx( 1.23999999999999999 ) - - - - - d <= Approx( 1.23 ) - - - 1.22999999999999998 -<= -Approx( 1.22999999999999998 ) - - - - - !(d <= Approx( 1.22 )) - - - !(1.22999999999999998 -<= -Approx( 1.21999999999999997 )) - - - - - d <= Approx( 1.22 ).epsilon(0.1) - - - 1.22999999999999998 -<= -Approx( 1.21999999999999997 ) - - - - - - - - - - - testStringForMatching(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "contains" ) - - - "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) - - - - - - - - testStringForMatching(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) - - - "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) - - - - - testStringForMatching2(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) - - - "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) - - - - - - - - testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "substring" ) - - - "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) - - - - - - - - testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) - - - "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) - - - - - - - - testStringForMatching(), !ContainsSubstring( "different" ) - - - "this string contains 'abc' as a substring" not contains: "different" - - - - - - - - testStringForMatching(), !ContainsSubstring( "substring" ) - - - "this string contains 'abc' as a substring" not contains: "substring" - - - - - -
-
- - -
- -
-
-
- - -
- -
-
- -
-
-
- - -
- -
-
-
- - -
- -
-
- -
- -
- - - - thisThrows(), "expected exception" - - - "expected exception" equals: "expected exception" - - - - - thisThrows(), "should fail" - - - "expected exception" equals: "should fail" - - - - - - - - records == expected - - - { "Hello", "world", "Goodbye", "world" } -== -{ "Hello", "world", "Goodbye", "world" } - - - - - - - - multiReporter.getPreferences().shouldRedirectStdOut == false - - - false == false - - - - - multiReporter.getPreferences().shouldReportAllAssertions == false - - - false == false - - -
- - - multiReporter.getPreferences().shouldRedirectStdOut == true - - - true == true - - - - - multiReporter.getPreferences().shouldReportAllAssertions == false - - - false == false - - - - - multiReporter.getPreferences().shouldRedirectStdOut == true - - - true == true - - - - - multiReporter.getPreferences().shouldReportAllAssertions == true - - - true == true - - - - - multiReporter.getPreferences().shouldRedirectStdOut == true - - - true == true - - - - - multiReporter.getPreferences().shouldReportAllAssertions == true - - - true == true - - - -
- - - multiReporter.getPreferences().shouldRedirectStdOut == false - - - false == false - - - - - multiReporter.getPreferences().shouldReportAllAssertions == false - - - false == false - - -
- - - multiReporter.getPreferences().shouldRedirectStdOut == true - - - true == true - - - - - multiReporter.getPreferences().shouldReportAllAssertions == false - - - false == false - - - - - multiReporter.getPreferences().shouldRedirectStdOut == true - - - true == true - - - - - multiReporter.getPreferences().shouldReportAllAssertions == true - - - true == true - - - - - multiReporter.getPreferences().shouldRedirectStdOut == true - - - true == true - - - - - multiReporter.getPreferences().shouldReportAllAssertions == true - - - true == true - - - -
- -
- - - - values > -6 - - - 3 > -6 - - - - - values > -6 - - - 4 > -6 - - - - - values > -6 - - - 5 > -6 - - - - - values > -6 - - - 6 > -6 - - - - - values > -6 - - - -5 > -6 - - - - - values > -6 - - - -4 > -6 - - - - - values > -6 - - - 90 > -6 - - - - - values > -6 - - - 91 > -6 - - - - - values > -6 - - - 92 > -6 - - - - - values > -6 - - - 93 > -6 - - - - - values > -6 - - - 94 > -6 - - - - - values > -6 - - - 95 > -6 - - - - - values > -6 - - - 96 > -6 - - - - - values > -6 - - - 97 > -6 - - - - - values > -6 - - - 98 > -6 - - - - - values > -6 - - - 99 > -6 - - - - - - - This one ran - - - - - - custom exception - - - - - - - True - - - {?} - - - - - !False - - - true - - - - - !(False) - - - !{?} - - - - - - - - - - - data.int_seven > 7 - - - 7 > 7 - - - - - data.int_seven < 7 - - - 7 < 7 - - - - - data.int_seven > 8 - - - 7 > 8 - - - - - data.int_seven < 6 - - - 7 < 6 - - - - - data.int_seven < 0 - - - 7 < 0 - - - - - data.int_seven < -1 - - - 7 < -1 - - - - - data.int_seven >= 8 - - - 7 >= 8 - - - - - data.int_seven <= 6 - - - 7 <= 6 - - - - - data.float_nine_point_one < 9 - - - 9.100000381f < 9 - - - - - data.float_nine_point_one > 10 - - - 9.100000381f > 10 - - - - - data.float_nine_point_one > 9.2 - - - 9.100000381f > 9.19999999999999929 - - - - - data.str_hello > "hello" - - - "hello" > "hello" - - - - - data.str_hello < "hello" - - - "hello" < "hello" - - - - - data.str_hello > "hellp" - - - "hello" > "hellp" - - - - - data.str_hello > "z" - - - "hello" > "z" - - - - - data.str_hello < "hellm" - - - "hello" < "hellm" - - - - - data.str_hello < "a" - - - "hello" < "a" - - - - - data.str_hello >= "z" - - - "hello" >= "z" - - - - - data.str_hello <= "a" - - - "hello" <= "a" - - - - - - - - data.int_seven < 8 - - - 7 < 8 - - - - - data.int_seven > 6 - - - 7 > 6 - - - - - data.int_seven > 0 - - - 7 > 0 - - - - - data.int_seven > -1 - - - 7 > -1 - - - - - data.int_seven >= 7 - - - 7 >= 7 - - - - - data.int_seven >= 6 - - - 7 >= 6 - - - - - data.int_seven <= 7 - - - 7 <= 7 - - - - - data.int_seven <= 8 - - - 7 <= 8 - - - - - data.float_nine_point_one > 9 - - - 9.100000381f > 9 - - - - - data.float_nine_point_one < 10 - - - 9.100000381f < 10 - - - - - data.float_nine_point_one < 9.2 - - - 9.100000381f < 9.19999999999999929 - - - - - data.str_hello <= "hello" - - - "hello" <= "hello" - - - - - data.str_hello >= "hello" - - - "hello" >= "hello" - - - - - data.str_hello < "hellp" - - - "hello" < "hellp" - - - - - data.str_hello < "zebra" - - - "hello" < "zebra" - - - - - data.str_hello > "hellm" - - - "hello" > "hellm" - - - - - data.str_hello > "a" - - - "hello" > "a" - - - - - -
- - - rng() == 0x - - - 4242248763 (0x) -== -4242248763 (0x) - - - - - rng() == 0x - - - 1867888929 (0x) -== -1867888929 (0x) - - - - - rng() == 0x - - - 1276619030 (0x) -== -1276619030 (0x) - - - - - rng() == 0x - - - 1911218783 (0x) -== -1911218783 (0x) - - - - - rng() == 0x - - - 1827115164 (0x) -== -1827115164 (0x) - - - -
-
- - - rng() == 0x - - - 1472234645 (0x) -== -1472234645 (0x) - - - - - rng() == 0x - - - 868832940 (0x) -== -868832940 (0x) - - - - - rng() == 0x - - - 570883446 (0x) -== -570883446 (0x) - - - - - rng() == 0x - - - 889299803 (0x) -== -889299803 (0x) - - - - - rng() == 0x - - - 4261393167 (0x) -== -4261393167 (0x) - - - - - rng() == 0x - - - 1472234645 (0x) -== -1472234645 (0x) - - - - - rng() == 0x - - - 868832940 (0x) -== -868832940 (0x) - - - - - rng() == 0x - - - 570883446 (0x) -== -570883446 (0x) - - - - - rng() == 0x - - - 889299803 (0x) -== -889299803 (0x) - - - - - rng() == 0x - - - 4261393167 (0x) -== -4261393167 (0x) - - - -
- -
- -
- - Message from section one - - -
-
- - Message from section two - - -
- -
- - - - ( EvilMatcher(), EvilMatcher() ), EvilCommaOperatorUsed - - - ( EvilMatcher(), EvilMatcher() ), EvilCommaOperatorUsed - - - - - &EvilMatcher(), EvilAddressOfOperatorUsed - - - &EvilMatcher(), EvilAddressOfOperatorUsed - - - - - EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) - - - EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) - - - - - ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() - - - ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() - - - - - -
- - - parseUInt( "0" ) == Optional<unsigned int>{ 0 } - - - {?} == {?} - - - - - parseUInt( "100" ) == Optional<unsigned int>{ 100 } - - - {?} == {?} - - - - - parseUInt( "4294967295" ) == Optional<unsigned int>{ 4294967295 } - - - {?} == {?} - - - - - parseUInt( "0x", 16 ) == Optional<unsigned int>{ 255 } - - - {?} == {?} - - - -
-
- - - !(parseUInt( "" )) - - - !{?} - - - - - !(parseUInt( "!!KJHF*#" )) - - - !{?} - - - - - !(parseUInt( "-1" )) - - - !{?} - - - - - !(parseUInt( "4294967296" )) - - - !{?} - - - - - !(parseUInt( "42949672964294967296429496729642949672964294967296" )) - - - !{?} - - - - - !(parseUInt( "2 4" )) - - - !{?} - - - - - !(parseUInt( "0x", 10 )) - - - !{?} - - - -
- -
- - - - spec.hasFilters() - - - true - - - - - spec.getInvalidSpecs().empty() - - - true - - - - - spec.matches( testCase ) - - - true - - - - - -
- - - cli.parse({ "test", "--shard-count=8" }) - - - {?} - - - - - config.shardCount == 8 - - - 8 == 8 - - - -
-
- - - !(result) - - - !{?} - - - - - result.errorMessage(), ContainsSubstring( "Could not parse '-1' as shard count" ) - - - "Could not parse '-1' as shard count" contains: "Could not parse '-1' as shard count" - - - -
-
- - - !(result) - - - !{?} - - - - - result.errorMessage(), ContainsSubstring( "Shard count must be positive" ) - - - "Shard count must be positive" contains: "Shard count must be positive" - - - -
-
- - - cli.parse({ "test", "--shard-index=2" }) - - - {?} - - - - - config.shardIndex == 2 - - - 2 == 2 - - - -
-
- - - !(result) - - - !{?} - - - - - result.errorMessage(), ContainsSubstring( "Could not parse '-12' as shard index" ) - - - "Could not parse '-12' as shard index" contains: "Could not parse '-12' as shard index" - - - -
-
- - - cli.parse({ "test", "--shard-index=0" }) - - - {?} - - - - - config.shardIndex == 0 - - - 0 == 0 - - - -
- -
- - - tagString := "[tag with spaces]" - - - - spec.hasFilters() - - - true - - - - tagString := "[tag with spaces]" - - - - spec.getInvalidSpecs().empty() - - - true - - - - tagString := "[tag with spaces]" - - - - spec.matches( testCase ) - - - true - - - - tagString := "[I said "good day" sir!]" - - - - spec.hasFilters() - - - true - - - - tagString := "[I said "good day" sir!]" - - - - spec.getInvalidSpecs().empty() - - - true - - - - tagString := "[I said "good day" sir!]" - - - - spec.matches( testCase ) - - - true - - - - - -
- - - cli.parse( { "test", "-w", "NoAssertions" } ) - - - {?} - - - - - config.warnings == WarnAbout::NoAssertions - - - 1 == 1 - - - -
-
- - - !(cli.parse( { "test", "-w", "NoTests" } )) - - - !{?} - - - -
-
- - - cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) - - - {?} - - - - - config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) - - - 3 == 3 - - - -
- -
- - - - p == 0 - - - 0 == 0 - - - - - p == pNULL - - - 0 == 0 - - - - - p != 0 - - - 0x != 0 - - - - - cp != 0 - - - 0x != 0 - - - - - cpc != 0 - - - 0x != 0 - - - - - returnsNull() == 0 - - - {null string} == 0 - - - - - returnsConstNull() == 0 - - - {null string} == 0 - - - - - 0 != p - - - 0 != 0x - - - - - -
- - - str1.size() == 3 + 5 - - - 8 == 8 - - - - - str2.size() == 3 + 10 - - - 13 == 13 - - - -
-
- - - str1.size() == 2 + 5 - - - 7 == 7 - - - - - str2.size() == 2 + 15 - - - 17 == 17 - - - -
- -
- - - - "foo", Predicate<const char*>( []( const char* const& ) { return true; } ) - - - "foo" matches undescribed predicate - - - - - -
- - - result - - - {?} - - - - - config.processName == "" - - - "" == "" - - - -
-
- - - result - - - {?} - - - - - config.processName == "test" - - - "test" == "test" - - - - - config.shouldDebugBreak == false - - - false == false - - - - - config.abortAfter == -1 - - - -1 == -1 - - - - - config.noThrow == false - - - false == false - - - - - config.reporterSpecifications.empty() - - - true - - - - - !(cfg.hasTestFilters()) - - - !false - - - - - cfg.getReporterSpecs().size() == 1 - - - 1 == 1 - - - - - cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } - - - {?} == {?} - - - - - cfg.getProcessedReporterSpecs().size() == 1 - - - 1 == 1 - - - - - cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } - - - {?} == {?} - - - -
-
-
- - - result - - - {?} - - - - - cfg.hasTestFilters() - - - true - - - - - cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false - - - false == false - - - - - cfg.testSpec().matches(*fakeTestCase("test1")) - - - true - - - -
- -
-
-
- - - result - - - {?} - - - - - cfg.hasTestFilters() - - - true - - - - - cfg.testSpec().matches(*fakeTestCase("test1")) == false - - - false == false - - - - - cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) - - - true - - - -
- -
-
-
- - - result - - - {?} - - - - - cfg.hasTestFilters() - - - true - - - - - cfg.testSpec().matches(*fakeTestCase("test1")) == false - - - false == false - - - - - cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) - - - true - - - -
- -
-
-
- - result.errorMessage() := "" - - - - result - - - {?} - - - - result.errorMessage() := "" - - - - config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } - - - { {?} } == { {?} } - - - -
- -
-
-
- - result.errorMessage() := "" - - - - result - - - {?} - - - - result.errorMessage() := "" - - - - config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } - - - { {?} } == { {?} } - - - -
- -
-
-
- - result.errorMessage() := "" - - - - result - - - {?} - - - - result.errorMessage() := "" - - - - config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } - - - { {?} } == { {?} } - - - -
- -
-
-
- - - !result - - - true - - - - - result.errorMessage(), ContainsSubstring("Unrecognized reporter") - - - "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" - - - -
- -
-
-
- - result.errorMessage() := "" - - - - result - - - {?} - - - - result.errorMessage() := "" - - - - config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } - - - { {?} } == { {?} } - - - -
- -
-
-
- - result.errorMessage() := "" - - - - result - - - {?} - - - - result.errorMessage() := "" - - - - config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } - - - { {?} } == { {?} } - - - -
- -
-
-
-
- - - cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) - - - {?} - - - - - config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } - - - { {?}, {?} } == { {?}, {?} } - - - -
- -
- -
-
-
-
- - - cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) - - - {?} - - - - - config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } - - - { {?}, {?} } == { {?}, {?} } - - - -
- -
- -
-
-
-
- - - !result - - - true - - - - - result.errorMessage(), ContainsSubstring("Only one reporter may have unspecified output file.") - - - "Only one reporter may have unspecified output file." contains: "Only one reporter may have unspecified output file." - - - -
- -
- -
-
-
- - - cli.parse({"test", "-b"}) - - - {?} - - - - - config.shouldDebugBreak == true - - - true == true - - - -
- -
-
-
- - - cli.parse({"test", "--break"}) - - - {?} - - - - - config.shouldDebugBreak - - - true - - - -
- -
-
-
- - - cli.parse({"test", "-a"}) - - - {?} - - - - - config.abortAfter == 1 - - - 1 == 1 - - - -
- -
-
-
- - - cli.parse({"test", "-x", "2"}) - - - {?} - - - - - config.abortAfter == 2 - - - 2 == 2 - - - -
- -
-
-
- - - !result - - - true - - - - - result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("oops") - - - "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) - - - -
- -
-
-
-
- - - cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) - - - {?} - - - - - config.waitForKeypress == std::get<1>(input) - - - 0 == 0 - - - -
- -
- -
-
-
-
- - - cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) - - - {?} - - - - - config.waitForKeypress == std::get<1>(input) - - - 1 == 1 - - - -
- -
- -
-
-
-
- - - cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) - - - {?} - - - - - config.waitForKeypress == std::get<1>(input) - - - 2 == 2 - - - -
- -
- -
-
-
-
- - - cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) - - - {?} - - - - - config.waitForKeypress == std::get<1>(input) - - - 3 == 3 - - - -
- -
- -
-
-
-
- - - !result - - - true - - - - - result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("both") - - - "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) - - - -
- -
- -
-
-
- - - cli.parse({"test", "-e"}) - - - {?} - - - - - config.noThrow - - - true - - - -
- -
-
-
- - - cli.parse({"test", "--nothrow"}) - - - {?} - - - - - config.noThrow - - - true - - - -
- -
-
-
- - - cli.parse({"test", "-o", "filename.ext"}) - - - {?} - - - - - config.defaultOutputFilename == "filename.ext" - - - "filename.ext" == "filename.ext" - - - -
- -
-
-
- - - cli.parse({"test", "--out", "filename.ext"}) - - - {?} - - - - - config.defaultOutputFilename == "filename.ext" - - - "filename.ext" == "filename.ext" - - - -
- -
-
-
- - - cli.parse({"test", "-abe"}) - - - {?} - - - - - config.abortAfter == 1 - - - 1 == 1 - - - - - config.shouldDebugBreak - - - true - - - - - config.noThrow == true - - - true == true - - - -
- -
-
-
- - - cli.parse({"test"}) - - - {?} - - - - - config.defaultColourMode == ColourMode::PlatformDefault - - - 0 == 0 - - - -
- -
-
-
- - - cli.parse( { "test", "--colour-mode", "default" } ) - - - {?} - - - - - config.defaultColourMode == ColourMode::PlatformDefault - - - 0 == 0 - - - -
- -
-
-
- - - cli.parse({"test", "--colour-mode", "ansi"}) - - - {?} - - - - - config.defaultColourMode == ColourMode::ANSI - - - 1 == 1 - - - -
- -
-
-
- - - cli.parse({"test", "--colour-mode", "none"}) - - - {?} - - - - - config.defaultColourMode == ColourMode::None - - - 3 == 3 - - - -
- -
-
-
- - - !result - - - true - - - - - result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) - - - "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not recognised" contains: "colour mode must be one of" - - - -
- -
-
-
- - - cli.parse({ "test", "--benchmark-samples=200" }) - - - {?} - - - - - config.benchmarkSamples == 200 - - - 200 == 200 - - - -
- -
-
-
- - - cli.parse({ "test", "--benchmark-resamples=20000" }) - - - {?} - - - - - config.benchmarkResamples == 20000 - - - 20000 (0x) == 20000 (0x) - - - -
- -
-
-
- - - cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) - - - {?} - - - - - config.benchmarkConfidenceInterval == Catch::Approx(0.99) - - - 0.98999999999999999 -== -Approx( 0.98999999999999999 ) - - - -
- -
-
-
- - - cli.parse({ "test", "--benchmark-no-analysis" }) - - - {?} - - - - - config.benchmarkNoAnalysis - - - true - - - -
- -
-
-
- - - cli.parse({ "test", "--benchmark-warmup-time=10" }) - - - {?} - - - - - config.benchmarkWarmupTime == 10 - - - 10 == 10 - - - -
- -
- -
- - - - std::tuple_size<TestType>::value >= 1 - - - 3 >= 1 - - - - - - - - std::tuple_size<TestType>::value >= 1 - - - 2 >= 1 - - - - - - - - std::tuple_size<TestType>::value >= 1 - - - 1 >= 1 - - - - - - - - Catch::generateRandomSeed(method) - - - Catch::generateRandomSeed(method) - - - - - Catch::generateRandomSeed(method) - - - Catch::generateRandomSeed(method) - - - - - Catch::generateRandomSeed(method) - - - Catch::generateRandomSeed(method) - - - - - - - - Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) - - - Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) - - - - - - - - Catch::Detail::stringify(UsesSentinel{}) == "{ }" - - - "{ }" == "{ }" - - - - - - - - truthy(false) - - - Hey, its truthy! - - - - - - - - testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) - - - "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively - - - - - testStringForMatching(), Matches( "contains 'abc' as a substring" ) - - - "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively - - - - - testStringForMatching(), Matches( "this string contains 'abc' as a" ) - - - "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively - - - - - - - - registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" - - - "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'" - - - - - - - - actual, !UnorderedEquals( expected ) - - - { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } - - - - - - - - !(factories.empty()) - - - !false - - -
- - Tested reporter: Automake - - - - listingString, ContainsSubstring("fakeTag"s) - - - "All available tags: - 1 [fakeTag] -1 tag - -" contains: "fakeTag" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: Automake - - - - listingString, ContainsSubstring("fake reporter"s) - - - "Available reporters: - fake reporter: fake description - -" contains: "fake reporter" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: Automake - - - - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) - - - "All available test cases: - fake test name - [fakeTestTag] -1 test case - -" ( contains: "fake test name" and contains: "fakeTestTag" ) - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: compact - - - - listingString, ContainsSubstring("fakeTag"s) - - - "All available tags: - 1 [fakeTag] -1 tag - -" contains: "fakeTag" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: compact - - - - listingString, ContainsSubstring("fake reporter"s) - - - "Available reporters: - fake reporter: fake description - -" contains: "fake reporter" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: compact - - - - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) - - - "All available test cases: - fake test name - [fakeTestTag] -1 test case - -" ( contains: "fake test name" and contains: "fakeTestTag" ) - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: console - - - - listingString, ContainsSubstring("fakeTag"s) - - - "All available tags: - 1 [fakeTag] -1 tag - -" contains: "fakeTag" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: console - - - - listingString, ContainsSubstring("fake reporter"s) - - - "Available reporters: - fake reporter: fake description - -" contains: "fake reporter" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: console - - - - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) - - - "All available test cases: - fake test name - [fakeTestTag] -1 test case - -" ( contains: "fake test name" and contains: "fakeTestTag" ) - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: JSON - - - - listingString, ContainsSubstring("fakeTag"s) - - - "{ - "version": 1, - "metadata": { - "name": "", - "rng-seed": 1234, - "catch2-version": "" - }, - "listings": { - "tags": [ - { - "aliases": [ - "fakeTag" - ], - "count": 1 - } - ]" contains: "fakeTag" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: JSON - - - - listingString, ContainsSubstring("fake reporter"s) - - - "{ - "version": 1, - "metadata": { - "name": "", - "rng-seed": 1234, - "catch2-version": "" - }, - "listings": { - "reporters": [ - { - "name": "fake reporter", - "description": "fake description" - } - ]" contains: "fake reporter" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: JSON - - - - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) - - - "{ - "version": 1, - "metadata": { - "name": "", - "rng-seed": 1234, - "catch2-version": "" - }, - "listings": { - "tests": [ - { - "name": "fake test name", - "class-name": "", - "tags": [ - "fakeTestTag" - ], - "source-location": { - "filename": "fake-file.cpp", - "line": 123456789 - } - } - ]" ( contains: "fake test name" and contains: "fakeTestTag" ) - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: JUnit - - - - listingString, ContainsSubstring("fakeTag"s) - - - "<?xml version="1.0" encoding="UTF-8"?> -All available tags: - 1 [fakeTag] -1 tag - -" contains: "fakeTag" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: JUnit - - - - listingString, ContainsSubstring("fake reporter"s) - - - "<?xml version="1.0" encoding="UTF-8"?> -Available reporters: - fake reporter: fake description - -" contains: "fake reporter" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: JUnit - - - - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) - - - "<?xml version="1.0" encoding="UTF-8"?> -All available test cases: - fake test name - [fakeTestTag] -1 test case - -" ( contains: "fake test name" and contains: "fakeTestTag" ) - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: SonarQube - - - - listingString, ContainsSubstring("fakeTag"s) - - - "<?xml version="1.0" encoding="UTF-8"?> -All available tags: - 1 [fakeTag] -1 tag - -" contains: "fakeTag" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: SonarQube - - - - listingString, ContainsSubstring("fake reporter"s) - - - "<?xml version="1.0" encoding="UTF-8"?> -Available reporters: - fake reporter: fake description - -" contains: "fake reporter" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: SonarQube - - - - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) - - - "<?xml version="1.0" encoding="UTF-8"?> -All available test cases: - fake test name - [fakeTestTag] -1 test case - -" ( contains: "fake test name" and contains: "fakeTestTag" ) - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: TAP - - - - listingString, ContainsSubstring("fakeTag"s) - - - "All available tags: - 1 [fakeTag] -1 tag - -" contains: "fakeTag" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: TAP - - - - listingString, ContainsSubstring("fake reporter"s) - - - "Available reporters: - fake reporter: fake description - -" contains: "fake reporter" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: TAP - - - - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) - - - "All available test cases: - fake test name - [fakeTestTag] -1 test case - -" ( contains: "fake test name" and contains: "fakeTestTag" ) - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: TeamCity - - - - listingString, ContainsSubstring("fakeTag"s) - - - "All available tags: - 1 [fakeTag] -1 tag - -" contains: "fakeTag" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: TeamCity - - - - listingString, ContainsSubstring("fake reporter"s) - - - "Available reporters: - fake reporter: fake description - -" contains: "fake reporter" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: TeamCity - - - - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) - - - "All available test cases: - fake test name - [fakeTestTag] -1 test case - -" ( contains: "fake test name" and contains: "fakeTestTag" ) - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: XML - - - - listingString, ContainsSubstring("fakeTag"s) - - - "<?xml version="1.0" encoding="UTF-8"?> -<TagsFromMatchingTests> - <Tag> - <Count>1</Count> - <Aliases> - <Alias>fakeTag</Alias> - </Aliases> - </Tag> -</TagsFromMatchingTests>" contains: "fakeTag" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: XML - - - - listingString, ContainsSubstring("fake reporter"s) - - - "<?xml version="1.0" encoding="UTF-8"?> -<AvailableReporters> - <Reporter> - <Name>fake reporter</Name> - <Description>fake description</Description> - </Reporter> -</AvailableReporters>" contains: "fake reporter" - - - -
- - - !(factories.empty()) - - - !false - - -
- - Tested reporter: XML - - - - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) - - - "<?xml version="1.0" encoding="UTF-8"?> -<MatchingTests> - <TestCase> - <Name>fake test name</Name> - <ClassName/> - <Tags>[fakeTestTag]</Tags> - <SourceInfo> - <File>fake-file.cpp</File> - <Line>123456789</Line> - </SourceInfo> - </TestCase> -</MatchingTests>" ( contains: "fake test name" and contains: "fakeTestTag" ) - - - -
- -
- - - - - - - - - - -
- - - before == 0 - - - 0 == 0 - - -
-
- - - after > before - - - 1 > 0 - - - -
- -
- -
- -
- -
-
-
-
- - - itDoesThis() - - - true - - -
- - - itDoesThat() - - - true - - - -
- -
- -
- -
- -
- -
- -
-
-
- -
- -
- -
- -
- -
- - - v.size() == 0 - - - 0 == 0 - - -
-
- - - v.size() == 10 - - - 10 == 10 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - -
-
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - - -
- -
- -
- -
- -
-
- - - v.size() == 0 - - - 0 == 0 - - -
-
- - - v.capacity() >= 10 - - - 10 >= 10 - - - - - v.size() == 0 - - - 0 == 0 - - - -
- -
- -
- -
- - - -A string sent directly to stdout - - -A string sent directly to stderr -A string sent to stderr via clog - - - - - - - d == Approx( 1.23 ) - - - 1.22999999999999998 -== -Approx( 1.22999999999999998 ) - - - - - d != Approx( 1.22 ) - - - 1.22999999999999998 -!= -Approx( 1.21999999999999997 ) - - - - - d != Approx( 1.24 ) - - - 1.22999999999999998 -!= -Approx( 1.23999999999999999 ) - - - - - d == 1.23_a - - - 1.22999999999999998 -== -Approx( 1.22999999999999998 ) - - - - - d != 1.22_a - - - 1.22999999999999998 -!= -Approx( 1.21999999999999997 ) - - - - - Approx( d ) == 1.23 - - - Approx( 1.22999999999999998 ) -== -1.22999999999999998 - - - - - Approx( d ) != 1.22 - - - Approx( 1.22999999999999998 ) -!= -1.21999999999999997 - - - - - Approx( d ) != 1.24 - - - Approx( 1.22999999999999998 ) -!= -1.23999999999999999 - - - - - -
- -
-
- -
- - -Message from section one -Message from section two - - -
- - - - testStringForMatching(), StartsWith( "This String" ) - - - "this string contains 'abc' as a substring" starts with: "This String" - - - - - testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) - - - "this string contains 'abc' as a substring" starts with: "string" (case insensitive) - - - - - -
- - - Catch::Detail::stringify(singular) == "{ 1 }" - - - "{ 1 }" == "{ 1 }" - - - -
-
- - - Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" - - - "{ 3, 2, 1 }" == "{ 3, 2, 1 }" - - - -
-
- - - Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })" - - - "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" -== -"{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" - - - -
- -
- - - - testStringForMatching(), ContainsSubstring( "string" ) - - - "this string contains 'abc' as a substring" contains: "string" - - - - - testStringForMatching(), ContainsSubstring( "string", Catch::CaseSensitive::No ) - - - "this string contains 'abc' as a substring" contains: "string" (case insensitive) - - - - - testStringForMatching(), ContainsSubstring( "abc" ) - - - "this string contains 'abc' as a substring" contains: "abc" - - - - - testStringForMatching(), ContainsSubstring( "aBC", Catch::CaseSensitive::No ) - - - "this string contains 'abc' as a substring" contains: "abc" (case insensitive) - - - - - testStringForMatching(), StartsWith( "this" ) - - - "this string contains 'abc' as a substring" starts with: "this" - - - - - testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) - - - "this string contains 'abc' as a substring" starts with: "this" (case insensitive) - - - - - testStringForMatching(), EndsWith( "substring" ) - - - "this string contains 'abc' as a substring" ends with: "substring" - - - - - testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) - - - "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) - - - - - -
- - - empty.empty() - - - true - - - - - empty.size() == 0 - - - 0 == 0 - - - - - std::strcmp( empty.data(), "" ) == 0 - - - 0 == 0 - - - -
-
- - - s.empty() == false - - - false == false - - - - - s.size() == 5 - - - 5 == 5 - - - - - std::strcmp( rawChars, "hello" ) == 0 - - - 0 == 0 - - - - - s.data() == rawChars - - - "hello" == "hello" - - - -
-
- - - original == "original" - - - original == "original" - - - - - original.data() - - - original.data() - - - -
-
- - - original.begin() == copy.begin() - - - "original string" == "original string" - - - -
-
- - - original.begin() == copy.begin() - - - "original string" == "original string" - - - -
-
-
- - - ss.empty() == false - - - false == false - - - - - ss.size() == 5 - - - 5 == 5 - - - - - std::strncmp( ss.data(), "hello", 5 ) == 0 - - - 0 == 0 - - - - - ss == "hello" - - - hello == "hello" - - - -
- -
-
-
- - - ss.size() == 6 - - - 6 == 6 - - - - - std::strcmp( ss.data(), "world!" ) == 0 - - - 0 == 0 - - - -
- -
-
-
- - - s.data() == s2.data() - - - "hello world!" == "hello world!" - - - -
- -
-
-
- - - s.data() == ss.data() - - - "hello world!" == "hello world!" - - - -
- -
-
-
- - - s.substr(s.size() + 1, 123).empty() - - - true - - - -
- -
-
-
- - - std::strcmp(ss.data(), "world!") == 0 - - - 0 == 0 - - - -
- -
-
-
- - - s.substr(1'000'000, 1).empty() - - - true - - - -
- -
-
- - - reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) - - - "Hello" != "Hello" - - - - - left == right - - - Hello == Hello - - - - - left != left.substr(0, 3) - - - Hello != Hel - - - -
-
-
- - - sr == "a standard string" - - - a standard string == "a standard string" - - - - - sr.size() == stdStr.size() - - - 17 == 17 - - - -
- -
-
-
- - - sr == "a standard string" - - - a standard string == "a standard string" - - - - - sr.size() == stdStr.size() - - - 17 == 17 - - - -
- -
-
-
- - - sr == "a standard string" - - - a standard string == "a standard string" - - - - - sr.size() == stdStr.size() - - - 17 == 17 - - - -
- -
-
-
- - - stdStr == "a stringref" - - - "a stringref" == "a stringref" - - - - - stdStr.size() == sr.size() - - - 11 == 11 - - - -
- -
-
-
- - - stdStr == "a stringref" - - - "a stringref" == "a stringref" - - - - - stdStr.size() == sr.size() - - - 11 == 11 - - - -
- -
-
- - - lhs == "some string += the stringref contents" - - - "some string += the stringref contents" -== -"some string += the stringref contents" - - - -
-
- - - together == "abrakadabra" - - - "abrakadabra" == "abrakadabra" - - - -
- -
- -
- -
-
- -
- -
- - - - ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s - - - ""abc"" == ""abc"" - - - - - ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s - - - ""abc"" == ""abc"" - - - - - - - - ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s - - - ""abc"" == ""abc"" - - - - - ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s - - - ""abc"" == ""abc"" - - - - - - - - ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s - - - ""abc"" == ""abc"" - - - - - ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s - - - ""abc"" == ""abc"" - - - - - - - - minute == seconds - - - 1 m == 60 s - - - - - hour != seconds - - - 1 h != 60 s - - - - - micro != milli - - - 1 us != 1 ms - - - - - nano != micro - - - 1 ns != 1 us - - - - - - - - half_minute != femto_second - - - 1 [30/1]s != 1 fs - - - - - pico_second != atto_second - - - 1 ps != 1 as - - - - - - - - now != later - - - {iso8601-timestamp} -!= -{iso8601-timestamp} - - - - - - - - s1 == s2 - - - "if ($b == 10) { - $a = 20; -}" -== -"if ($b == 10) { - $a = 20; -} -" - - - - - -
- - - what, ContainsSubstring( "[@zzz]" ) - - - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "[@zzz]" - - - - - what, ContainsSubstring( "file" ) - - - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "file" - - - - - what, ContainsSubstring( "2" ) - - - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "2" - - - - - what, ContainsSubstring( "10" ) - - - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "10" - - - -
-
- - - registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) - - - registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) - - - - - registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) - - - registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) - - - - - registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) - - - registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) - - - - - registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) - - - registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) - - - -
- -
- - - - testCase.tags.size() == 2 - - - 2 == 2 - - - - - testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) - - - { {?}, {?} } ( Contains: {?} and Contains: {?} ) - - - - - - - - Template_Fixture<TestType>::m_a == 1 - - - 1 == 1 - - - - - - - - Template_Fixture<TestType>::m_a == 1 - - - 1 == 1 - - - - - - - - Template_Fixture<TestType>::m_a == 1 - - - 1.0 == 1 - - - - - - - - std::is_default_constructible<TestType>::value - - - true - - - - - - - - std::is_default_constructible<TestType>::value - - - true - - - - - - - - std::is_trivially_copyable<TestType>::value - - - true - - - - - - - - std::is_trivially_copyable<TestType>::value - - - true - - - - - - - - std::is_arithmetic<TestType>::value - - - true - - - - - - - - std::is_arithmetic<TestType>::value - - - true - - - - - - - - std::is_arithmetic<TestType>::value - - - true - - - - - - - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 10 - - - 10 == 10 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 0 - - - 0 == 0 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.capacity() == 0 - - - 0 == 0 - - - -
- -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - - -
- -
- - - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 10 - - - 10 == 10 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 0 - - - 0 == 0 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.capacity() == 0 - - - 0 == 0 - - - -
- -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - - -
- -
- - - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 10 - - - 10 == 10 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 0 - - - 0 == 0 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.capacity() == 0 - - - 0 == 0 - - - -
- -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - - -
- -
- - - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 10 - - - 10 == 10 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 0 - - - 0 == 0 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.capacity() == 0 - - - 0 == 0 - - - -
- -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - - -
- -
- - - - v.size() == V - - - 6 == 6 - - - - - v.capacity() >= V - - - 6 >= 6 - - -
- - - v.size() == 2 * V - - - 12 == 12 - - - - - v.capacity() >= 2 * V - - - 12 >= 12 - - - -
- - - v.size() == V - - - 6 == 6 - - - - - v.capacity() >= V - - - 6 >= 6 - - -
- - - v.size() == 0 - - - 0 == 0 - - - - - v.capacity() >= V - - - 6 >= 6 - - -
- - - v.capacity() == 0 - - - 0 == 0 - - - -
- -
- - - v.size() == V - - - 6 == 6 - - - - - v.capacity() >= V - - - 6 >= 6 - - -
- - - v.size() == V - - - 6 == 6 - - - - - v.capacity() >= 2 * V - - - 12 >= 12 - - - -
- - - v.size() == V - - - 6 == 6 - - - - - v.capacity() >= V - - - 6 >= 6 - - -
- - - v.size() == V - - - 6 == 6 - - - - - v.capacity() >= V - - - 6 >= 6 - - - -
- -
- - - - v.size() == V - - - 4 == 4 - - - - - v.capacity() >= V - - - 4 >= 4 - - -
- - - v.size() == 2 * V - - - 8 == 8 - - - - - v.capacity() >= 2 * V - - - 8 >= 8 - - - -
- - - v.size() == V - - - 4 == 4 - - - - - v.capacity() >= V - - - 4 >= 4 - - -
- - - v.size() == 0 - - - 0 == 0 - - - - - v.capacity() >= V - - - 4 >= 4 - - -
- - - v.capacity() == 0 - - - 0 == 0 - - - -
- -
- - - v.size() == V - - - 4 == 4 - - - - - v.capacity() >= V - - - 4 >= 4 - - -
- - - v.size() == V - - - 4 == 4 - - - - - v.capacity() >= 2 * V - - - 8 >= 8 - - - -
- - - v.size() == V - - - 4 == 4 - - - - - v.capacity() >= V - - - 4 >= 4 - - -
- - - v.size() == V - - - 4 == 4 - - - - - v.capacity() >= V - - - 4 >= 4 - - - -
- -
- - - - v.size() == V - - - 5 == 5 - - - - - v.capacity() >= V - - - 5 >= 5 - - -
- - - v.size() == 2 * V - - - 10 == 10 - - - - - v.capacity() >= 2 * V - - - 10 >= 10 - - - -
- - - v.size() == V - - - 5 == 5 - - - - - v.capacity() >= V - - - 5 >= 5 - - -
- - - v.size() == 0 - - - 0 == 0 - - - - - v.capacity() >= V - - - 5 >= 5 - - -
- - - v.capacity() == 0 - - - 0 == 0 - - - -
- -
- - - v.size() == V - - - 5 == 5 - - - - - v.capacity() >= V - - - 5 >= 5 - - -
- - - v.size() == V - - - 5 == 5 - - - - - v.capacity() >= 2 * V - - - 10 >= 10 - - - -
- - - v.size() == V - - - 5 == 5 - - - - - v.capacity() >= V - - - 5 >= 5 - - -
- - - v.size() == V - - - 5 == 5 - - - - - v.capacity() >= V - - - 5 >= 5 - - - -
- -
- - - - v.size() == V - - - 15 == 15 - - - - - v.capacity() >= V - - - 15 >= 15 - - -
- - - v.size() == 2 * V - - - 30 == 30 - - - - - v.capacity() >= 2 * V - - - 30 >= 30 - - - -
- - - v.size() == V - - - 15 == 15 - - - - - v.capacity() >= V - - - 15 >= 15 - - -
- - - v.size() == 0 - - - 0 == 0 - - - - - v.capacity() >= V - - - 15 >= 15 - - -
- - - v.capacity() == 0 - - - 0 == 0 - - - -
- -
- - - v.size() == V - - - 15 == 15 - - - - - v.capacity() >= V - - - 15 >= 15 - - -
- - - v.size() == V - - - 15 == 15 - - - - - v.capacity() >= 2 * V - - - 30 >= 30 - - - -
- - - v.size() == V - - - 15 == 15 - - - - - v.capacity() >= V - - - 15 >= 15 - - -
- - - v.size() == V - - - 15 == 15 - - - - - v.capacity() >= V - - - 15 >= 15 - - - -
- -
- - - - testCase.tags.size() == 1 - - - 1 == 1 - - - - - testCase.tags[0] == Tag( "tag1" ) - - - {?} == {?} - - - - - - - - - - - 0x == bit30and31 - - - 3221225472 (0x) == 3221225472 - - - - - - - - - - - true - - - true - - - - - false - - - false - - - - - true - - - true - - - - - false - - - false - - - - - - - - true - - - true - - - - - - - - - false - - - false - - - - - - - - - true - - - true - - - - - {Unknown expression after the reported line} - - - {Unknown expression after the reported line} - - - Uncaught exception should fail! - - - - - - - - false - - - false - - - - - {Unknown expression after the reported line} - - - {Unknown expression after the reported line} - - - Uncaught exception should fail! - - - - - - - - 1 == 2 - - - 1 == 2 - - - - - -
- - - listingString, ContainsSubstring("[fakeTag]"s) - - - "All available tags: - 1 [fakeTag] -1 tag - -" contains: "[fakeTag]" - - - -
-
- - - listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) - - - "Available reporters: - fake reporter: fake description - -" ( contains: "fake reporter" and contains: "fake description" ) - - - -
-
- - - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) - - - "All available test cases: - fake test name - [fakeTestTag] -1 test case - -" ( contains: "fake test name" and contains: "fakeTestTag" ) - - - -
-
- - - listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) - - - "Registered listeners: - fakeListener: fake description - -" ( contains: "fakeListener" and contains: "fake description" ) - - - -
- -
- - - - - - For some reason someone is throwing a string literal! - - - - - - - testCase.isOpen() - - - true - - - - - s1.isOpen() - - - true - - -
- - - s1.isSuccessfullyCompleted() - - - true - - - - - testCase.isComplete() == false - - - false == false - - - - - ctx.completedCycle() - - - true - - - - - testCase.isSuccessfullyCompleted() - - - true - - - -
- - - testCase.isOpen() - - - true - - - - - s1.isOpen() - - - true - - -
- - - s1.isComplete() - - - true - - - - - s1.isSuccessfullyCompleted() == false - - - false == false - - - - - testCase.isComplete() == false - - - false == false - - - - - ctx.completedCycle() - - - true - - - - - testCase.isSuccessfullyCompleted() == false - - - false == false - - -
- - - testCase2.isOpen() - - - true - - - - - s1b.isOpen() == false - - - false == false - - - - - ctx.completedCycle() - - - true - - - - - testCase.isComplete() - - - true - - - - - testCase.isSuccessfullyCompleted() - - - true - - - -
- -
- - - testCase.isOpen() - - - true - - - - - s1.isOpen() - - - true - - -
- - - s1.isComplete() - - - true - - - - - s1.isSuccessfullyCompleted() == false - - - false == false - - - - - testCase.isComplete() == false - - - false == false - - - - - ctx.completedCycle() - - - true - - - - - testCase.isSuccessfullyCompleted() == false - - - false == false - - -
- - - testCase2.isOpen() - - - true - - - - - s1b.isOpen() == false - - - false == false - - - - - s2.isOpen() - - - true - - - - - ctx.completedCycle() - - - true - - - - - testCase.isComplete() - - - true - - - - - testCase.isSuccessfullyCompleted() - - - true - - - -
- -
- - - testCase.isOpen() - - - true - - - - - s1.isOpen() - - - true - - -
- - - s2.isOpen() == false - - - false == false - - - - - testCase.isComplete() == false - - - false == false - - -
- - - testCase2.isOpen() - - - true - - - - - s1b.isOpen() == false - - - false == false - - - - - s2b.isOpen() - - - true - - - - - ctx.completedCycle() == false - - - false == false - - -
- - - ctx.completedCycle() - - - true - - - - - s2b.isSuccessfullyCompleted() - - - true - - - - - testCase2.isComplete() == false - - - false == false - - - - - testCase2.isSuccessfullyCompleted() - - - true - - - -
- -
- -
- - - testCase.isOpen() - - - true - - - - - s1.isOpen() - - - true - - -
- - - s2.isOpen() == false - - - false == false - - - - - testCase.isComplete() == false - - - false == false - - -
- - - testCase2.isOpen() - - - true - - - - - s1b.isOpen() == false - - - false == false - - - - - s2b.isOpen() - - - true - - - - - ctx.completedCycle() == false - - - false == false - - -
- - - ctx.completedCycle() - - - true - - - - - s2b.isComplete() - - - true - - - - - s2b.isSuccessfullyCompleted() == false - - - false == false - - - - - testCase2.isSuccessfullyCompleted() == false - - - false == false - - - - - testCase3.isOpen() - - - true - - - - - s1c.isOpen() == false - - - false == false - - - - - s2c.isOpen() == false - - - false == false - - - - - testCase3.isSuccessfullyCompleted() - - - true - - - -
- -
- -
- - - testCase.isOpen() - - - true - - - - - s1.isOpen() - - - true - - -
- - - s2.isOpen() - - - true - - - - - s2.isComplete() - - - true - - - - - s1.isComplete() == false - - - false == false - - - - - s1.isComplete() - - - true - - - - - testCase.isComplete() == false - - - false == false - - - - - testCase.isComplete() - - - true - - - -
- -
- - - - trim(std::string(no_whitespace)) == no_whitespace - - - "There is no extra whitespace here" -== -"There is no extra whitespace here" - - - - - trim(std::string(leading_whitespace)) == no_whitespace - - - "There is no extra whitespace here" -== -"There is no extra whitespace here" - - - - - trim(std::string(trailing_whitespace)) == no_whitespace - - - "There is no extra whitespace here" -== -"There is no extra whitespace here" - - - - - trim(std::string(whitespace_at_both_ends)) == no_whitespace - - - "There is no extra whitespace here" -== -"There is no extra whitespace here" - - - - - trim(StringRef(no_whitespace)) == StringRef(no_whitespace) - - - There is no extra whitespace here -== -There is no extra whitespace here - - - - - trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) - - - There is no extra whitespace here -== -There is no extra whitespace here - - - - - trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) - - - There is no extra whitespace here -== -There is no extra whitespace here - - - - - trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) - - - There is no extra whitespace here -== -There is no extra whitespace here - - - - - -
-
- - - array_int_a, RangeEquals( c_array ) - - - { 1, 2, 3 } elements are { 1, 2, 3 } - - - - - array_int_a, UnorderedRangeEquals( c_array ) - - - { 1, 2, 3 } unordered elements are { 1, 2, 3 } - - - -
- -
-
-
- - - array_int_3, !RangeEquals( array_int_4 ) - - - { 1, 2, 3 } not elements are { 1, 2, 3, 4 } - - - - - array_int_3, !UnorderedRangeEquals( array_int_4 ) - - - { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } - - - -
- -
-
-
- - - array_int_a, RangeEquals( vector_char_a ) - - - { 1, 2, 3 } elements are { 1, 2, 3 } - - - - - array_int_a, UnorderedRangeEquals( vector_char_a ) - - - { 1, 2, 3 } unordered elements are { 1, 2, 3 } - - - -
- -
-
-
- - - array_int_a, RangeEquals( list_char_a ) - - - { 1, 2, 3 } elements are { 1, 2, 3 } - - - - - array_int_a, UnorderedRangeEquals( list_char_a ) - - - { 1, 2, 3 } unordered elements are { 1, 2, 3 } - - - -
- -
-
-
- - - vector_int_a, RangeEquals( vector_char_a ) - - - { 1, 2, 3 } elements are { 1, 2, 3 } - - - - - vector_int_a, UnorderedRangeEquals( vector_char_a ) - - - { 1, 2, 3 } unordered elements are { 1, 2, 3 } - - - -
- -
-
-
- - - vector_int_a, !RangeEquals( vector_char_b ) - - - { 1, 2, 3 } not elements are { 1, 2, 2 } - - - - - vector_int_a, !UnorderedRangeEquals( vector_char_b ) - - - { 1, 2, 3 } not unordered elements are { 1, 2, 2 } - - - -
- -
-
- - - a, !RangeEquals( b ) - - - { 1, 2, 3 } not elements are { 3, 2, 1 } - - - - - a, UnorderedRangeEquals( b ) - - - { 1, 2, 3 } unordered elements are { 3, 2, 1 } - - - -
-
-
- - - vector_a, RangeEquals( array_a_plus_1, close_enough ) - - - { 1, 2, 3 } elements are { 2, 3, 4 } - - - - - vector_a, UnorderedRangeEquals( array_a_plus_1, close_enough ) - - - { 1, 2, 3 } unordered elements are { 2, 3, 4 } - - - -
- -
- -
- - - 3.14000000000000012 - - - - -
- - - bptr->i == 3 - - - 3 == 3 - - - -
-
- - - bptr->i == 3 - - - 3 == 3 - - - -
- -
- -
- - - data, AllMatch(SizeIs(5)) - - - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } all match has size == 5 - - - - - data, !AllMatch(Contains(0) && Contains(1)) - - - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains element 1 ) - - - -
-
- - - needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) - - - { 1, 2, 3, 4, 5 } all match matches undescribed predicate - - - -
-
-
- - - mocked, allMatch - - - { 1, 2, 3, 4, 5 } all match matches undescribed predicate - - - - - mocked.m_derefed[0] - - - true - - - - - mocked.m_derefed[1] - - - true - - - - - mocked.m_derefed[2] - - - true - - - - - mocked.m_derefed[3] - - - true - - - - - mocked.m_derefed[4] - - - true - - - -
- -
-
-
- - - mocked, !allMatch - - - { 1, 2, 3, 4, 5 } not all match matches undescribed predicate - - - - - mocked.m_derefed[0] - - - true - - - - - mocked.m_derefed[1] - - - true - - - - - mocked.m_derefed[2] - - - true - - - - - !(mocked.m_derefed[3]) - - - !false - - - - - !(mocked.m_derefed[4]) - - - !false - - - -
- -
- -
- -
-
- - - data, AllTrue() - - - { true, true, true, true, true } contains only true - - - -
- -
-
-
- - - data, AllTrue() - - - { } contains only true - - - -
- -
-
-
- - - data, !AllTrue() - - - { true, true, false, true, true } not contains only true - - - -
- -
-
-
- - - data, !AllTrue() - - - { false, false, false, false, false } not contains only true - - - -
- -
-
-
- - - data, AllTrue() - - - { true, true, true, true, true } contains only true - - - -
- -
-
-
- - - data, !AllTrue() - - - { true, true, false, true, true } not contains only true - - - -
- -
-
-
- - - data, !AllTrue() - - - { false, false, false, false, false } not contains only true - - - -
- -
-
-
- - - mocked, AllTrue() - - - { true, true, true, true, true } contains only true - - - - - mocked.m_derefed[0] - - - true - - - - - mocked.m_derefed[1] - - - true - - - - - mocked.m_derefed[2] - - - true - - - - - mocked.m_derefed[3] - - - true - - - - - mocked.m_derefed[4] - - - true - - - -
- -
-
-
- - - mocked, !AllTrue() - - - { true, true, false, true, true } not contains only true - - - - - mocked.m_derefed[0] - - - true - - - - - mocked.m_derefed[1] - - - true - - - - - mocked.m_derefed[2] - - - true - - - - - !(mocked.m_derefed[3]) - - - !false - - - - - !(mocked.m_derefed[4]) - - - !false - - - -
- -
- -
- -
- - - data, AnyMatch(SizeIs(5)) - - - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } any match has size == 5 - - - - - data, !AnyMatch(Contains(0) && Contains(10)) - - - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains element 10 ) - - - -
-
- - - needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) - - - { 1, 2, 3, 4, 5 } any match matches undescribed predicate - - - -
-
-
- - - mocked, !anyMatch - - - { 1, 2, 3, 4, 5 } not any match matches undescribed predicate - - - - - mocked.m_derefed[0] - - - true - - - - - mocked.m_derefed[1] - - - true - - - - - mocked.m_derefed[2] - - - true - - - - - mocked.m_derefed[3] - - - true - - - - - mocked.m_derefed[4] - - - true - - - -
- -
-
-
- - - mocked, anyMatch - - - { 1, 2, 3, 4, 5 } any match matches undescribed predicate - - - - - mocked.m_derefed[0] - - - true - - - - - !(mocked.m_derefed[1]) - - - !false - - - - - !(mocked.m_derefed[2]) - - - !false - - - - - !(mocked.m_derefed[3]) - - - !false - - - - - !(mocked.m_derefed[4]) - - - !false - - - -
- -
- -
- -
-
- - - data, AnyTrue() - - - { true, true, true, true, true } contains at least one true - - - -
- -
-
-
- - - data, !AnyTrue() - - - { } not contains at least one true - - - -
- -
-
-
- - - data, AnyTrue() - - - { false, false, true, false, false } contains at least one true - - - -
- -
-
-
- - - data, !AnyTrue() - - - { false, false, false, false, false } not contains at least one true - - - -
- -
-
-
- - - data, AnyTrue() - - - { true, true, true, true, true } contains at least one true - - - -
- -
-
-
- - - data, AnyTrue() - - - { false, false, true, false, false } contains at least one true - - - -
- -
-
-
- - - data, !AnyTrue() - - - { false, false, false, false, false } not contains at least one true - - - -
- -
-
-
- - - mocked, AnyTrue() - - - { false, false, false, false, true } contains at least one true - - - - - mocked.m_derefed[0] - - - true - - - - - mocked.m_derefed[1] - - - true - - - - - mocked.m_derefed[2] - - - true - - - - - mocked.m_derefed[3] - - - true - - - - - mocked.m_derefed[4] - - - true - - - -
- -
-
-
- - - mocked, AnyTrue() - - - { false, false, true, true, true } contains at least one true - - - - - mocked.m_derefed[0] - - - true - - - - - mocked.m_derefed[1] - - - true - - - - - mocked.m_derefed[2] - - - true - - - - - !(mocked.m_derefed[3]) - - - !false - - - - - !(mocked.m_derefed[4]) - - - !false - - - -
- -
- -
- -
- - - data, NoneMatch(SizeIs(6)) - - - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } none match has size == 6 - - - - - data, !NoneMatch(Contains(0) && Contains(1)) - - - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains element 1 ) - - - -
-
- - - needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) - - - { 1, 2, 3, 4, 5 } none match matches undescribed predicate - - - -
-
-
- - - mocked, noneMatch - - - { 1, 2, 3, 4, 5 } none match matches undescribed predicate - - - - - mocked.m_derefed[0] - - - true - - - - - mocked.m_derefed[1] - - - true - - - - - mocked.m_derefed[2] - - - true - - - - - mocked.m_derefed[3] - - - true - - - - - mocked.m_derefed[4] - - - true - - - -
- -
-
-
- - - mocked, !noneMatch - - - { 1, 2, 3, 4, 5 } not none match matches undescribed predicate - - - - - mocked.m_derefed[0] - - - true - - - - - !(mocked.m_derefed[1]) - - - !false - - - - - !(mocked.m_derefed[2]) - - - !false - - - - - !(mocked.m_derefed[3]) - - - !false - - - - - !(mocked.m_derefed[4]) - - - !false - - - -
- -
- -
- -
-
- - - data, !NoneTrue() - - - { true, true, true, true, true } not contains no true - - - -
- -
-
-
- - - data, NoneTrue() - - - { } contains no true - - - -
- -
-
-
- - - data, !NoneTrue() - - - { false, false, true, false, false } not contains no true - - - -
- -
-
-
- - - data, NoneTrue() - - - { false, false, false, false, false } contains no true - - - -
- -
-
-
- - - data, !NoneTrue() - - - { true, true, true, true, true } not contains no true - - - -
- -
-
-
- - - data, !NoneTrue() - - - { false, false, true, false, false } not contains no true - - - -
- -
-
-
- - - data, NoneTrue() - - - { false, false, false, false, false } contains no true - - - -
- -
-
-
- - - mocked, NoneTrue() - - - { false, false, false, false, false } contains no true - - - - - mocked.m_derefed[0] - - - true - - - - - mocked.m_derefed[1] - - - true - - - - - mocked.m_derefed[2] - - - true - - - - - mocked.m_derefed[3] - - - true - - - - - mocked.m_derefed[4] - - - true - - - -
- -
-
-
- - - mocked, !NoneTrue() - - - { false, false, true, true, true } not contains no true - - - - - mocked.m_derefed[0] - - - true - - - - - mocked.m_derefed[1] - - - true - - - - - mocked.m_derefed[2] - - - true - - - - - !(mocked.m_derefed[3]) - - - !false - - - - - !(mocked.m_derefed[4]) - - - !false - - - -
- -
- -
- -
-
- - - empty_vector, RangeEquals( empty_vector ) - - - { } elements are { } - - - -
- -
-
-
- - - empty_vector, !RangeEquals( non_empty_vector ) - - - { } not elements are { 1 } - - - - - non_empty_vector, !RangeEquals( empty_vector ) - - - { 1 } not elements are { } - - - -
- -
-
-
- - - non_empty_array, RangeEquals( non_empty_array ) - - - { 1 } elements are { 1 } - - - -
- -
-
-
- - - array_a, RangeEquals( array_a ) - - - { 1, 2, 3 } elements are { 1, 2, 3 } - - - -
- -
-
-
- - - array_a, !RangeEquals( array_b ) - - - { 1, 2, 3 } not elements are { 2, 2, 3 } - - - - - array_a, !RangeEquals( array_c ) - - - { 1, 2, 3 } not elements are { 1, 2, 2 } - - - -
- -
-
-
- - - vector_a, !RangeEquals( vector_b ) - - - { 1, 2, 3 } not elements are { 1, 2, 3, 4 } - - - -
- -
-
-
- - - vector_a, RangeEquals( vector_a_plus_1, close_enough ) - - - { 1, 2, 3 } elements are { 2, 3, 4 } - - - -
- -
-
-
- - - vector_a, !RangeEquals( vector_b, close_enough ) - - - { 1, 2, 3 } not elements are { 3, 3, 4 } - - - -
- -
-
- - - needs_adl1, RangeEquals( needs_adl2 ) - - - { 1, 2, 3, 4, 5 } elements are { 1, 2, 3, 4, 5 } - - - - - needs_adl1, RangeEquals( needs_adl3, []( int l, int r ) { return l + 1 == r; } ) - - - { 1, 2, 3, 4, 5 } elements are { 2, 3, 4, 5, 6 } - - - -
-
-
- - - mocked1, !RangeEquals( arr ) - - - { 1, 2, 3, 4 } not elements are { 1, 2, 4, 4 } - - - - - mocked1.m_derefed[0] - - - true - - - - - mocked1.m_derefed[1] - - - true - - - - - mocked1.m_derefed[2] - - - true - - - - - !(mocked1.m_derefed[3]) - - - !false - - - -
- -
-
-
- - - mocked1, RangeEquals( arr ) - - - { 1, 2, 3, 4 } elements are { 1, 2, 3, 4 } - - - - - mocked1.m_derefed[0] - - - true - - - - - mocked1.m_derefed[1] - - - true - - - - - mocked1.m_derefed[2] - - - true - - - - - mocked1.m_derefed[3] - - - true - - - -
- -
- -
- -
-
- - - empty_vector, UnorderedRangeEquals( empty_vector ) - - - { } unordered elements are { } - - - -
- -
-
-
- - - empty_vector, !UnorderedRangeEquals( non_empty_vector ) - - - { } not unordered elements are { 1 } - - - - - non_empty_vector, !UnorderedRangeEquals( empty_vector ) - - - { 1 } not unordered elements are { } - - - -
- -
-
-
- - - non_empty_array, UnorderedRangeEquals( non_empty_array ) - - - { 1 } unordered elements are { 1 } - - - -
- -
-
-
- - - array_a, UnorderedRangeEquals( array_a ) - - - { 1, 2, 3 } unordered elements are { 1, 2, 3 } - - - -
- -
-
-
- - - array_a, !UnorderedRangeEquals( array_b ) - - - { 1, 2, 3 } not unordered elements are { 2, 2, 3 } - - - -
- -
-
-
- - - vector_a, !UnorderedRangeEquals( vector_b ) - - - { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } - - - -
- -
-
-
- - - vector_a, UnorderedRangeEquals( vector_a_plus_1, close_enough ) - - - { 1, 10, 20 } unordered elements are { 11, 21, 2 } - - - -
- -
-
-
- - - vector_a, !UnorderedRangeEquals( vector_b, close_enough ) - - - { 1, 10, 21 } not unordered elements are { 11, 21, 3 } - - - -
- -
-
- - - needs_adl1, UnorderedRangeEquals( needs_adl2 ) - - - { 1, 2, 3, 4, 5 } unordered elements are { 1, 2, 3, 4, 5 } - - - -
- -
- -
- - - empty_vec, SizeIs(0) - - - { } has size == 0 - - - - - empty_vec, !SizeIs(2) - - - { } not has size == 2 - - - - - empty_vec, SizeIs(Lt(2)) - - - { } size matches is less than 2 - - - - - arr, SizeIs(2) - - - { 0, 0 } has size == 2 - - - - - arr, SizeIs( Lt(3)) - - - { 0, 0 } size matches is less than 3 - - - - - arr, !SizeIs(!Lt(3)) - - - { 0, 0 } not size matches not is less than 3 - - - - - map, SizeIs(3) - - - { {?}, {?}, {?} } has size == 3 - - - -
-
- - - unrelated::ADL_size{}, SizeIs(12) - - - {?} has size == 12 - - - -
-
- - - has_size{}, SizeIs(13) - - - {?} has size == 13 - - - -
- -
- - - - d == approx( 1.23 ) - - - 1.22999999999999998 -== -Approx( 1.22999999999999998 ) - - - - - d == approx( 1.22 ) - - - 1.22999999999999998 -== -Approx( 1.21999999999999997 ) - - - - - d == approx( 1.24 ) - - - 1.22999999999999998 -== -Approx( 1.23999999999999999 ) - - - - - d != approx( 1.25 ) - - - 1.22999999999999998 != Approx( 1.25 ) - - - - - approx( d ) == 1.23 - - - Approx( 1.22999999999999998 ) -== -1.22999999999999998 - - - - - approx( d ) == 1.22 - - - Approx( 1.22999999999999998 ) -== -1.21999999999999997 - - - - - approx( d ) == 1.24 - - - Approx( 1.22999999999999998 ) -== -1.23999999999999999 - - - - - approx( d ) != 1.25 - - - Approx( 1.22999999999999998 ) != 1.25 - - - - - -
- -
- -
- -
- - - empty, Approx( empty ) - - - { } is approx: { } - - - -
-
-
- - - v1, Approx( v1 ) - - - { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } - - - - - v1, Approx<double>( { 1., 2., 3. } ) - - - { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } - - - -
- -
-
-
- - - v1, !Approx( temp ) - - - { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } - - - -
- -
-
-
- - - v1, !Approx( v2 ) - - - { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } - - - - - v1, Approx( v2 ).margin( 0.5 ) - - - { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } - - - - - v1, Approx( v2 ).epsilon( 0.5 ) - - - { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } - - - - - v1, Approx( v2 ).epsilon( 0.1 ).scale( 500 ) - - - { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } - - - -
- -
- -
- -
- - - empty, Approx( t1 ) - - - { } is approx: { 1.0, 2.0 } - - - -
-
- - - v1, Approx( v2 ) - - - { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } - - - -
- -
- -
- - - v, VectorContains( 1 ) - - - { 1, 2, 3 } Contains: 1 - - - - - v, VectorContains( 2 ) - - - { 1, 2, 3 } Contains: 2 - - - - - v5, ( VectorContains<int, CustomAllocator<int>>( 2 ) ) - - - { 1, 2, 3 } Contains: 2 - - - -
-
- - - v, Contains( v2 ) - - - { 1, 2, 3 } Contains: { 1, 2 } - - - - - v, Contains<int>( { 1, 2 } ) - - - { 1, 2, 3 } Contains: { 1, 2 } - - - - - v5, ( Contains<int, std::allocator<int>, CustomAllocator<int>>( v2 ) ) - - - { 1, 2, 3 } Contains: { 1, 2 } - - - - - v, Contains( v2 ) - - - { 1, 2, 3 } Contains: { 1, 2, 3 } - - - - - v, Contains( empty ) - - - { 1, 2, 3 } Contains: { } - - - - - empty, Contains( empty ) - - - { } Contains: { } - - - - - v5, ( Contains<int, std::allocator<int>, CustomAllocator<int>>( v2 ) ) - - - { 1, 2, 3 } Contains: { 1, 2, 3 } - - - - - v5, Contains( v6 ) - - - { 1, 2, 3 } Contains: { 1, 2 } - - - -
-
- - - v, VectorContains( 1 ) && VectorContains( 2 ) - - - { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) - - - -
-
- - - v, Equals( v ) - - - { 1, 2, 3 } Equals: { 1, 2, 3 } - - - - - empty, Equals( empty ) - - - { } Equals: { } - - - - - v, Equals<int>( { 1, 2, 3 } ) - - - { 1, 2, 3 } Equals: { 1, 2, 3 } - - - - - v, Equals( v2 ) - - - { 1, 2, 3 } Equals: { 1, 2, 3 } - - - - - v5, ( Equals<int, std::allocator<int>, CustomAllocator<int>>( v2 ) ) - - - { 1, 2, 3 } Equals: { 1, 2, 3 } - - - - - v5, Equals( v6 ) - - - { 1, 2, 3 } Equals: { 1, 2, 3 } - - - -
-
- - - v, UnorderedEquals( v ) - - - { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 } - - - - - v, UnorderedEquals<int>( { 3, 2, 1 } ) - - - { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } - - - - - empty, UnorderedEquals( empty ) - - - { } UnorderedEquals: { } - - - - - permuted, UnorderedEquals( v ) - - - { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } - - - - - permuted, UnorderedEquals( v ) - - - { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 } - - - - - v5, ( UnorderedEquals<int, std::allocator<int>, CustomAllocator<int>>( permuted ) ) - - - { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } - - - - - v5_permuted, UnorderedEquals( v5 ) - - - { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } - - - -
- -
- -
- - - v, VectorContains( -1 ) - - - { 1, 2, 3 } Contains: -1 - - - - - empty, VectorContains( 1 ) - - - { } Contains: 1 - - - -
-
- - - empty, Contains( v ) - - - { } Contains: { 1, 2, 3 } - - - - - v, Contains( v2 ) - - - { 1, 2, 3 } Contains: { 1, 2, 4 } - - - -
-
- - - v, Equals( v2 ) - - - { 1, 2, 3 } Equals: { 1, 2 } - - - - - v2, Equals( v ) - - - { 1, 2 } Equals: { 1, 2, 3 } - - - - - empty, Equals( v ) - - - { } Equals: { 1, 2, 3 } - - - - - v, Equals( empty ) - - - { 1, 2, 3 } Equals: { } - - - -
-
- - - v, UnorderedEquals( empty ) - - - { 1, 2, 3 } UnorderedEquals: { } - - - - - empty, UnorderedEquals( v ) - - - { } UnorderedEquals: { 1, 2, 3 } - - - - - permuted, UnorderedEquals( v ) - - - { 1, 3 } UnorderedEquals: { 1, 2, 3 } - - - - - permuted, UnorderedEquals( v ) - - - { 3, 1 } UnorderedEquals: { 1, 2, 3 } - - - -
- -
- - - - thisThrows(), std::domain_error - - - thisThrows(), std::domain_error - - - - - thisDoesntThrow() - - - thisDoesntThrow() - - - - - thisThrows() - - - thisThrows() - - - - - - - unexpected exception - - - - - - - thisThrows() == 0 - - - thisThrows() == 0 - - - expected exception - - - - - - - - thisThrows() == 0 - - - thisThrows() == 0 - - - expected exception - - - - - - - - thisThrows() == 0 - - - thisThrows() == 0 - - - expected exception - - - - - -
- - unexpected exception - - -
- -
- - - - - - - - - - - - - - - - -
- - - encode( "normal string" ) == "normal string" - - - "normal string" == "normal string" - - - -
-
- - - encode( "" ) == "" - - - "" == "" - - - -
-
- - - encode( "smith & jones" ) == "smith &amp; jones" - - - "smith &amp; jones" == "smith &amp; jones" - - - -
-
- - - encode( "smith < jones" ) == "smith &lt; jones" - - - "smith &lt; jones" == "smith &lt; jones" - - - -
-
- - - encode( "smith > jones" ) == "smith > jones" - - - "smith > jones" == "smith > jones" - - - - - encode( "smith ]]> jones" ) == "smith ]]&gt; jones" - - - "smith ]]&gt; jones" -== -"smith ]]&gt; jones" - - - -
-
- - - encode( stringWithQuotes ) == stringWithQuotes - - - "don't "quote" me on that" -== -"don't "quote" me on that" - - - - - encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't &quot;quote&quot; me on that" - - - "don't &quot;quote&quot; me on that" -== -"don't &quot;quote&quot; me on that" - - - -
-
- - - encode( "[\x01]" ) == "[\\x01]" - - - "[\x01]" == "[\x01]" - - - -
-
- - - encode( "[\x7F]" ) == "[\\x7F]" - - - "[\x7F]" == "[\x7F]" - - - -
- -
- - - - stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") - - - "<?xml version="1.0" encoding="UTF-8"?> -<Element1 attr1="true" attr2="false"/> -" ( contains: "attr1="true"" and contains: "attr2="false"" ) - - - - - - - - - - - - analysis.mean.point.count() == 23 - - - 23.0 == 23 - - - - - analysis.mean.lower_bound.count() == 23 - - - 23.0 == 23 - - - - - analysis.mean.upper_bound.count() == 23 - - - 23.0 == 23 - - - - - analysis.standard_deviation.point.count() == 0 - - - 0.0 == 0 - - - - - analysis.standard_deviation.lower_bound.count() == 0 - - - 0.0 == 0 - - - - - analysis.standard_deviation.upper_bound.count() == 0 - - - 0.0 == 0 - - - - - analysis.outliers.total() == 0 - - - 0 == 0 - - - - - analysis.outliers.low_mild == 0 - - - 0 == 0 - - - - - analysis.outliers.low_severe == 0 - - - 0 == 0 - - - - - analysis.outliers.high_mild == 0 - - - 0 == 0 - - - - - analysis.outliers.high_severe == 0 - - - 0 == 0 - - - - - analysis.outliers.samples_seen == 0 - - - 0 == 0 - - - - - analysis.outlier_variance == 0 - - - 0.0 == 0 - - - - - - - - Catch::Detail::stringify( empty ) == "{ }" - - - "{ }" == "{ }" - - - - - Catch::Detail::stringify( oneValue ) == "{ 42 }" - - - "{ 42 }" == "{ 42 }" - - - - - Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" - - - "{ 42, 250 }" == "{ 42, 250 }" - - - - - -
- - - model.started == 1 - - - 1 == 1 - - - - - model.finished == 0 - - - 0 == 0 - - - - - model.started == 1 - - - 1 == 1 - - - - - model.finished == 1 - - - 1 == 1 - - - - - called == 1 - - - 1 == 1 - - - -
-
- - - model.started == 0 - - - 0 == 0 - - - - - model.finished == 0 - - - 0 == 0 - - - - - model.started == 0 - - - 0 == 0 - - - - - model.finished == 0 - - - 0 == 0 - - - - - called == 1 - - - 1 == 1 - - - -
- -
- - - - obj.prop != 0 - - - 0x != 0 - - - - - - - - flag - - - true - - - - - testCheckedElse( true ) - - - true - - - - - - - - flag - - - false - - - - - testCheckedElse( false ) - - - false - - - - - - - - flag - - - true - - - - - testCheckedIf( true ) - - - true - - - - - - - - flag - - - false - - - - - testCheckedIf( false ) - - - false - - - - - -
- - - o.samples_seen == static_cast<int>(x.size()) - - - 6 == 6 - - - - - o.low_severe == los - - - 0 == 0 - - - - - o.low_mild == lom - - - 0 == 0 - - - - - o.high_mild == him - - - 0 == 0 - - - - - o.high_severe == his - - - 0 == 0 - - - - - o.total() == los + lom + him + his - - - 0 == 0 - - - -
-
- - - o.samples_seen == static_cast<int>(x.size()) - - - 6 == 6 - - - - - o.low_severe == los - - - 1 == 1 - - - - - o.low_mild == lom - - - 0 == 0 - - - - - o.high_mild == him - - - 0 == 0 - - - - - o.high_severe == his - - - 0 == 0 - - - - - o.total() == los + lom + him + his - - - 1 == 1 - - - -
-
- - - o.samples_seen == static_cast<int>(x.size()) - - - 6 == 6 - - - - - o.low_severe == los - - - 0 == 0 - - - - - o.low_mild == lom - - - 1 == 1 - - - - - o.high_mild == him - - - 0 == 0 - - - - - o.high_severe == his - - - 0 == 0 - - - - - o.total() == los + lom + him + his - - - 1 == 1 - - - -
-
- - - o.samples_seen == static_cast<int>(x.size()) - - - 6 == 6 - - - - - o.low_severe == los - - - 0 == 0 - - - - - o.low_mild == lom - - - 0 == 0 - - - - - o.high_mild == him - - - 1 == 1 - - - - - o.high_severe == his - - - 0 == 0 - - - - - o.total() == los + lom + him + his - - - 1 == 1 - - - -
-
- - - o.samples_seen == static_cast<int>(x.size()) - - - 6 == 6 - - - - - o.low_severe == los - - - 0 == 0 - - - - - o.low_mild == lom - - - 0 == 0 - - - - - o.high_mild == him - - - 0 == 0 - - - - - o.high_severe == his - - - 1 == 1 - - - - - o.total() == los + lom + him + his - - - 1 == 1 - - - -
-
- - - o.samples_seen == static_cast<int>(x.size()) - - - 6 == 6 - - - - - o.low_severe == los - - - 1 == 1 - - - - - o.low_mild == lom - - - 0 == 0 - - - - - o.high_mild == him - - - 1 == 1 - - - - - o.high_severe == his - - - 0 == 0 - - - - - o.total() == los + lom + him + his - - - 2 == 2 - - - -
- -
- - - - unsigned_char_var == 1 - - - 1 == 1 - - - - - unsigned_short_var == 1 - - - 1 == 1 - - - - - unsigned_int_var == 1 - - - 1 == 1 - - - - - unsigned_long_var == 1 - - - 1 == 1 - - - - - - - - long_var == unsigned_char_var - - - 1 == 1 - - - - - long_var == unsigned_short_var - - - 1 == 1 - - - - - long_var == unsigned_int_var - - - 1 == 1 - - - - - long_var == unsigned_long_var - - - 1 == 1 - - - - - - - - convertToBits( 0.f ) == 0 - - - 0 == 0 - - - - - convertToBits( -0.f ) == ( 1ULL << 31 ) - - - 2147483648 (0x) -== -2147483648 (0x) - - - - - convertToBits( 0. ) == 0 - - - 0 == 0 - - - - - convertToBits( -0. ) == ( 1ULL << 63 ) - - - 9223372036854775808 (0x) -== -9223372036854775808 (0x) - - - - - convertToBits( std::numeric_limits<float>::denorm_min() ) == 1 - - - 1 == 1 - - - - - convertToBits( std::numeric_limits<double>::denorm_min() ) == 1 - - - 1 == 1 - - - - - - - skipping because answer = 41 - - - skipping because answer = 43 - - - - - - - Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) - - - Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) - - - - - - - - erfc_inv(1.103560) == Approx(-0.09203687623843015) - - - -0.09203687623843014 -== -Approx( -0.09203687623843015 ) - - - - - erfc_inv(1.067400) == Approx(-0.05980291115763361) - - - -0.05980291115763361 -== -Approx( -0.05980291115763361 ) - - - - - erfc_inv(0.050000) == Approx(1.38590382434967796) - - - 1.38590382434967774 -== -Approx( 1.38590382434967796 ) - - - - - - - - res.mean.count() == rate - - - 2000.0 == 2000 (0x) - - - - - res.outliers.total() == 0 - - - 0 == 0 - - - - - -
-
- -
- -
-
-
- -
- -
-
- -
- -
- - - - 3 == 4 - - - 3 == 4 - - - - - - - - - - - - - -
- - -
-
- - -
- -
- - - - -loose text artifact - - - - - - - - Previous info should not be seen - - - - - - previous unscoped info SHOULD not be seen - - - - - - - - - - - - - l == std::numeric_limits<long long>::max() - - - 9223372036854775807 (0x) -== -9223372036854775807 (0x) - - - - - -
- - - b > a - - - 0 > 1 - - - -
-
- - - b > a - - - 1 > 1 - - - -
-
- - - b > a - - - 2 > 1 - - - -
-
- - - b > a - - - 3 > 1 - - - -
-
- - - b > a - - - 4 > 1 - - - -
-
- - - b > a - - - 5 > 1 - - - -
-
- - - b > a - - - 6 > 1 - - - -
-
- - - b > a - - - 7 > 1 - - - -
-
- - - b > a - - - 8 > 1 - - - -
-
- - - b > a - - - 9 > 1 - - - -
- -
- - - Testing if fib[0] (1) is even - - - - ( fib[i] % 2 ) == 0 - - - 1 == 0 - - - - Testing if fib[1] (1) is even - - - - ( fib[i] % 2 ) == 0 - - - 1 == 0 - - - - Testing if fib[2] (2) is even - - - - ( fib[i] % 2 ) == 0 - - - 0 == 0 - - - - Testing if fib[3] (3) is even - - - - ( fib[i] % 2 ) == 0 - - - 1 == 0 - - - - Testing if fib[4] (5) is even - - - - ( fib[i] % 2 ) == 0 - - - 1 == 0 - - - - Testing if fib[5] (8) is even - - - - ( fib[i] % 2 ) == 0 - - - 0 == 0 - - - - Testing if fib[6] (13) is even - - - - ( fib[i] % 2 ) == 0 - - - 1 == 0 - - - - Testing if fib[7] (21) is even - - - - ( fib[i] % 2 ) == 0 - - - 1 == 0 - - - - - - - - Catch::makeStream( "%debug" ) - - - Catch::makeStream( "%debug" ) - - - - - -
- - - !(lval.has_moved) - - - !false - - - -
-
- - - rval.has_moved - - - true - - - -
-
- - - *ptr == std::tuple<int, double, int>{1, 2., 3} - - - {?} == {?} - - - -
- -
- - - - m == 19. - - - 19.0 == 19.0 - - - - - - - - x == 17 - - - 17 == 17 - - - - - x == 23 - - - 23 == 23 - - - - - r.elapsed.count() == 42 - - - 42 == 42 - - - - - r.result == 23 - - - 23 == 23 - - - - - r.iterations == 1 - - - 1 == 1 - - - - - s.elapsed.count() == 69 - - - 69 == 69 - - - - - s.result == 17 - - - 17 == 17 - - - - - s.iterations == 1 - - - 1 == 1 - - - - - - - info - - - unscoped info - - - and warn may mix - - - info - - - unscoped info - - - they are not cleared after warnings - - - - -
-
- - - a == b - - - 1 == 2 - - - -
- -
-
-
- - - a != b - - - 1 != 2 - - - -
- -
-
-
- - - a < b - - - 1 < 2 - - - -
- -
- -
- -
- - - a != b - - - 1 != 2 - - - - - b != a - - - 2 != 1 - - -
- - - a != b - - - 1 != 2 - - - -
- -
- -
- -
- -
-
-
- -
- -
-
-
- - -
- -
-
- -
- - -a! -b1! -! - - -
- - - - s == "7" - - - "7" == "7" - - - - - - - - ti == typeid(int) - - - {?} == {?} - - - - - - - - normal_quantile(0.551780) == Approx(0.13015979861484198) - - - 0.13015979861484195 -== -Approx( 0.13015979861484198 ) - - - - - normal_quantile(0.533700) == Approx(0.08457408802851875) - - - 0.08457408802851875 -== -Approx( 0.08457408802851875 ) - - - - - normal_quantile(0.025000) == Approx(-1.95996398454005449) - - - -1.95996398454005405 -== -Approx( -1.95996398454005449 ) - - - - - - - - - - this MAY be seen only for the FIRST assertion IF info is printed for passing assertions - - - - true - - - true - - - - this MAY be seen only for the SECOND assertion IF info is printed for passing assertions - - - - true - - - true - - - - this SHOULD be seen - - - - false - - - false - - - - - - - - makeString( false ) != static_cast<char*>(0) - - - "valid string" != {null string} - - - - - makeString( true ) == static_cast<char*>(0) - - - {null string} == {null string} - - - - - - - - ptr.get() == 0 - - - 0 == 0 - - - - - - - - ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" - - - "{ { 42, "Arthur" }, { "Ford", 24 } }" -== -"{ { 42, "Arthur" }, { "Ford", 24 } }" - - - - - -
- - - parseEnums( "" ), Equals( std::vector<Catch::StringRef>{} ) - - - { } Equals: { } - - - -
-
- - - parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) - - - { Value1 } Equals: { Value1 } - - - - - parseEnums( "Value1" ), Equals( std::vector<Catch::StringRef>{"Value1"} ) - - - { Value1 } Equals: { Value1 } - - - - - parseEnums( "EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) - - - { Value1 } Equals: { Value1 } - - - -
-
- - - parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2"} ) - - - { Value1, Value2 } Equals: { Value1, Value2 } - - - - - parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) - - - { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } - - - - - parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) - - - { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } - - - -
- -
- - - - p == 0 - - - 0 == 0 - - - - - - - this MAY be seen IF info is printed for passing assertions - - - - true - - - true - - - - - - - this SHOULD be seen - - - this SHOULD also be seen - - - - false - - - false - - - - - - - this SHOULD be seen only ONCE - - - - false - - - false - - - - - true - - - true - - - - this MAY also be seen only ONCE IF info is printed for passing assertions - - - - true - - - true - - - - - true - - - true - - - - - -
- - - a != b - - - 1 != 2 - - - - - b != a - - - 2 != 1 - - - -
-
- - - a != b - - - 1 != 2 - - - -
- -
- -
- - - Catch::replaceInPlace(letters, "b", "z") - - - true - - - - - letters == "azcdefcg" - - - "azcdefcg" == "azcdefcg" - - - -
-
- - - Catch::replaceInPlace(letters, "c", "z") - - - true - - - - - letters == "abzdefzg" - - - "abzdefzg" == "abzdefzg" - - - -
-
- - - Catch::replaceInPlace(letters, "a", "z") - - - true - - - - - letters == "zbcdefcg" - - - "zbcdefcg" == "zbcdefcg" - - - -
-
- - - Catch::replaceInPlace(letters, "g", "z") - - - true - - - - - letters == "abcdefcz" - - - "abcdefcz" == "abcdefcz" - - - -
-
- - - Catch::replaceInPlace(letters, letters, "replaced") - - - true - - - - - letters == "replaced" - - - "replaced" == "replaced" - - - -
-
- - - !(Catch::replaceInPlace(letters, "x", "z")) - - - !false - - - - - letters == letters - - - "abcdefcg" == "abcdefcg" - - - -
-
-
- - - Catch::replaceInPlace(letters, "c", "cc") - - - true - - - - - letters == "abccdefccg" - - - "abccdefccg" == "abccdefccg" - - - -
- -
-
-
- - - Catch::replaceInPlace(s, "--", "-") - - - true - - - - - s == "--" - - - "--" == "--" - - - -
- -
-
- - - Catch::replaceInPlace(s, "'", "|'") - - - true - - - - - s == "didn|'t" - - - "didn|'t" == "didn|'t" - - - -
- -
- - - - Catch::makeStream( "%somestream" ) - - - Catch::makeStream( "%somestream" ) - - - - - - - - res.size() == count - - - 10 == 10 - - - - - res[i] == rate - - - 1000.0 == 1000 (0x) - - - - - res[i] == rate - - - 1000.0 == 1000 (0x) - - - - - res[i] == rate - - - 1000.0 == 1000 (0x) - - - - - res[i] == rate - - - 1000.0 == 1000 (0x) - - - - - res[i] == rate - - - 1000.0 == 1000 (0x) - - - - - res[i] == rate - - - 1000.0 == 1000 (0x) - - - - - res[i] == rate - - - 1000.0 == 1000 (0x) - - - - - res[i] == rate - - - 1000.0 == 1000 (0x) - - - - - res[i] == rate - - - 1000.0 == 1000 (0x) - - - - - - - - meter.runs() >= old_runs - - - 1 >= 1 - - - - - meter.runs() >= old_runs - - - 2 >= 1 - - - - - meter.runs() >= old_runs - - - 4 >= 2 - - - - - meter.runs() >= old_runs - - - 8 >= 4 - - - - - meter.runs() >= old_runs - - - 16 >= 8 - - - - - meter.runs() >= old_runs - - - 32 >= 16 - - - - - meter.runs() >= old_runs - - - 64 >= 32 - - - - - meter.runs() >= old_runs - - - 128 >= 64 - - - - - Timing.elapsed >= time - - - 128 ns >= 100 ns - - - - - Timing.result == Timing.iterations + 17 - - - 145 == 145 - - - - - Timing.iterations >= time.count() - - - 128 >= 100 - - - - - - - - x >= old_x - - - 1 >= 1 - - - - - x >= old_x - - - 2 >= 1 - - - - - x >= old_x - - - 4 >= 2 - - - - - x >= old_x - - - 8 >= 4 - - - - - x >= old_x - - - 16 >= 8 - - - - - x >= old_x - - - 32 >= 16 - - - - - x >= old_x - - - 64 >= 32 - - - - - x >= old_x - - - 128 >= 64 - - - - - Timing.elapsed >= time - - - 128 ns >= 100 ns - - - - - Timing.result == Timing.iterations + 17 - - - 145 == 145 - - - - - Timing.iterations >= time.count() - - - 128 >= 100 - - - - - - - - -
- -
-
- - -
-
- -
- -
- - - 3 - - - - false - - - false - - - - - - - hi - - - i := 7 - - - - false - - - false - - - - - - - - testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) - - - { {?}, {?} } ( Contains: {?} and Contains: {?} ) - - - - - - - skipping because answer = 43 - - - - - - - splitStringRef("", ','), Equals(std::vector<StringRef>()) - - - { } Equals: { } - - - - - splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) - - - { abc } Equals: { abc } - - - - - splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) - - - { abc, def } Equals: { abc, def } - - - - - - - Count 1 to 3... - - - 1 - - - 2 - - - 3 - - - - false - - - false - - - - Count 4 to 6... - - - 4 - - - 5 - - - 6 - - - - false - - - false - - - - - - - - !(startsWith("", 'c')) - - - !false - - - - - startsWith(std::string("abc"), 'a') - - - true - - - - - startsWith("def"_catch_sr, 'd') - - - true - - - - - -
- - - Catch::Detail::stringify( emptyMap ) == "{ }" - - - "{ }" == "{ }" - - - -
-
- - - Catch::Detail::stringify( map ) == "{ { \"one\", 1 } }" - - - "{ { "one", 1 } }" == "{ { "one", 1 } }" - - - -
-
- - - Catch::Detail::stringify( map ) == "{ { \"abc\", 1 }, { \"def\", 2 }, { \"ghi\", 3 } }" - - - "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }" -== -"{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }" - - - -
- -
- - - - ::Catch::Detail::stringify(value) == "{ 34, \"xyzzy\" }" - - - "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" - - - - - - - - ::Catch::Detail::stringify( value ) == "{ 34, \"xyzzy\" }" - - - "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" - - - - - -
- - - Catch::Detail::stringify( emptySet ) == "{ }" - - - "{ }" == "{ }" - - - -
-
- - - Catch::Detail::stringify( set ) == "{ \"one\" }" - - - "{ "one" }" == "{ "one" }" - - - -
-
- - - Catch::Detail::stringify( set ) == "{ \"abc\", \"def\", \"ghi\" }" - - - "{ "abc", "def", "ghi" }" -== -"{ "abc", "def", "ghi" }" - - - -
- -
- - - - ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" - - - "{ { "green", 55 } }" -== -"{ { "green", 55 } }" - - - - - - - - Catch::makeStream( "%stderr" )->isConsole() - - - true - - - - - Catch::makeStream( "%stdout" )->isConsole() - - - true - - - - - - - - ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" - - - "op<<(streamable_range)" -== -"op<<(streamable_range)" - - - - - ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)" - - - "stringmaker(streamable_range)" -== -"stringmaker(streamable_range)" - - - - - ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" - - - "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }" - - - - - ::Catch::Detail::stringify(disabled_range{}) == "{?}" - - - "{?}" == "{?}" - - - - - - - - ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>" - - - "StringMaker<has_maker>" -== -"StringMaker<has_maker>" - - - - - - - - ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" - - - "StringMaker<has_maker_and_operator>" -== -"StringMaker<has_maker_and_operator>" - - - - - - - - ::Catch::Detail::stringify(item) == "{?}" - - - "{?}" == "{?}" - - - - - - - - ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" - - - "operator<<( has_operator )" -== -"operator<<( has_operator )" - - - - - - - - ::Catch::Detail::stringify( item ) == "operator<<( has_template_operator )" - - - "operator<<( has_template_operator )" -== -"operator<<( has_template_operator )" - - - - - - - - ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" - - - "{ StringMaker<has_maker> }" -== -"{ StringMaker<has_maker> }" - - - - - - - - ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_operator> }" - - - "{ StringMaker<has_maker_and_operator> }" -== -"{ StringMaker<has_maker_and_operator> }" - - - - - - - - ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" - - - "{ operator<<( has_operator ) }" -== -"{ operator<<( has_operator ) }" - - - - - - - - data.str.size() == data.len - - - 3 == 3 - - - - - data.str.size() == data.len - - - 3 == 3 - - - - - data.str.size() == data.len - - - 5 == 5 - - - - - data.str.size() == data.len - - - 4 == 4 - - - - - - - - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) - - - 5 == 5 - - - - - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) - - - 6 == 6 - - - - - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) - - - 5 == 5 - - - - - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) - - - 6 == 6 - - - - - - - - testcase.tags.size() == 1 - - - 1 == 1 - - - - - testcase.tags[0].original == "magic.tag"_catch_sr - - - magic.tag == magic.tag - - - - - - - - - - - Why would you throw a std::string? - - - - - - - result == "\"wide load\"" - - - ""wide load"" == ""wide load"" - - - - - - - - result == "\"wide load\"" - - - ""wide load"" == ""wide load"" - - - - - - - - result == "\"wide load\"" - - - ""wide load"" == ""wide load"" - - - - - - - - result == "\"wide load\"" - - - ""wide load"" == ""wide load"" - - - - - - - - ::Catch::Detail::stringify(e0) == "E2/V0" - - - "E2/V0" == "E2/V0" - - - - - ::Catch::Detail::stringify(e1) == "E2/V1" - - - "E2/V1" == "E2/V1" - - - - - ::Catch::Detail::stringify(e3) == "Unknown enum value 10" - - - "Unknown enum value 10" -== -"Unknown enum value 10" - - - - - - - - ::Catch::Detail::stringify(e0) == "0" - - - "0" == "0" - - - - - ::Catch::Detail::stringify(e1) == "1" - - - "1" == "1" - - - - - - - - ::Catch::Detail::stringify(e0) == "E2{0}" - - - "E2{0}" == "E2{0}" - - - - - ::Catch::Detail::stringify(e1) == "E2{1}" - - - "E2{1}" == "E2{1}" - - - - - - - - ::Catch::Detail::stringify(e0) == "0" - - - "0" == "0" - - - - - ::Catch::Detail::stringify(e1) == "1" - - - "1" == "1" - - - - - - - - "{ }" == ::Catch::Detail::stringify(type{}) - - - "{ }" == "{ }" - - - - - "{ }" == ::Catch::Detail::stringify(value) - - - "{ }" == "{ }" - - - - - - - - "1.5f" == ::Catch::Detail::stringify(float(1.5)) - - - "1.5f" == "1.5f" - - - - - "{ 1.5f, 0 }" == ::Catch::Detail::stringify(type{1.5f,0}) - - - "{ 1.5f, 0 }" == "{ 1.5f, 0 }" - - - - - - - - "{ 0 }" == ::Catch::Detail::stringify(type{0}) - - - "{ 0 }" == "{ 0 }" - - - - - - - - "{ \"hello\", \"world\" }" == ::Catch::Detail::stringify(type{"hello","world"}) - - - "{ "hello", "world" }" -== -"{ "hello", "world" }" - - - - - - - - "{ { 42 }, { }, 1.5f }" == ::Catch::Detail::stringify(value) - - - "{ { 42 }, { }, 1.5f }" -== -"{ { 42 }, { }, 1.5f }" - - - - - - - - e.point == 23 - - - 23.0 == 23 - - - - - e.upper_bound == 23 - - - 23.0 == 23 - - - - - e.lower_bound == 23 - - - 23.0 == 23 - - - - - e.confidence_interval == 0.95 - - - 0.94999999999999996 == 0.94999999999999996 - - - - - - - - dist.a() == -10 - - - -10 == -10 - - - - - dist.b() == 10 - - - 10 == 10 - - - - - -
- - - !(ptr) - - - !{?} - - - - - ptr.get() == 0 - - - 0 == 0 - - - -
-
- - - ptr - - - {?} - - - - - *ptr == 0 - - - 0 == 0 - - - - - ptr.get() == naked_ptr - - - 0x == 0x - - -
- - - !(ptr) - - - !{?} - - - - - ptr.get() == 0 - - - 0 == 0 - - - -
- -
-
- - - ptr - - - {?} - - - - - *ptr == 0 - - - 0 == 0 - - - - - ptr.get() == naked_ptr - - - 0x == 0x - - -
- - - ptr - - - {?} - - - - - ptr.get() != 0 - - - 0x != 0 - - - - - *ptr == 2 - - - 2 == 2 - - - -
- -
-
- - - !(ptr) - - - !{?} - - - - - ptr.get() == 0 - - - 0 == 0 - - - -
-
- - - !(ptr1) - - - !{?} - - - - - ptr2 - - - {?} - - - - - *ptr2 == 1 - - - 1 == 1 - - - -
-
- - - !(ptr2) - - - !{?} - - - - - ptr1 - - - {?} - - - - - *ptr1 == 2 - - - 2 == 2 - - - -
-
- - - *ptr1 == 2 - - - 2 == 2 - - - - - *ptr2 == 1 - - - 1 == 1 - - - -
- -
- - - - ::Catch::Detail::stringify(v) == "{ }" - - - "{ }" == "{ }" - - - - - ::Catch::Detail::stringify(v) == "{ { \"hello\" }, { \"world\" } }" - - - "{ { "hello" }, { "world" } }" -== -"{ { "hello" }, { "world" } }" - - - - - - - - ::Catch::Detail::stringify(bools) == "{ }" - - - "{ }" == "{ }" - - - - - ::Catch::Detail::stringify(bools) == "{ true }" - - - "{ true }" == "{ true }" - - - - - ::Catch::Detail::stringify(bools) == "{ true, false }" - - - "{ true, false }" == "{ true, false }" - - - - - - - - ::Catch::Detail::stringify(vv) == "{ }" - - - "{ }" == "{ }" - - - - - ::Catch::Detail::stringify(vv) == "{ 42 }" - - - "{ 42 }" == "{ 42 }" - - - - - ::Catch::Detail::stringify(vv) == "{ 42, 250 }" - - - "{ 42, 250 }" == "{ 42, 250 }" - - - - - - - - ::Catch::Detail::stringify(vv) == "{ }" - - - "{ }" == "{ }" - - - - - ::Catch::Detail::stringify(vv) == "{ 42 }" - - - "{ 42 }" == "{ 42 }" - - - - - ::Catch::Detail::stringify(vv) == "{ 42, 250 }" - - - "{ 42, 250 }" == "{ 42, 250 }" - - - - - - - - ::Catch::Detail::stringify(vv) == "{ }" - - - "{ }" == "{ }" - - - - - ::Catch::Detail::stringify(vv) == "{ \"hello\" }" - - - "{ "hello" }" == "{ "hello" }" - - - - - ::Catch::Detail::stringify(vv) == "{ \"hello\", \"world\" }" - - - "{ "hello", "world" }" -== -"{ "hello", "world" }" - - - - - - - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 10 - - - 10 == 10 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 0 - - - 0 == 0 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.capacity() == 0 - - - 0 == 0 - - - -
- -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 10 - - - 10 >= 10 - - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - -
- - - v.size() == 5 - - - 5 == 5 - - - - - v.capacity() >= 5 - - - 5 >= 5 - - - -
- -
- - - - (iterations * rate) > Catch::Benchmark::Detail::warmup_time.count() - - - 160000000 (0x) > 100 - - - - - (end - start) > Catch::Benchmark::Detail::warmup_time - - - 310016000 ns > 100 ms - - - - - - - - q1 == 14.5 - - - 14.5 == 14.5 - - - - - med == 18. - - - 18.0 == 18.0 - - - - - q3 == 23. - - - 23.0 == 23.0 - - - - - -
- -
-
- -
- -
- - -
From a6e06b099b08925bc1cc5cae9d4acb208aac0e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Wed, 31 Jul 2024 22:52:11 +0200 Subject: [PATCH 10/16] constify the member function on fixtures --- examples/Fixture.cpp | 4 ++-- src/catch2/internal/catch_test_registry.hpp | 20 ++++++++++---------- tests/SelfTest/UsageTests/Class.tests.cpp | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/Fixture.cpp b/examples/Fixture.cpp index dde1d50306..cbf5b2b9e6 100644 --- a/examples/Fixture.cpp +++ b/examples/Fixture.cpp @@ -11,8 +11,8 @@ #include -struct MyFixture{ - int MyInt = 0; +struct MyFixture { + mutable int MyInt = 0; }; TEST_CASE_FIXTURE(MyFixture, "Tests with MyFixture") { diff --git a/src/catch2/internal/catch_test_registry.hpp b/src/catch2/internal/catch_test_registry.hpp index 1e8c27571d..bb34e9e46f 100644 --- a/src/catch2/internal/catch_test_registry.hpp +++ b/src/catch2/internal/catch_test_registry.hpp @@ -49,28 +49,28 @@ Detail::unique_ptr makeTestInvoker( void (C::*testAsMethod)() ) { template class TestInvokerFixture : public ITestInvoker { - void ( C::*m_testAsMethod )(); + void ( C::*m_testAsMethod )() const; Detail::unique_ptr m_fixture = nullptr; public: - TestInvokerFixture( void ( C::*testAsMethod )() ) noexcept : m_testAsMethod( testAsMethod ) {} + TestInvokerFixture( void ( C::*testAsMethod )() const) noexcept : m_testAsMethod( testAsMethod ) {} - void testCaseStarting() override { - m_fixture = Detail::make_unique(); + void testCaseStarting() override { + m_fixture = Detail::make_unique(); } - void testCaseEnding() override { - m_fixture.reset(); + void testCaseEnding() override { + m_fixture.reset(); } void invoke() const override { - auto* f = const_cast( m_fixture.get() ); + auto* f = m_fixture.get(); ( f->*m_testAsMethod )(); } }; template -Detail::unique_ptr makeTestInvokerFixture( void ( C::*testAsMethod )() ) { +Detail::unique_ptr makeTestInvokerFixture( void ( C::*testAsMethod )() const ) { return Detail::make_unique>( testAsMethod ); } @@ -177,7 +177,7 @@ static int catchInternalSectionHint = 0; CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ namespace { \ struct TestName : INTERNAL_CATCH_REMOVE_PARENS( ClassName ) { \ - void test(); \ + void test() const; \ }; \ const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \ Catch::makeTestInvokerFixture( &TestName::test ), \ @@ -186,7 +186,7 @@ static int catchInternalSectionHint = 0; Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ } \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ - void TestName::test() + void TestName::test() const #define INTERNAL_CATCH_TEST_CASE_FIXTURE( ClassName, ... ) \ INTERNAL_CATCH_TEST_CASE_FIXTURE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), ClassName, __VA_ARGS__ ) diff --git a/tests/SelfTest/UsageTests/Class.tests.cpp b/tests/SelfTest/UsageTests/Class.tests.cpp index 2a9d766664..343ac02c44 100644 --- a/tests/SelfTest/UsageTests/Class.tests.cpp +++ b/tests/SelfTest/UsageTests/Class.tests.cpp @@ -33,7 +33,7 @@ namespace { }; struct Persistent_Fixture { - int m_a = 0; + mutable int m_a = 0; }; template struct Template_Fixture { From bf4575a1276df7516488acc5bac37b5126fe4d8e Mon Sep 17 00:00:00 2001 From: KStocky Date: Sat, 3 Aug 2024 10:26:43 +0100 Subject: [PATCH 11/16] Renaming TEST_CASE_FIXTURE to TEST_CASE_PERSISTENT_FIXTURE. Also add licence to Fixture example --- docs/test-fixtures.md | 23 ++++++--- examples/Fixture.cpp | 7 ++- src/catch2/catch_test_macros.hpp | 8 ++-- src/catch2/internal/catch_test_registry.hpp | 6 +-- .../Baselines/automake.sw.approved.txt | 4 +- .../Baselines/automake.sw.multi.approved.txt | 4 +- .../Baselines/compact.sw.approved.txt | 4 +- .../Baselines/compact.sw.multi.approved.txt | 4 +- .../Baselines/console.std.approved.txt | 14 +++--- .../Baselines/console.sw.approved.txt | 40 ++++++++-------- .../Baselines/console.sw.multi.approved.txt | 40 ++++++++-------- .../SelfTest/Baselines/junit.sw.approved.txt | 24 +++++----- .../Baselines/junit.sw.multi.approved.txt | 24 +++++----- .../Baselines/sonarqube.sw.approved.txt | 24 +++++----- .../Baselines/sonarqube.sw.multi.approved.txt | 24 +++++----- tests/SelfTest/Baselines/tap.sw.approved.txt | 16 +++---- .../Baselines/tap.sw.multi.approved.txt | 16 +++---- .../Baselines/teamcity.sw.approved.txt | 10 ++-- .../Baselines/teamcity.sw.multi.approved.txt | 10 ++-- tests/SelfTest/Baselines/xml.sw.approved.txt | 48 +++++++++---------- .../Baselines/xml.sw.multi.approved.txt | 48 +++++++++---------- tests/SelfTest/UsageTests/Class.tests.cpp | 4 +- 22 files changed, 209 insertions(+), 193 deletions(-) diff --git a/docs/test-fixtures.md b/docs/test-fixtures.md index 63a6774b87..fb52a6aadb 100644 --- a/docs/test-fixtures.md +++ b/docs/test-fixtures.md @@ -9,13 +9,17 @@ ## Non-Templated test fixtures -Although Catch allows you to group tests together as [sections within a test case](test-cases-and-sections.md), it can still be convenient, sometimes, to group them using a more traditional test fixture. Catch fully supports this too with 3 different macros for non-templated test fixtures. They are: +Although Catch2 allows you to group tests together as +[sections within a test case](test-cases-and-sections.md), it can still +be convenient, sometimes, to group them using a more traditional test. +Catch2 fully supports this too with 3 different macros for +non-templated test fixtures. They are: | Macro | Description | |----------|-------------| |1. `TEST_CASE_METHOD(className, ...)`| Creates a uniquely named class which inherits from the class specified by `className`. The test function will be a member of this derived class. An instance of the derived class will be created for every partial run of the test case. | |2. `METHOD_AS_TEST_CASE(member-function, ...)`| Uses `member-function` as the test function. An instance of the class will be created for each partial run of the test case. | -|3. `TEST_CASE_FIXTURE(className, ...)`| Creates a uniquely named class which inherits from the class specified by `className`. The test function will be a member of this derived class. An instance of the derived class will be created at the start of the test run. That instance will be destroyed once the entire test case has ended. | +|3. `TEST_CASE_PERSISTENT_FIXTURE(className, ...)`| Creates a uniquely named class which inherits from the class specified by `className`. The test function will be a member of this derived class. An instance of the derived class will be created at the start of the test run. That instance will be destroyed once the entire test case has ended. | ### 1. `TEST_CASE_METHOD` @@ -73,18 +77,21 @@ METHOD_AS_TEST_CASE( TestClass::testCase, "Use class's method as a test case", " This type of fixture is similar to [TEST_CASE_METHOD](#1-test_case_method) except in this case it will directly use the provided class to create an object rather than a derived class. -### 3. `TEST_CASE_FIXTURE` +### 3. `TEST_CASE_PERSISTENT_FIXTURE` > [Introduced](link-to-issue-or-PR) in Catch2 X.Y.Z -`TEST_CASE_FIXTURE` behaves in the same way as [TEST_CASE_METHOD](#1-test_case_method) except that there will only be one instance created throughout the entire run of a test case. To demonstrate this have a look at the following example: +`TEST_CASE_PERSISTENT_FIXTURE` behaves in the same way as +[TEST_CASE_METHOD](#1-test_case_method) except that there will only be +one instance created throughout the entire run of a test case. To +demonstrate this have a look at the following example: ```cpp struct MyFixture{ int MyInt = 0; }; -TEST_CASE_FIXTURE(MyFixture, "Tests with MyFixture") { +TEST_CASE_PERSISTENT_FIXTURE(MyFixture, "Tests with MyFixture") { const int val = MyInt++; @@ -97,7 +104,11 @@ TEST_CASE_FIXTURE(MyFixture, "Tests with MyFixture") { } } ``` -This test case will be executed twice as there are two leaf sections. On the first run `val` will be `0` and on the second run `val` will be `1`. This is useful if you would like to share some expensive setup code with all runs of your test case which can't be done at static initialization time. +This test case will be executed twice as there are two leaf sections. +On the first run `val` will be `0` and on the second run `val` will be +`1`. This is useful if you would like to share some expensive setup code +with all runs of your test case which can't be done at static +initialization time. ## Templated test fixtures diff --git a/examples/Fixture.cpp b/examples/Fixture.cpp index cbf5b2b9e6..f1561dd1f0 100644 --- a/examples/Fixture.cpp +++ b/examples/Fixture.cpp @@ -1,3 +1,8 @@ +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + // SPDX-License-Identifier: BSL-1.0 // Fixture.cpp @@ -15,7 +20,7 @@ struct MyFixture { mutable int MyInt = 0; }; -TEST_CASE_FIXTURE(MyFixture, "Tests with MyFixture") { +TEST_CASE_PERSISTENT_FIXTURE(MyFixture, "Tests with MyFixture") { const int val = MyInt++; diff --git a/src/catch2/catch_test_macros.hpp b/src/catch2/catch_test_macros.hpp index a1d99f4ae7..251779ffe1 100644 --- a/src/catch2/catch_test_macros.hpp +++ b/src/catch2/catch_test_macros.hpp @@ -43,7 +43,7 @@ #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) #define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) - #define CATCH_TEST_CASE_FIXTURE( className, ... ) INTERNAL_CATCH_TEST_CASE_FIXTURE( className, __VA_ARGS__ ) + #define CATCH_TEST_CASE_PERSISTENT_FIXTURE( className, ... ) INTERNAL_CATCH_TEST_CASE_PERSISTENT_FIXTURE( className, __VA_ARGS__ ) #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) #define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) #define CATCH_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) @@ -98,7 +98,7 @@ #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define CATCH_METHOD_AS_TEST_CASE( method, ... ) - #define CATCH_TEST_CASE_FIXTURE( className, ... ) + #define CATCH_TEST_CASE_PERSISTENT_FIXTURE( className, ... ) #define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0) #define CATCH_SECTION( ... ) #define CATCH_DYNAMIC_SECTION( ... ) @@ -144,7 +144,7 @@ #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) #define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) - #define TEST_CASE_FIXTURE( className, ... ) INTERNAL_CATCH_TEST_CASE_FIXTURE( className, __VA_ARGS__ ) + #define TEST_CASE_PERSISTENT_FIXTURE( className, ... ) INTERNAL_CATCH_TEST_CASE_PERSISTENT_FIXTURE( className, __VA_ARGS__ ) #define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) #define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) #define DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) @@ -198,7 +198,7 @@ #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), __VA_ARGS__) #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define METHOD_AS_TEST_CASE( method, ... ) - #define TEST_CASE_FIXTURE( className, ... ) + #define TEST_CASE_PERSISTENT_FIXTURE( className, ... ) #define REGISTER_TEST_CASE( Function, ... ) (void)(0) #define SECTION( ... ) #define DYNAMIC_SECTION( ... ) diff --git a/src/catch2/internal/catch_test_registry.hpp b/src/catch2/internal/catch_test_registry.hpp index bb34e9e46f..accccc6838 100644 --- a/src/catch2/internal/catch_test_registry.hpp +++ b/src/catch2/internal/catch_test_registry.hpp @@ -171,7 +171,7 @@ static int catchInternalSectionHint = 0; INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), ClassName, __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// - #define INTERNAL_CATCH_TEST_CASE_FIXTURE2( TestName, ClassName, ... ) \ + #define INTERNAL_CATCH_TEST_CASE_PERSISTENT_FIXTURE2( TestName, ClassName, ... ) \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ @@ -187,8 +187,8 @@ static int catchInternalSectionHint = 0; } \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ void TestName::test() const - #define INTERNAL_CATCH_TEST_CASE_FIXTURE( ClassName, ... ) \ - INTERNAL_CATCH_TEST_CASE_FIXTURE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), ClassName, __VA_ARGS__ ) + #define INTERNAL_CATCH_TEST_CASE_PERSISTENT_FIXTURE( ClassName, ... ) \ + INTERNAL_CATCH_TEST_CASE_PERSISTENT_FIXTURE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), ClassName, __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index 6c3b71eadf..ce9475b86c 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -66,10 +66,10 @@ Nor would this :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1 :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3 :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6 -:test-result: FAIL A TEST_CASE_FIXTURE based test run that fails -:test-result: PASS A TEST_CASE_FIXTURE based test run that succeeds :test-result: FAIL A TEST_CASE_METHOD based test run that fails :test-result: PASS A TEST_CASE_METHOD based test run that succeeds +:test-result: FAIL A TEST_CASE_PERSISTENT_FIXTURE based test run that fails +:test-result: PASS A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds :test-result: PASS A Template product test case - Foo :test-result: PASS A Template product test case - Foo :test-result: PASS A Template product test case - std::vector diff --git a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt index 40d5c5407d..06f2f58df2 100644 --- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -64,10 +64,10 @@ :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1 :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3 :test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6 -:test-result: FAIL A TEST_CASE_FIXTURE based test run that fails -:test-result: PASS A TEST_CASE_FIXTURE based test run that succeeds :test-result: FAIL A TEST_CASE_METHOD based test run that fails :test-result: PASS A TEST_CASE_METHOD based test run that succeeds +:test-result: FAIL A TEST_CASE_PERSISTENT_FIXTURE based test run that fails +:test-result: PASS A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds :test-result: PASS A Template product test case - Foo :test-result: PASS A Template product test case - Foo :test-result: PASS A Template product test case - std::vector diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 201d5987f7..0f107e7139 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -239,12 +239,12 @@ Class.tests.cpp:: failed: Nttp_Fixture::value == 0 for: 6 == 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 1 > 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 3 > 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 6 > 0 +Class.tests.cpp:: failed: m_a == 2 for: 1 == 2 +Class.tests.cpp:: passed: m_a == 1 for: 1 == 1 Class.tests.cpp:: passed: m_a++ == 0 for: 0 == 0 Class.tests.cpp:: failed: m_a == 0 for: 1 == 0 Class.tests.cpp:: passed: m_a++ == 0 for: 0 == 0 Class.tests.cpp:: passed: m_a == 1 for: 1 == 1 -Class.tests.cpp:: failed: m_a == 2 for: 1 == 2 -Class.tests.cpp:: passed: m_a == 1 for: 1 == 1 Misc.tests.cpp:: passed: x.size() == 0 for: 0 == 0 Misc.tests.cpp:: passed: x.size() == 0 for: 0 == 0 Misc.tests.cpp:: passed: x.size() == 0 for: 0 == 0 diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index 566591ed60..4b9d35c6b2 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -237,12 +237,12 @@ Class.tests.cpp:: failed: Nttp_Fixture::value == 0 for: 6 == 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 1 > 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 3 > 0 Class.tests.cpp:: passed: Nttp_Fixture::value > 0 for: 6 > 0 +Class.tests.cpp:: failed: m_a == 2 for: 1 == 2 +Class.tests.cpp:: passed: m_a == 1 for: 1 == 1 Class.tests.cpp:: passed: m_a++ == 0 for: 0 == 0 Class.tests.cpp:: failed: m_a == 0 for: 1 == 0 Class.tests.cpp:: passed: m_a++ == 0 for: 0 == 0 Class.tests.cpp:: passed: m_a == 1 for: 1 == 1 -Class.tests.cpp:: failed: m_a == 2 for: 1 == 2 -Class.tests.cpp:: passed: m_a == 1 for: 1 == 1 Misc.tests.cpp:: passed: x.size() == 0 for: 0 == 0 Misc.tests.cpp:: passed: x.size() == 0 for: 0 == 0 Misc.tests.cpp:: passed: x.size() == 0 for: 0 == 0 diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 01665aa79b..f31968555e 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -287,27 +287,27 @@ with expansion: 6 == 0 ------------------------------------------------------------------------------- -A TEST_CASE_FIXTURE based test run that fails - Second partial run +A TEST_CASE_METHOD based test run that fails ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... Class.tests.cpp:: FAILED: - REQUIRE( m_a == 0 ) + REQUIRE( m_a == 2 ) with expansion: - 1 == 0 + 1 == 2 ------------------------------------------------------------------------------- -A TEST_CASE_METHOD based test run that fails +A TEST_CASE_PERSISTENT_FIXTURE based test run that fails + Second partial run ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... Class.tests.cpp:: FAILED: - REQUIRE( m_a == 2 ) + REQUIRE( m_a == 0 ) with expansion: - 1 == 2 + 1 == 0 ------------------------------------------------------------------------------- A couple of nested sections followed by a failure diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 7f80a5d19e..ba18ad1fcc 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -2007,31 +2007,29 @@ with expansion: 6 > 0 ------------------------------------------------------------------------------- -A TEST_CASE_FIXTURE based test run that fails - First partial run +A TEST_CASE_METHOD based test run that fails ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... -Class.tests.cpp:: PASSED: - REQUIRE( m_a++ == 0 ) +Class.tests.cpp:: FAILED: + REQUIRE( m_a == 2 ) with expansion: - 0 == 0 + 1 == 2 ------------------------------------------------------------------------------- -A TEST_CASE_FIXTURE based test run that fails - Second partial run +A TEST_CASE_METHOD based test run that succeeds ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... -Class.tests.cpp:: FAILED: - REQUIRE( m_a == 0 ) +Class.tests.cpp:: PASSED: + REQUIRE( m_a == 1 ) with expansion: - 1 == 0 + 1 == 1 ------------------------------------------------------------------------------- -A TEST_CASE_FIXTURE based test run that succeeds +A TEST_CASE_PERSISTENT_FIXTURE based test run that fails First partial run ------------------------------------------------------------------------------- Class.tests.cpp: @@ -2043,30 +2041,32 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -A TEST_CASE_FIXTURE based test run that succeeds +A TEST_CASE_PERSISTENT_FIXTURE based test run that fails Second partial run ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... -Class.tests.cpp:: PASSED: - REQUIRE( m_a == 1 ) +Class.tests.cpp:: FAILED: + REQUIRE( m_a == 0 ) with expansion: - 1 == 1 + 1 == 0 ------------------------------------------------------------------------------- -A TEST_CASE_METHOD based test run that fails +A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds + First partial run ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... -Class.tests.cpp:: FAILED: - REQUIRE( m_a == 2 ) +Class.tests.cpp:: PASSED: + REQUIRE( m_a++ == 0 ) with expansion: - 1 == 2 + 0 == 0 ------------------------------------------------------------------------------- -A TEST_CASE_METHOD based test run that succeeds +A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds + Second partial run ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index f08245a7f6..bdb54d43f7 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -2005,31 +2005,29 @@ with expansion: 6 > 0 ------------------------------------------------------------------------------- -A TEST_CASE_FIXTURE based test run that fails - First partial run +A TEST_CASE_METHOD based test run that fails ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... -Class.tests.cpp:: PASSED: - REQUIRE( m_a++ == 0 ) +Class.tests.cpp:: FAILED: + REQUIRE( m_a == 2 ) with expansion: - 0 == 0 + 1 == 2 ------------------------------------------------------------------------------- -A TEST_CASE_FIXTURE based test run that fails - Second partial run +A TEST_CASE_METHOD based test run that succeeds ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... -Class.tests.cpp:: FAILED: - REQUIRE( m_a == 0 ) +Class.tests.cpp:: PASSED: + REQUIRE( m_a == 1 ) with expansion: - 1 == 0 + 1 == 1 ------------------------------------------------------------------------------- -A TEST_CASE_FIXTURE based test run that succeeds +A TEST_CASE_PERSISTENT_FIXTURE based test run that fails First partial run ------------------------------------------------------------------------------- Class.tests.cpp: @@ -2041,30 +2039,32 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -A TEST_CASE_FIXTURE based test run that succeeds +A TEST_CASE_PERSISTENT_FIXTURE based test run that fails Second partial run ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... -Class.tests.cpp:: PASSED: - REQUIRE( m_a == 1 ) +Class.tests.cpp:: FAILED: + REQUIRE( m_a == 0 ) with expansion: - 1 == 1 + 1 == 0 ------------------------------------------------------------------------------- -A TEST_CASE_METHOD based test run that fails +A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds + First partial run ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... -Class.tests.cpp:: FAILED: - REQUIRE( m_a == 2 ) +Class.tests.cpp:: PASSED: + REQUIRE( m_a++ == 0 ) with expansion: - 1 == 2 + 0 == 0 ------------------------------------------------------------------------------- -A TEST_CASE_METHOD based test run that succeeds +A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds + Second partial run ------------------------------------------------------------------------------- Class.tests.cpp: ............................................................................... diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 0cb57950c0..cfe9de6346 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -303,18 +303,6 @@ at Class.tests.cpp: - - - -FAILED: - REQUIRE( m_a == 0 ) -with expansion: - 1 == 0 -at Class.tests.cpp: - - - - FAILED: @@ -325,6 +313,18 @@ at Class.tests.cpp: + + + +FAILED: + REQUIRE( m_a == 0 ) +with expansion: + 1 == 0 +at Class.tests.cpp: + + + + diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt index c89e384f58..42db614f69 100644 --- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -302,18 +302,6 @@ at Class.tests.cpp: - - - -FAILED: - REQUIRE( m_a == 0 ) -with expansion: - 1 == 0 -at Class.tests.cpp: - - - - FAILED: @@ -324,6 +312,18 @@ at Class.tests.cpp: + + + +FAILED: + REQUIRE( m_a == 0 ) +with expansion: + 1 == 0 +at Class.tests.cpp: + + + + diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index c3f3d1e391..1b5b87576e 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -509,18 +509,6 @@ at Class.tests.cpp: - - - -FAILED: - REQUIRE( m_a == 0 ) -with expansion: - 1 == 0 -at Class.tests.cpp: - - - - FAILED: @@ -531,6 +519,18 @@ at Class.tests.cpp: + + + +FAILED: + REQUIRE( m_a == 0 ) +with expansion: + 1 == 0 +at Class.tests.cpp: + + + + diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index 09186eab94..dc6b3b3190 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -508,18 +508,6 @@ at Class.tests.cpp: - - - -FAILED: - REQUIRE( m_a == 0 ) -with expansion: - 1 == 0 -at Class.tests.cpp: - - - - FAILED: @@ -530,6 +518,18 @@ at Class.tests.cpp: + + + +FAILED: + REQUIRE( m_a == 0 ) +with expansion: + 1 == 0 +at Class.tests.cpp: + + + + diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 1eb9e3aab8..36da9a8e1c 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -474,18 +474,18 @@ ok {test-number} - Nttp_Fixture::value > 0 for: 1 > 0 ok {test-number} - Nttp_Fixture::value > 0 for: 3 > 0 # A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6 ok {test-number} - Nttp_Fixture::value > 0 for: 6 > 0 -# A TEST_CASE_FIXTURE based test run that fails -ok {test-number} - m_a++ == 0 for: 0 == 0 -# A TEST_CASE_FIXTURE based test run that fails -not ok {test-number} - m_a == 0 for: 1 == 0 -# A TEST_CASE_FIXTURE based test run that succeeds -ok {test-number} - m_a++ == 0 for: 0 == 0 -# A TEST_CASE_FIXTURE based test run that succeeds -ok {test-number} - m_a == 1 for: 1 == 1 # A TEST_CASE_METHOD based test run that fails not ok {test-number} - m_a == 2 for: 1 == 2 # A TEST_CASE_METHOD based test run that succeeds ok {test-number} - m_a == 1 for: 1 == 1 +# A TEST_CASE_PERSISTENT_FIXTURE based test run that fails +ok {test-number} - m_a++ == 0 for: 0 == 0 +# A TEST_CASE_PERSISTENT_FIXTURE based test run that fails +not ok {test-number} - m_a == 0 for: 1 == 0 +# A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds +ok {test-number} - m_a++ == 0 for: 0 == 0 +# A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds +ok {test-number} - m_a == 1 for: 1 == 1 # A Template product test case - Foo ok {test-number} - x.size() == 0 for: 0 == 0 # A Template product test case - Foo diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index 60128bcbb2..64828cb1c7 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -472,18 +472,18 @@ ok {test-number} - Nttp_Fixture::value > 0 for: 1 > 0 ok {test-number} - Nttp_Fixture::value > 0 for: 3 > 0 # A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6 ok {test-number} - Nttp_Fixture::value > 0 for: 6 > 0 -# A TEST_CASE_FIXTURE based test run that fails -ok {test-number} - m_a++ == 0 for: 0 == 0 -# A TEST_CASE_FIXTURE based test run that fails -not ok {test-number} - m_a == 0 for: 1 == 0 -# A TEST_CASE_FIXTURE based test run that succeeds -ok {test-number} - m_a++ == 0 for: 0 == 0 -# A TEST_CASE_FIXTURE based test run that succeeds -ok {test-number} - m_a == 1 for: 1 == 1 # A TEST_CASE_METHOD based test run that fails not ok {test-number} - m_a == 2 for: 1 == 2 # A TEST_CASE_METHOD based test run that succeeds ok {test-number} - m_a == 1 for: 1 == 1 +# A TEST_CASE_PERSISTENT_FIXTURE based test run that fails +ok {test-number} - m_a++ == 0 for: 0 == 0 +# A TEST_CASE_PERSISTENT_FIXTURE based test run that fails +not ok {test-number} - m_a == 0 for: 1 == 0 +# A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds +ok {test-number} - m_a++ == 0 for: 0 == 0 +# A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds +ok {test-number} - m_a == 1 for: 1 == 1 # A Template product test case - Foo ok {test-number} - x.size() == 0 for: 0 == 0 # A Template product test case - Foo diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index a85a8a5e26..d305ee83dd 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -161,16 +161,16 @@ ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6' duration="{duration}"] -##teamcity[testStarted name='A TEST_CASE_FIXTURE based test run that fails'] -##teamcity[testFailed name='A TEST_CASE_FIXTURE based test run that fails' message='-------------------------------------------------------------------------------|nSecond partial run|n-------------------------------------------------------------------------------|nClass.tests.cpp:|n...............................................................................|n|nClass.tests.cpp:|nexpression failed|n REQUIRE( m_a == 0 )|nwith expansion:|n 1 == 0|n'] -##teamcity[testFinished name='A TEST_CASE_FIXTURE based test run that fails' duration="{duration}"] -##teamcity[testStarted name='A TEST_CASE_FIXTURE based test run that succeeds'] -##teamcity[testFinished name='A TEST_CASE_FIXTURE based test run that succeeds' duration="{duration}"] ##teamcity[testStarted name='A TEST_CASE_METHOD based test run that fails'] ##teamcity[testFailed name='A TEST_CASE_METHOD based test run that fails' message='Class.tests.cpp:|n...............................................................................|n|nClass.tests.cpp:|nexpression failed|n REQUIRE( m_a == 2 )|nwith expansion:|n 1 == 2|n'] ##teamcity[testFinished name='A TEST_CASE_METHOD based test run that fails' duration="{duration}"] ##teamcity[testStarted name='A TEST_CASE_METHOD based test run that succeeds'] ##teamcity[testFinished name='A TEST_CASE_METHOD based test run that succeeds' duration="{duration}"] +##teamcity[testStarted name='A TEST_CASE_PERSISTENT_FIXTURE based test run that fails'] +##teamcity[testFailed name='A TEST_CASE_PERSISTENT_FIXTURE based test run that fails' message='-------------------------------------------------------------------------------|nSecond partial run|n-------------------------------------------------------------------------------|nClass.tests.cpp:|n...............................................................................|n|nClass.tests.cpp:|nexpression failed|n REQUIRE( m_a == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFinished name='A TEST_CASE_PERSISTENT_FIXTURE based test run that fails' duration="{duration}"] +##teamcity[testStarted name='A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds'] +##teamcity[testFinished name='A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds' duration="{duration}"] ##teamcity[testStarted name='A Template product test case - Foo'] ##teamcity[testFinished name='A Template product test case - Foo' duration="{duration}"] ##teamcity[testStarted name='A Template product test case - Foo'] diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt index 046917dc20..156a8e2c7e 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -161,16 +161,16 @@ ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6' duration="{duration}"] -##teamcity[testStarted name='A TEST_CASE_FIXTURE based test run that fails'] -##teamcity[testFailed name='A TEST_CASE_FIXTURE based test run that fails' message='-------------------------------------------------------------------------------|nSecond partial run|n-------------------------------------------------------------------------------|nClass.tests.cpp:|n...............................................................................|n|nClass.tests.cpp:|nexpression failed|n REQUIRE( m_a == 0 )|nwith expansion:|n 1 == 0|n'] -##teamcity[testFinished name='A TEST_CASE_FIXTURE based test run that fails' duration="{duration}"] -##teamcity[testStarted name='A TEST_CASE_FIXTURE based test run that succeeds'] -##teamcity[testFinished name='A TEST_CASE_FIXTURE based test run that succeeds' duration="{duration}"] ##teamcity[testStarted name='A TEST_CASE_METHOD based test run that fails'] ##teamcity[testFailed name='A TEST_CASE_METHOD based test run that fails' message='Class.tests.cpp:|n...............................................................................|n|nClass.tests.cpp:|nexpression failed|n REQUIRE( m_a == 2 )|nwith expansion:|n 1 == 2|n'] ##teamcity[testFinished name='A TEST_CASE_METHOD based test run that fails' duration="{duration}"] ##teamcity[testStarted name='A TEST_CASE_METHOD based test run that succeeds'] ##teamcity[testFinished name='A TEST_CASE_METHOD based test run that succeeds' duration="{duration}"] +##teamcity[testStarted name='A TEST_CASE_PERSISTENT_FIXTURE based test run that fails'] +##teamcity[testFailed name='A TEST_CASE_PERSISTENT_FIXTURE based test run that fails' message='-------------------------------------------------------------------------------|nSecond partial run|n-------------------------------------------------------------------------------|nClass.tests.cpp:|n...............................................................................|n|nClass.tests.cpp:|nexpression failed|n REQUIRE( m_a == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFinished name='A TEST_CASE_PERSISTENT_FIXTURE based test run that fails' duration="{duration}"] +##teamcity[testStarted name='A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds'] +##teamcity[testFinished name='A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds' duration="{duration}"] ##teamcity[testStarted name='A Template product test case - Foo'] ##teamcity[testFinished name='A Template product test case - Foo' duration="{duration}"] ##teamcity[testStarted name='A Template product test case - Foo'] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index dffc0e617a..a00e45771d 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -2034,7 +2034,29 @@ Nor would this - + + + + m_a == 2 + + + 1 == 2 + + + + + + + + m_a == 1 + + + 1 == 1 + + + + +
@@ -2059,7 +2081,7 @@ Nor would this
- +
@@ -2084,28 +2106,6 @@ Nor would this
- - - - m_a == 2 - - - 1 == 2 - - - - - - - - m_a == 1 - - - 1 == 1 - - - - diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 2dcd1b1cd3..08a1804afb 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -2034,7 +2034,29 @@ Nor would this - + + + + m_a == 2 + + + 1 == 2 + + + + + + + + m_a == 1 + + + 1 == 1 + + + + +
@@ -2059,7 +2081,7 @@ Nor would this
- +
@@ -2084,28 +2106,6 @@ Nor would this
- - - - m_a == 2 - - - 1 == 2 - - - - - - - - m_a == 1 - - - 1 == 1 - - - - diff --git a/tests/SelfTest/UsageTests/Class.tests.cpp b/tests/SelfTest/UsageTests/Class.tests.cpp index 343ac02c44..75510f10d0 100644 --- a/tests/SelfTest/UsageTests/Class.tests.cpp +++ b/tests/SelfTest/UsageTests/Class.tests.cpp @@ -68,7 +68,7 @@ TEST_CASE_METHOD( Fixture, "A TEST_CASE_METHOD based test run that succeeds", "[ REQUIRE( m_a == 1 ); } -TEST_CASE_FIXTURE( Persistent_Fixture, "A TEST_CASE_FIXTURE based test run that succeeds", "[class]" ) +TEST_CASE_PERSISTENT_FIXTURE( Persistent_Fixture, "A TEST_CASE_PERSISTENT_FIXTURE based test run that succeeds", "[class]" ) { SECTION( "First partial run" ) { REQUIRE( m_a++ == 0 ); @@ -111,7 +111,7 @@ namespace Inner REQUIRE( m_a == 2 ); } - TEST_CASE_FIXTURE( Persistent_Fixture, "A TEST_CASE_FIXTURE based test run that fails", "[.][class][failing]" ) + TEST_CASE_PERSISTENT_FIXTURE( Persistent_Fixture, "A TEST_CASE_PERSISTENT_FIXTURE based test run that fails", "[.][class][failing]" ) { SECTION( "First partial run" ) { REQUIRE( m_a++ == 0 ); From 39a4b82ca611e8af65005d1a95f23cc220033776 Mon Sep 17 00:00:00 2001 From: KStocky Date: Sat, 3 Aug 2024 12:04:26 +0100 Subject: [PATCH 12/16] Rename the example file Fix the license on the file Improve the example to make the use cases much clearer. Also fix up the documentation --- docs/test-fixtures.md | 79 ++++++++++++++++++++------ examples/111-Fix-PersistentFixture.cpp | 74 ++++++++++++++++++++++++ examples/CMakeLists.txt | 2 +- examples/Fixture.cpp | 34 ----------- 4 files changed, 137 insertions(+), 52 deletions(-) create mode 100644 examples/111-Fix-PersistentFixture.cpp delete mode 100644 examples/Fixture.cpp diff --git a/docs/test-fixtures.md b/docs/test-fixtures.md index fb52a6aadb..e5f1cbcf95 100644 --- a/docs/test-fixtures.md +++ b/docs/test-fixtures.md @@ -51,11 +51,18 @@ class UniqueTestsFixture { } ``` -The two test cases here will create uniquely-named derived classes of UniqueTestsFixture and thus can access the `getID()` protected method and `conn` member variables. This ensures that both the test cases are able to create a DBConnection using the same method (DRY principle) and that any ID's created are unique such that the order that tests are executed does not matter. +The two test cases here will create uniquely-named derived classes of +UniqueTestsFixture and thus can access the `getID()` protected method +and `conn` member variables. This ensures that both the test cases +are able to create a DBConnection using the same method +(DRY principle) and that any ID's created are unique such that the +order that tests are executed does not matter. ### 2. `METHOD_AS_TEST_CASE` -`METHOD_AS_TEST_CASE` lets you register a member function of a class as a Catch2 test case. The class will be separately instantiated for each method registered in this way. +`METHOD_AS_TEST_CASE` lets you register a member function of a class +as a Catch2 test case. The class will be separately instantiated +for each method registered in this way. ```cpp class TestClass { @@ -75,11 +82,13 @@ public: METHOD_AS_TEST_CASE( TestClass::testCase, "Use class's method as a test case", "[class]" ) ``` -This type of fixture is similar to [TEST_CASE_METHOD](#1-test_case_method) except in this case it will directly use the provided class to create an object rather than a derived class. +This type of fixture is similar to [TEST_CASE_METHOD](#1-test_case_method) except in this +case it will directly use the provided class to create an object rather than a derived +class. ### 3. `TEST_CASE_PERSISTENT_FIXTURE` -> [Introduced](link-to-issue-or-PR) in Catch2 X.Y.Z +> [Introduced](https://github.com/catchorg/Catch2/pull/2885) in Catch2 X.Y.Z `TEST_CASE_PERSISTENT_FIXTURE` behaves in the same way as [TEST_CASE_METHOD](#1-test_case_method) except that there will only be @@ -87,28 +96,64 @@ one instance created throughout the entire run of a test case. To demonstrate this have a look at the following example: ```cpp -struct MyFixture{ - int MyInt = 0; +class ClassWithExpensiveSetup { +public: + ClassWithExpensiveSetup() { + // expensive construction + std::this_thread::sleep_for( std::chrono::seconds( 2 ) ); + } + + ~ClassWithExpensiveSetup() noexcept { + // expensive destruction + std::this_thread::sleep_for( std::chrono::seconds( 1 ) ); + } + + int getInt() const { return 42; } }; -TEST_CASE_PERSISTENT_FIXTURE(MyFixture, "Tests with MyFixture") { - - const int val = MyInt++; +struct MyFixture { + mutable int myInt = 0; + ClassWithExpensiveSetup expensive; +}; - SECTION("First partial run") { - REQUIRE(val == 0); - } +TEST_CASE_PERSISTENT_FIXTURE( MyFixture, "Tests with MyFixture" ) { + + const int val = myInt++; - SECTION("Second partial run") { - REQUIRE(val == 1); + SECTION( "First partial run" ) { + const auto otherValue = expensive.getInt(); + REQUIRE( val == 0 ); + REQUIRE( otherValue == 42 ); } + + SECTION( "Second partial run" ) { REQUIRE( val == 1 ); } } ``` + +This example demonstates two possible use-cases of this fixture type: +1. Improve test run times by reducing the amount of expensive and +redundant setup and tear-down required. +2. Reusing results from the previous partial run, in the current +partial run. + This test case will be executed twice as there are two leaf sections. On the first run `val` will be `0` and on the second run `val` will be -`1`. This is useful if you would like to share some expensive setup code -with all runs of your test case which can't be done at static -initialization time. +`1`. + +Additionally, we are simulating an expensive object using +`std::this_thread::sleep_for`, but real world use-cases could be: +1. Creating a D3D12/Vulkan device +2. Connecting to a database +3. Loading a file. + +The fixture object will be constructed just before the test case begins, and +it will be destroyed just after the test case ends. + +NOTE: The member function which runs the test case is `const`. Therefore +if you want to mutate any member of the fixture it must be marked as +`mutable` as shown in this example. This is to make it clear that +the initial state of the fixture is intended to mutate during the +execution of the test case. ## Templated test fixtures diff --git a/examples/111-Fix-PersistentFixture.cpp b/examples/111-Fix-PersistentFixture.cpp new file mode 100644 index 0000000000..d9f623a709 --- /dev/null +++ b/examples/111-Fix-PersistentFixture.cpp @@ -0,0 +1,74 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +// Fixture.cpp + +// Catch has three ways to express fixtures: +// - Sections +// - Traditional class-based fixtures that are created and destroyed on every +// partial run +// - Traditional class-based fixtures that are created at the start of a test +// case and destroyed at the end of a test case (this file) + +// main() provided by linkage to Catch2WithMain + +#include + +#include + +class ClassWithExpensiveSetup { +public: + ClassWithExpensiveSetup() { + // Imagine some really expensive set up here. + // e.g. + // setting up a D3D12/Vulkan Device, + // connecting to a database, + // loading a file + // etc etc etc + std::this_thread::sleep_for( std::chrono::seconds( 2 ) ); + } + + ~ClassWithExpensiveSetup() noexcept { + // We can do any clean up of the expensive class in the destructor + // e.g. + // destroy D3D12/Vulkan Device, + // disconnecting from a database, + // release file handle + // etc etc etc + std::this_thread::sleep_for( std::chrono::seconds( 1 ) ); + } + + int getInt() const { return 42; } +}; + +struct MyFixture { + + // The test case member function is const. + // Therefore we need to mark any member of the fixture + // that needs to mutate as mutable. + mutable int myInt = 0; + ClassWithExpensiveSetup expensive; +}; + +// Only one object of type MyFixture will be instantiated for the run +// of this test case even though there are two leaf sections. +// This is useful if your test case requires an object that is +// expensive to create and could be reused for each partial run of the +// test case. +TEST_CASE_PERSISTENT_FIXTURE( MyFixture, "Tests with MyFixture" ) { + + const int val = myInt++; + + SECTION( "First partial run" ) { + const auto otherValue = expensive.getInt(); + REQUIRE( val == 0 ); + REQUIRE( otherValue == 42 ); + } + + SECTION( "Second partial run" ) { REQUIRE( val == 1 ); } +} \ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 3dce2a8c54..4647df1dd9 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -25,10 +25,10 @@ target_compile_definitions(231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT) # These examples use the standard separate compilation set( SOURCES_IDIOMATIC_EXAMPLES - Fixture.cpp 030-Asn-Require-Check.cpp 100-Fix-Section.cpp 110-Fix-ClassFixture.cpp + 111-Fix-PersistentFixture.cpp 120-Bdd-ScenarioGivenWhenThen.cpp 210-Evt-EventListeners.cpp 232-Cfg-CustomMain.cpp diff --git a/examples/Fixture.cpp b/examples/Fixture.cpp deleted file mode 100644 index f1561dd1f0..0000000000 --- a/examples/Fixture.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright Catch2 Authors -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE.txt or copy at -// https://www.boost.org/LICENSE_1_0.txt) - -// SPDX-License-Identifier: BSL-1.0 - -// Fixture.cpp - -// Catch has three ways to express fixtures: -// - Sections -// - Traditional class-based fixtures that are created and destroyed on every partial run -// - Traditional class-based fixtures that are created at the start of a test case and destroyed at the end of a test case (this file) - -// main() provided by linkage to Catch2WithMain - -#include - -struct MyFixture { - mutable int MyInt = 0; -}; - -TEST_CASE_PERSISTENT_FIXTURE(MyFixture, "Tests with MyFixture") { - - const int val = MyInt++; - - SECTION("First partial run") { - REQUIRE(val == 0); - } - - SECTION("Second partial run") { - REQUIRE(val == 1); - } -} \ No newline at end of file From 72ce2bd42654e6835c7774374cc4632b27700110 Mon Sep 17 00:00:00 2001 From: KStocky Date: Sat, 3 Aug 2024 12:20:53 +0100 Subject: [PATCH 13/16] Ensured that TEST_CASE_PERSISTENT_FIXTURE works with CATCH_CONFIG_DISABLE --- src/catch2/catch_test_macros.hpp | 4 +-- tests/ExtraTests/X02-DisabledMacros.cpp | 46 ++++++++++++++++--------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/catch2/catch_test_macros.hpp b/src/catch2/catch_test_macros.hpp index 251779ffe1..6ee2129f85 100644 --- a/src/catch2/catch_test_macros.hpp +++ b/src/catch2/catch_test_macros.hpp @@ -98,7 +98,7 @@ #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define CATCH_METHOD_AS_TEST_CASE( method, ... ) - #define CATCH_TEST_CASE_PERSISTENT_FIXTURE( className, ... ) + #define CATCH_TEST_CASE_PERSISTENT_FIXTURE( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0) #define CATCH_SECTION( ... ) #define CATCH_DYNAMIC_SECTION( ... ) @@ -198,7 +198,7 @@ #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), __VA_ARGS__) #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define METHOD_AS_TEST_CASE( method, ... ) - #define TEST_CASE_PERSISTENT_FIXTURE( className, ... ) + #define TEST_CASE_PERSISTENT_FIXTURE( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), __VA_ARGS__) #define REGISTER_TEST_CASE( Function, ... ) (void)(0) #define SECTION( ... ) #define DYNAMIC_SECTION( ... ) diff --git a/tests/ExtraTests/X02-DisabledMacros.cpp b/tests/ExtraTests/X02-DisabledMacros.cpp index 68bc2add60..231adfb05b 100644 --- a/tests/ExtraTests/X02-DisabledMacros.cpp +++ b/tests/ExtraTests/X02-DisabledMacros.cpp @@ -11,34 +11,28 @@ * and expressions in assertion macros are not run. */ - -#include #include +#include #include #include #include struct foo { - foo(){ - REQUIRE_NOTHROW( print() ); - } - void print() const { - std::cout << "This should not happen\n"; - } + foo() { REQUIRE_NOTHROW( print() ); } + void print() const { std::cout << "This should not happen\n"; } }; -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wglobal-constructors" +#if defined( __clang__ ) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wglobal-constructors" #endif // Construct foo, but `foo::print` should not be run static foo f; - -#if defined(__clang__) +#if defined( __clang__ ) // The test is unused since the registration is disabled -#pragma clang diagnostic ignored "-Wunused-function" +# pragma clang diagnostic ignored "-Wunused-function" #endif // This test should not be run, because it won't be registered @@ -60,6 +54,26 @@ TEST_CASE( "Disabled Macros" ) { BENCHMARK( "Disabled benchmark" ) { REQUIRE( 1 == 2 ); }; } -#if defined(__clang__) -#pragma clang diagnostic pop +struct DisabledFixture {}; + +TEST_CASE_PERSISTENT_FIXTURE( DisabledFixture, "Disabled Persistent Fixture" ) { + CHECK( 1 == 2 ); + REQUIRE( 1 == 2 ); + std::cout << "This should not happen\n"; + FAIL(); + + // Test that static assertions don't fire when macros are disabled + STATIC_CHECK( 0 == 1 ); + STATIC_REQUIRE( !true ); + + CAPTURE( 1 ); + CAPTURE( 1, "captured" ); + + REQUIRE_THAT( 1, + Catch::Matchers::Predicate( []( int ) { return false; } ) ); + BENCHMARK( "Disabled benchmark" ) { REQUIRE( 1 == 2 ); }; +} + +#if defined( __clang__ ) +# pragma clang diagnostic pop #endif From cc25e465309dc0981bc6426a8ffd821bf3104a3b Mon Sep 17 00:00:00 2001 From: KStocky Date: Sat, 3 Aug 2024 12:30:12 +0100 Subject: [PATCH 14/16] Rename testCaseStarting to prepareTestCase and renamed testCaseEnding to tearDownTestCase --- src/catch2/catch_test_case_info.hpp | 8 ++++---- src/catch2/interfaces/catch_interfaces_test_invoker.hpp | 4 ++-- src/catch2/internal/catch_run_context.cpp | 4 ++-- src/catch2/internal/catch_test_registry.cpp | 4 ++-- src/catch2/internal/catch_test_registry.hpp | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/catch2/catch_test_case_info.hpp b/src/catch2/catch_test_case_info.hpp index 7a47a726c3..00b393b2ee 100644 --- a/src/catch2/catch_test_case_info.hpp +++ b/src/catch2/catch_test_case_info.hpp @@ -112,12 +112,12 @@ namespace Catch { TestCaseHandle(TestCaseInfo* info, ITestInvoker* invoker) : m_info(info), m_invoker(invoker) {} - void testCaseStarting() const { - m_invoker->testCaseStarting(); + void prepareTestCase() const { + m_invoker->prepareTestCase(); } - void testCaseEnding() const { - m_invoker->testCaseEnding(); + void tearDownTestCase() const { + m_invoker->tearDownTestCase(); } void invoke() const { diff --git a/src/catch2/interfaces/catch_interfaces_test_invoker.hpp b/src/catch2/interfaces/catch_interfaces_test_invoker.hpp index e30aea8342..124a7f7d4a 100644 --- a/src/catch2/interfaces/catch_interfaces_test_invoker.hpp +++ b/src/catch2/interfaces/catch_interfaces_test_invoker.hpp @@ -12,8 +12,8 @@ namespace Catch { class ITestInvoker { public: - virtual void testCaseStarting(); - virtual void testCaseEnding(); + virtual void prepareTestCase(); + virtual void tearDownTestCase(); virtual void invoke() const = 0; virtual ~ITestInvoker(); // = default }; diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp index b1eebebdd4..8711352c30 100644 --- a/src/catch2/internal/catch_run_context.cpp +++ b/src/catch2/internal/catch_run_context.cpp @@ -185,7 +185,7 @@ namespace Catch { auto const& testInfo = testCase.getTestCaseInfo(); m_reporter->testCaseStarting(testInfo); - testCase.testCaseStarting(); + testCase.prepareTestCase(); m_activeTestCase = &testCase; @@ -255,7 +255,7 @@ namespace Catch { deltaTotals.testCases.failed++; } m_totals.testCases += deltaTotals.testCases; - testCase.testCaseEnding(); + testCase.tearDownTestCase(); m_reporter->testCaseEnded(TestCaseStats(testInfo, deltaTotals, CATCH_MOVE(redirectedCout), diff --git a/src/catch2/internal/catch_test_registry.cpp b/src/catch2/internal/catch_test_registry.cpp index 4fe22b2f90..07e44617e1 100644 --- a/src/catch2/internal/catch_test_registry.cpp +++ b/src/catch2/internal/catch_test_registry.cpp @@ -16,8 +16,8 @@ #include namespace Catch { - void ITestInvoker::testCaseStarting() {} - void ITestInvoker::testCaseEnding() {} + void ITestInvoker::prepareTestCase() {} + void ITestInvoker::tearDownTestCase() {} ITestInvoker::~ITestInvoker() = default; namespace { diff --git a/src/catch2/internal/catch_test_registry.hpp b/src/catch2/internal/catch_test_registry.hpp index accccc6838..e275f2b9f2 100644 --- a/src/catch2/internal/catch_test_registry.hpp +++ b/src/catch2/internal/catch_test_registry.hpp @@ -55,11 +55,11 @@ class TestInvokerFixture : public ITestInvoker { public: TestInvokerFixture( void ( C::*testAsMethod )() const) noexcept : m_testAsMethod( testAsMethod ) {} - void testCaseStarting() override { + void prepareTestCase() override { m_fixture = Detail::make_unique(); } - void testCaseEnding() override { + void tearDownTestCase() override { m_fixture.reset(); } From f6fcfbb582550c69b9cc0e13e2676edd4723e7a2 Mon Sep 17 00:00:00 2001 From: KStocky Date: Sat, 3 Aug 2024 12:42:24 +0100 Subject: [PATCH 15/16] Further clarifying the difference between TEST_CASE_METHOD and TEST_CASE_PERSISTENT_FIXTURE. Also adding the example to the list of examples --- docs/list-of-examples.md | 1 + docs/test-fixtures.md | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/list-of-examples.md b/docs/list-of-examples.md index a919408adf..40d3f71174 100644 --- a/docs/list-of-examples.md +++ b/docs/list-of-examples.md @@ -8,6 +8,7 @@ - Assertion: [REQUIRE, CHECK](../examples/030-Asn-Require-Check.cpp) - Fixture: [Sections](../examples/100-Fix-Section.cpp) - Fixture: [Class-based fixtures](../examples/110-Fix-ClassFixture.cpp) +- Fixture: [Persistent fixtures](../examples/111-Fix-PersistentFixture.cpp) - BDD: [SCENARIO, GIVEN, WHEN, THEN](../examples/120-Bdd-ScenarioGivenWhenThen.cpp) - Listener: [Listeners](../examples/210-Evt-EventListeners.cpp) - Configuration: [Provide your own output streams](../examples/231-Cfg-OutputStreams.cpp) diff --git a/docs/test-fixtures.md b/docs/test-fixtures.md index e5f1cbcf95..6bc115e244 100644 --- a/docs/test-fixtures.md +++ b/docs/test-fixtures.md @@ -138,7 +138,8 @@ partial run. This test case will be executed twice as there are two leaf sections. On the first run `val` will be `0` and on the second run `val` will be -`1`. +`1`. This demonstrates that we were able to use the results of the +previous partial run in subsequent partial runs. Additionally, we are simulating an expensive object using `std::this_thread::sleep_for`, but real world use-cases could be: @@ -146,8 +147,12 @@ Additionally, we are simulating an expensive object using 2. Connecting to a database 3. Loading a file. -The fixture object will be constructed just before the test case begins, and -it will be destroyed just after the test case ends. +The fixture object (`MyFixture`) will be constructed just before the +test case begins, and it will be destroyed just after the test case +ends. Therefore, this expensive object will only be created and +destroyed once during the execution of this test case. If we had used +`TEST_CASE_METHOD`, `MyFixture` would have been created and destroyed +twice during the execution of this test case. NOTE: The member function which runs the test case is `const`. Therefore if you want to mutate any member of the fixture it must be marked as From d079e83e485fa6420d00cfd3c615a7dc6014f4cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Mon, 5 Aug 2024 17:00:22 +0200 Subject: [PATCH 16/16] Update examples/111-Fix-PersistentFixture.cpp --- examples/111-Fix-PersistentFixture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/111-Fix-PersistentFixture.cpp b/examples/111-Fix-PersistentFixture.cpp index d9f623a709..2bef90ff7c 100644 --- a/examples/111-Fix-PersistentFixture.cpp +++ b/examples/111-Fix-PersistentFixture.cpp @@ -8,7 +8,7 @@ // Fixture.cpp -// Catch has three ways to express fixtures: +// Catch2 has three ways to express fixtures: // - Sections // - Traditional class-based fixtures that are created and destroyed on every // partial run