From c6075e25ec69cf087cf64bc3dcbcd1595fe89fb0 Mon Sep 17 00:00:00 2001 From: Jonathan Hyry Date: Fri, 28 Feb 2025 01:05:24 -0800 Subject: [PATCH 1/5] Add list of issues this branch will fix. --- cppcheck-fix | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cppcheck-fix diff --git a/cppcheck-fix b/cppcheck-fix new file mode 100644 index 0000000..3568307 --- /dev/null +++ b/cppcheck-fix @@ -0,0 +1,12 @@ +include/internal/TestCPPTestSuite.h:80:9: warning: Member variable 'TestSuite::lastRunSucceeded' is not initialized in the constructor. [uninitMemberVar] + TestSuite (TestObjName&& suiteName, + ^ +include/internal/TestCPPTestSuite.h:80:9: warning: Member variable 'TestSuite::lastRunSuccessCount' is not initialized in the constructor. [uninitMemberVar] + TestSuite (TestObjName&& suiteName, + ^ +include/internal/TestCPPTestSuite.h:80:9: warning: Member variable 'TestSuite::lastRunFailCount' is not initialized in the constructor. [uninitMemberVar] + TestSuite (TestObjName&& suiteName, + ^ +include/internal/TestCPPTestSuite.h:80:9: warning: Member variable 'TestSuite::totalRuntime' is not initialized in the constructor. [uninitMemberVar] + TestSuite (TestObjName&& suiteName, + ^ From ff99a80f0eee89b485ba6e5cf2c47848c62885e0 Mon Sep 17 00:00:00 2001 From: Jonathan Hyry Date: Tue, 4 Mar 2025 18:30:19 -0800 Subject: [PATCH 2/5] Qualify forward with std:: like move, fix shadowing, fix #5, formatting Whitespace/newline formatting in function header. Adjust the name of the TestSuite ctor parameter so it doesn't shadow the member field. Create a common initialization function since the majority of the initialization logic is the same in both cases and I added a few more initialization statements; it is more correct to have them initialized by the constructor than the run() function for the initial suite run. I added a firstRun bool to indicate when the run() re-initialization logic should be run since the suites can be rerun if desired; for example if the client application is running tests interactively and the end-user wants to run a suite 4 or 5 times to validate that tests are not flakey, or if an automated application wants to do something along those lines, or with other use cases that I have not conceived. The common initialization function is inlined and removed by the compiler, which is a warning in MSVC; it is suppressed with a #pragma since it is an internal function, and it's ok if it is removed because of inlining with no further references. Maybe using std::forward helped the compiler to decide to inline? Or maybe it would have done it anyways. Removed using std::forward since it is now fully-qualified. --- include/internal/TestCPPTestSuite.h | 34 ++++++++++++++++++++--------- src/TestCPPTestSuite.cpp | 18 ++++++++++----- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/include/internal/TestCPPTestSuite.h b/include/internal/TestCPPTestSuite.h index 545a193..1e7e2eb 100644 --- a/include/internal/TestCPPTestSuite.h +++ b/include/internal/TestCPPTestSuite.h @@ -46,7 +46,6 @@ using std::chrono::system_clock; using std::chrono::duration_cast; using std::enable_if; using std::endl; -using std::forward; using std::function; using std::runtime_error; using std::string; @@ -77,12 +76,10 @@ namespace TestCPP { * tests. */ template - TestSuite (TestObjName&& suiteName, + TestSuite (TestObjName&& newSuiteName, typename enable_if::type) { - this->testSuitePassedMessage = true; - this->setSuiteName(std::move(suiteName)); - this->tests = vector(); + commonInit(std::forward(newSuiteName)); } /** @@ -90,11 +87,9 @@ namespace TestCPP { * tests. */ template - TestSuite (TestObjName&& suiteName, TestType ...tests) { - this->testSuitePassedMessage = true; - this->setSuiteName(std::move(suiteName)); - this->tests = vector(); - + TestSuite (TestObjName&& newSuiteName, TestType ...tests) + { + commonInit(std::forward(newSuiteName)); this->addTests(tests...); } @@ -158,6 +153,7 @@ namespace TestCPP { void run (); private: + bool firstRun; bool testSuitePassedMessage; bool lastRunSucceeded; unsigned lastRunSuccessCount; @@ -166,6 +162,24 @@ namespace TestCPP { TestObjName suiteName; vector tests; + + // It's ok that this function is removed, because it's private + // and inlined and is not externally visible or used + // externally. + // It's appropriate to suppress this instance of C4514. +#pragma warning(suppress: 4514) + void commonInit(TestObjName&& newSuiteName) { + + this->firstRun = true; + this->testSuitePassedMessage = true; + this->lastRunSucceeded = true; + this->lastRunFailCount = 0; + this->lastRunSuccessCount = 0; + this->totalRuntime = 0; + + this->setSuiteName(std::forward(newSuiteName)); + this->tests = vector(); + } }; } diff --git a/src/TestCPPTestSuite.cpp b/src/TestCPPTestSuite.cpp index ecaf3d6..8e7a3eb 100644 --- a/src/TestCPPTestSuite.cpp +++ b/src/TestCPPTestSuite.cpp @@ -80,10 +80,15 @@ namespace TestCPP { return; } - this->lastRunSucceeded = true; - this->lastRunFailCount = 0; - this->lastRunSuccessCount = 0; - this->totalRuntime = 0; + if (!this->firstRun) { + this->lastRunSucceeded = true; + this->lastRunFailCount = 0; + this->lastRunSuccessCount = 0; + this->totalRuntime = 0; + } + else { + this->firstRun = false; + } clog << endl << TCPPStr::START_RUN << TCPPStr::SUITE @@ -160,8 +165,9 @@ namespace TestCPP { * element is the test function that defines the test. */ template<> - void TestSuite::addTest (tuple>&& test) { + void TestSuite::addTest (tuple>&& + test) + { this->tests.emplace_back( std::get<0>(test), std::get<1>(test), From 3bf4f5eac6d44be1184ee97b53dc6598cda82737 Mon Sep 17 00:00:00 2001 From: Jonathan Hyry Date: Tue, 4 Mar 2025 18:33:02 -0800 Subject: [PATCH 3/5] Closes #5 and #96. --- cppcheck-fix | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 cppcheck-fix diff --git a/cppcheck-fix b/cppcheck-fix deleted file mode 100644 index 3568307..0000000 --- a/cppcheck-fix +++ /dev/null @@ -1,12 +0,0 @@ -include/internal/TestCPPTestSuite.h:80:9: warning: Member variable 'TestSuite::lastRunSucceeded' is not initialized in the constructor. [uninitMemberVar] - TestSuite (TestObjName&& suiteName, - ^ -include/internal/TestCPPTestSuite.h:80:9: warning: Member variable 'TestSuite::lastRunSuccessCount' is not initialized in the constructor. [uninitMemberVar] - TestSuite (TestObjName&& suiteName, - ^ -include/internal/TestCPPTestSuite.h:80:9: warning: Member variable 'TestSuite::lastRunFailCount' is not initialized in the constructor. [uninitMemberVar] - TestSuite (TestObjName&& suiteName, - ^ -include/internal/TestCPPTestSuite.h:80:9: warning: Member variable 'TestSuite::totalRuntime' is not initialized in the constructor. [uninitMemberVar] - TestSuite (TestObjName&& suiteName, - ^ From c5ca8c0c20e1166b09d4d0e7252dbe6abcf2ae81 Mon Sep 17 00:00:00 2001 From: Jonathan Hyry Date: Tue, 4 Mar 2025 18:57:47 -0800 Subject: [PATCH 4/5] Add -Wno-unknown-pragmas to GCC/Clang builds This is a multi-platform project and I needed to use an MSVC pragma to suppress (appropriately) a specific instance of a warning with the the MSVC pragma used to do that. --- cmake/build/GCCClangDebug.cmake | 4 ++++ cmake/build/GCCClangRelease.cmake | 4 ++++ cmake/build/GCCCoverage.cmake | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/cmake/build/GCCClangDebug.cmake b/cmake/build/GCCClangDebug.cmake index 7ae11bd..5cf90a0 100644 --- a/cmake/build/GCCClangDebug.cmake +++ b/cmake/build/GCCClangDebug.cmake @@ -17,6 +17,10 @@ list ( # it's not necessary to maintain # compatibility with C++98. -Wno-covered-switch-default # -Wswitch-default is more important. + -Wno-unknown-pragmas # Ignore unknown pragmas, since we are + # building for Clang, GCC, and MSVC, + # and MSVC has different pragmas than + # GCC/Clang. -Wno-unused-lambda-capture # Avoid MSVC error C3493 - There is # implementation divergence here and # since we're not using >=C++14 there diff --git a/cmake/build/GCCClangRelease.cmake b/cmake/build/GCCClangRelease.cmake index 723a235..bc37aba 100644 --- a/cmake/build/GCCClangRelease.cmake +++ b/cmake/build/GCCClangRelease.cmake @@ -14,6 +14,10 @@ list ( # it's not necessary to maintain # compatibility with C++98. -Wno-covered-switch-default # -Wswitch-default is more important. + -Wno-unknown-pragmas # Ignore unknown pragmas, since we are + # building for Clang, GCC, and MSVC, + # and MSVC has different pragmas than + # GCC/Clang. -Wno-unused-parameter # Unused parameters occur in the Release # build in debugLog. -Wno-unused-lambda-capture # Avoid MSVC error C3493 - There is diff --git a/cmake/build/GCCCoverage.cmake b/cmake/build/GCCCoverage.cmake index d6ef9ee..73f03d1 100644 --- a/cmake/build/GCCCoverage.cmake +++ b/cmake/build/GCCCoverage.cmake @@ -17,6 +17,10 @@ list ( # it's not necessary to maintain # compatibility with C++98. -Wno-covered-switch-default # -Wswitch-default is more important. + -Wno-unknown-pragmas # Ignore unknown pragmas, since we are + # building for Clang, GCC, and MSVC, + # and MSVC has different pragmas than + # GCC/Clang. -fprofile-arcs # Enable profile points that help with # code coverage. -ftest-coverage # Enable core code coverage compilation. From 819b877a93432422dbcc6b82e41e68f81c0fb7c8 Mon Sep 17 00:00:00 2001 From: Jonathan Hyry Date: Tue, 4 Mar 2025 20:45:48 -0800 Subject: [PATCH 5/5] Increase patch coverage to hit codecov target qg, test suites work Introduce tests for TestSuite that run each suite twice and ensure that the failed and success counts are correct; it would help to implement runs that also include failed tests to check that as well. Also introduce tests dedicated to the TestSuite::run() function. The files were getting pretty big so I split the TestSuite tests up into categories centered on functionality, including: - Construction - Running - Test Passed Message These splits are their own CMake CTest executables and all build modifications have been completed that support these splits. Also renamed the assertions tests headers and sources files such that they align properly with the naming of the rest of the test code TUs and headers. To do this properly, I had to add a function to get the number of tests that ran successfully from the TestSuite. Resolves #97 and #98. --- cmake/Includes.cmake | 14 ++- cmake/Targets.cmake | 24 +++- cmake/Testing.cmake | 16 ++- cmake/build/DebugCompileDefs.cmake | 14 ++- cmake/build/GCCClangDebug.cmake | 14 ++- cmake/build/GCCClangRelease.cmake | 14 ++- cmake/build/GCCCoverage.cmake | 14 ++- cmake/build/MSVCDebug.cmake | 14 ++- cmake/build/MSVCRelease.cmake | 14 ++- cmake/link/Tests.cmake | 42 ++++++- cmake/link/TestsWithCoverage.cmake | 48 +++++++- include/internal/TestCPPTestSuite.h | 18 ++- src/TestCPPTestSuite.cpp | 8 +- ...ertionsSuites.h => AssertionsBasicSuite.h} | 2 +- ...sertionsTests.h => AssertionsBasicTests.h} | 0 .../TestSuite/TestSuiteConstructionSuite.h | 42 +++++++ .../include/TestSuite/TestSuiteRunningSuite.h | 54 +++++++++ ...te.h => TestSuiteTestPassedMessageSuite.h} | 35 +----- test/include/TestSuite/TestSuiteTests.h | 6 + ...ionsTests.cpp => AssertionsBasicTests.cpp} | 2 +- ...ain.cpp => TestCPPAssertionsBasicMain.cpp} | 7 +- test/src/TestCPPTestSuiteConstructionMain.cpp | 25 ++++ ...in.cpp => TestCPPTestSuiteRunningMain.cpp} | 6 +- .../TestCPPTestSuiteTestPassedMessageMain.cpp | 25 ++++ .../TestSuite/TestSuiteConstructionTests.cpp | 94 +++++++++++++++ test/src/TestSuite/TestSuiteRunningTests.cpp | 114 ++++++++++++++++++ ...pp => TestSuiteTestPassedMessageTests.cpp} | 83 ------------- 27 files changed, 585 insertions(+), 164 deletions(-) rename test/include/Assertions/{AssertionsSuites.h => AssertionsBasicSuite.h} (99%) rename test/include/Assertions/{BasicAssertionsTests.h => AssertionsBasicTests.h} (100%) create mode 100644 test/include/TestSuite/TestSuiteConstructionSuite.h create mode 100644 test/include/TestSuite/TestSuiteRunningSuite.h rename test/include/TestSuite/{TestSuiteSuite.h => TestSuiteTestPassedMessageSuite.h} (59%) rename test/src/Assertions/{BasicAssertionsTests.cpp => AssertionsBasicTests.cpp} (99%) rename test/src/{TestCPPAssertionsMain.cpp => TestCPPAssertionsBasicMain.cpp} (77%) create mode 100644 test/src/TestCPPTestSuiteConstructionMain.cpp rename test/src/{TestCPPTestSuiteMain.cpp => TestCPPTestSuiteRunningMain.cpp} (73%) create mode 100644 test/src/TestCPPTestSuiteTestPassedMessageMain.cpp create mode 100644 test/src/TestSuite/TestSuiteConstructionTests.cpp create mode 100644 test/src/TestSuite/TestSuiteRunningTests.cpp rename test/src/TestSuite/{TestSuiteTests.cpp => TestSuiteTestPassedMessageTests.cpp} (80%) diff --git a/cmake/Includes.cmake b/cmake/Includes.cmake index 90f2587..6c50bed 100644 --- a/cmake/Includes.cmake +++ b/cmake/Includes.cmake @@ -28,13 +28,23 @@ if (BUILD_TESTING) ) target_include_directories ( - ${PROJECT_NAME}_TestSuite_test PRIVATE + ${PROJECT_NAME}_TestSuite_ctor_test PRIVATE + test/include + include + ) + target_include_directories ( + ${PROJECT_NAME}_TestSuite_running_test PRIVATE + test/include + include + ) + target_include_directories ( + ${PROJECT_NAME}_TestSuite_tpm_test PRIVATE test/include include ) target_include_directories ( - ${PROJECT_NAME}_Assertions_test PRIVATE + ${PROJECT_NAME}_Assertions_basic_test PRIVATE test/include include ) diff --git a/cmake/Targets.cmake b/cmake/Targets.cmake index 1606e70..580f48b 100644 --- a/cmake/Targets.cmake +++ b/cmake/Targets.cmake @@ -30,15 +30,27 @@ if (BUILD_TESTING) ) add_executable ( - ${PROJECT_NAME}_TestSuite_test - test/src/TestSuite/TestSuiteTests.cpp - test/src/TestCPPTestSuiteMain.cpp + ${PROJECT_NAME}_TestSuite_ctor_test + test/src/TestSuite/TestSuiteConstructionTests.cpp + test/src/TestCPPTestSuiteConstructionMain.cpp ) add_executable ( - ${PROJECT_NAME}_Assertions_test - test/src/Assertions/BasicAssertionsTests.cpp - test/src/TestCPPAssertionsMain.cpp + ${PROJECT_NAME}_TestSuite_running_test + test/src/TestSuite/TestSuiteRunningTests.cpp + test/src/TestCPPTestSuiteRunningMain.cpp + ) + + add_executable ( + ${PROJECT_NAME}_TestSuite_tpm_test + test/src/TestSuite/TestSuiteTestPassedMessageTests.cpp + test/src/TestCPPTestSuiteTestPassedMessageMain.cpp + ) + + add_executable ( + ${PROJECT_NAME}_Assertions_basic_test + test/src/Assertions/AssertionsBasicTests.cpp + test/src/TestCPPAssertionsBasicMain.cpp ) add_executable ( diff --git a/cmake/Testing.cmake b/cmake/Testing.cmake index 146527f..550a0a5 100644 --- a/cmake/Testing.cmake +++ b/cmake/Testing.cmake @@ -5,13 +5,21 @@ if (BUILD_TESTING) ) add_test ( - NAME ${PROJECT_NAME}TestSuiteTests - COMMAND ${PROJECT_NAME}_TestSuite_test + NAME ${PROJECT_NAME}TestSuiteConstructionTests + COMMAND ${PROJECT_NAME}_TestSuite_ctor_test + ) + add_test ( + NAME ${PROJECT_NAME}TestSuiteRunningTests + COMMAND ${PROJECT_NAME}_TestSuite_running_test + ) + add_test ( + NAME ${PROJECT_NAME}TestSuiteTestPassedMessageTests + COMMAND ${PROJECT_NAME}_TestSuite_tpm_test ) add_test ( - NAME ${PROJECT_NAME}AssertionsTests - COMMAND ${PROJECT_NAME}_Assertions_test + NAME ${PROJECT_NAME}AssertionsBasicTests + COMMAND ${PROJECT_NAME}_Assertions_basic_test ) add_test ( diff --git a/cmake/build/DebugCompileDefs.cmake b/cmake/build/DebugCompileDefs.cmake index 8f424d3..55e55d1 100644 --- a/cmake/build/DebugCompileDefs.cmake +++ b/cmake/build/DebugCompileDefs.cmake @@ -19,12 +19,22 @@ if (BUILD_TESTING) DEBUG_LOG ) target_compile_definitions ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test PUBLIC DEBUG_LOG ) target_compile_definitions ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_TestSuite_running_test + PUBLIC + DEBUG_LOG + ) + target_compile_definitions ( + ${PROJECT_NAME}_TestSuite_tpm_test + PUBLIC + DEBUG_LOG + ) + target_compile_definitions ( + ${PROJECT_NAME}_Assertions_basic_test PUBLIC DEBUG_LOG ) diff --git a/cmake/build/GCCClangDebug.cmake b/cmake/build/GCCClangDebug.cmake index 5cf90a0..d6df79e 100644 --- a/cmake/build/GCCClangDebug.cmake +++ b/cmake/build/GCCClangDebug.cmake @@ -97,13 +97,23 @@ else () ) target_compile_options ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test + PUBLIC + ${GCC_CLANG_DEBUG_BUILD_OPTS} + ) + target_compile_options ( + ${PROJECT_NAME}_TestSuite_running_test + PUBLIC + ${GCC_CLANG_DEBUG_BUILD_OPTS} + ) + target_compile_options ( + ${PROJECT_NAME}_TestSuite_tpm_test PUBLIC ${GCC_CLANG_DEBUG_BUILD_OPTS} ) target_compile_options ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_Assertions_basic_test PUBLIC ${GCC_CLANG_DEBUG_BUILD_OPTS} ) diff --git a/cmake/build/GCCClangRelease.cmake b/cmake/build/GCCClangRelease.cmake index bc37aba..819709a 100644 --- a/cmake/build/GCCClangRelease.cmake +++ b/cmake/build/GCCClangRelease.cmake @@ -90,13 +90,23 @@ if (BUILD_TESTING) ) target_compile_options ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test + PUBLIC + ${GCC_CLANG_RELEASE_BUILD_OPTS} + ) + target_compile_options ( + ${PROJECT_NAME}_TestSuite_running_test + PUBLIC + ${GCC_CLANG_RELEASE_BUILD_OPTS} + ) + target_compile_options ( + ${PROJECT_NAME}_TestSuite_tpm_test PUBLIC ${GCC_CLANG_RELEASE_BUILD_OPTS} ) target_compile_options ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_Assertions_basic_test PUBLIC ${GCC_CLANG_RELEASE_BUILD_OPTS} ) diff --git a/cmake/build/GCCCoverage.cmake b/cmake/build/GCCCoverage.cmake index 73f03d1..7874bd1 100644 --- a/cmake/build/GCCCoverage.cmake +++ b/cmake/build/GCCCoverage.cmake @@ -43,13 +43,23 @@ target_compile_options ( ) target_compile_options ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test + PUBLIC + ${COVERAGE_BUILD_OPTS} +) +target_compile_options ( + ${PROJECT_NAME}_TestSuite_running_test + PUBLIC + ${COVERAGE_BUILD_OPTS} +) +target_compile_options ( + ${PROJECT_NAME}_TestSuite_tpm_test PUBLIC ${COVERAGE_BUILD_OPTS} ) target_compile_options ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_Assertions_basic_test PUBLIC ${COVERAGE_BUILD_OPTS} ) diff --git a/cmake/build/MSVCDebug.cmake b/cmake/build/MSVCDebug.cmake index b86c7ad..1b2cb92 100644 --- a/cmake/build/MSVCDebug.cmake +++ b/cmake/build/MSVCDebug.cmake @@ -73,13 +73,23 @@ if (BUILD_TESTING) ) target_compile_options ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test + PUBLIC + ${MSVC_DEBUG_BUILD_OPTS} + ) + target_compile_options ( + ${PROJECT_NAME}_TestSuite_running_test + PUBLIC + ${MSVC_DEBUG_BUILD_OPTS} + ) + target_compile_options ( + ${PROJECT_NAME}_TestSuite_tpm_test PUBLIC ${MSVC_DEBUG_BUILD_OPTS} ) target_compile_options ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_Assertions_basic_test PUBLIC ${MSVC_DEBUG_BUILD_OPTS} ) diff --git a/cmake/build/MSVCRelease.cmake b/cmake/build/MSVCRelease.cmake index 2874a78..0bc537b 100644 --- a/cmake/build/MSVCRelease.cmake +++ b/cmake/build/MSVCRelease.cmake @@ -63,13 +63,23 @@ if (BUILD_TESTING) ) target_compile_options ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test + PUBLIC + ${MSVC_RELEASE_BUILD_OPTS} + ) + target_compile_options ( + ${PROJECT_NAME}_TestSuite_running_test + PUBLIC + ${MSVC_RELEASE_BUILD_OPTS} + ) + target_compile_options ( + ${PROJECT_NAME}_TestSuite_tpm_test PUBLIC ${MSVC_RELEASE_BUILD_OPTS} ) target_compile_options ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_Assertions_basic_test PUBLIC ${MSVC_RELEASE_BUILD_OPTS} ) diff --git a/cmake/link/Tests.cmake b/cmake/link/Tests.cmake index ada2836..01958d7 100644 --- a/cmake/link/Tests.cmake +++ b/cmake/link/Tests.cmake @@ -6,13 +6,25 @@ if (${TESTCPP_STACKTRACE_ENABLED} AND MSVC) dbgeng ) target_link_libraries ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test ${PROJECT_NAME} ole32 dbgeng ) target_link_libraries ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_TestSuite_running_test + ${PROJECT_NAME} + ole32 + dbgeng + ) + target_link_libraries ( + ${PROJECT_NAME}_TestSuite_tpm_test + ${PROJECT_NAME} + ole32 + dbgeng + ) + target_link_libraries ( + ${PROJECT_NAME}_Assertions_basic_test ${PROJECT_NAME} ole32 dbgeng @@ -31,12 +43,22 @@ elseif (${TESTCPP_STACKTRACE_ENABLED}) dl ) target_link_libraries ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test + ${PROJECT_NAME} + dl + ) + target_link_libraries ( + ${PROJECT_NAME}_TestSuite_running_test + ${PROJECT_NAME} + dl + ) + target_link_libraries ( + ${PROJECT_NAME}_TestSuite_tpm_test ${PROJECT_NAME} dl ) target_link_libraries ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_Assertions_basic_test ${PROJECT_NAME} dl ) @@ -52,11 +74,19 @@ else () ${PROJECT_NAME} ) target_link_libraries ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test + ${PROJECT_NAME} + ) + target_link_libraries ( + ${PROJECT_NAME}_TestSuite_running_test + ${PROJECT_NAME} + ) + target_link_libraries ( + ${PROJECT_NAME}_TestSuite_tpm_test ${PROJECT_NAME} ) target_link_libraries ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_Assertions_basic_test ${PROJECT_NAME} ) target_link_libraries ( diff --git a/cmake/link/TestsWithCoverage.cmake b/cmake/link/TestsWithCoverage.cmake index 244e366..dff4a34 100644 --- a/cmake/link/TestsWithCoverage.cmake +++ b/cmake/link/TestsWithCoverage.cmake @@ -7,14 +7,28 @@ if (${TESTCPP_STACKTRACE_ENABLED} AND MSVC) dbgeng ) target_link_libraries ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test ${PROJECT_NAME} gcov ole32 dbgeng ) target_link_libraries ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_TestSuite_running_test + ${PROJECT_NAME} + gcov + ole32 + dbgeng + ) + target_link_libraries ( + ${PROJECT_NAME}_TestSuite_tpm_test + ${PROJECT_NAME} + gcov + ole32 + dbgeng + ) + target_link_libraries ( + ${PROJECT_NAME}_Assertions_basic_test ${PROJECT_NAME} gcov ole32 @@ -36,13 +50,25 @@ elseif (${TESTCPP_STACKTRACE_ENABLED}) dl ) target_link_libraries ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test + ${PROJECT_NAME} + gcov + dl + ) + target_link_libraries ( + ${PROJECT_NAME}_TestSuite_running_test + ${PROJECT_NAME} + gcov + dl + ) + target_link_libraries ( + ${PROJECT_NAME}_TestSuite_tpm_test ${PROJECT_NAME} gcov dl ) target_link_libraries ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_Assertions_basic_test ${PROJECT_NAME} gcov dl @@ -61,12 +87,22 @@ else () gcov ) target_link_libraries ( - ${PROJECT_NAME}_TestSuite_test + ${PROJECT_NAME}_TestSuite_ctor_test + ${PROJECT_NAME} + gcov + ) + target_link_libraries ( + ${PROJECT_NAME}_TestSuite_running_test + ${PROJECT_NAME} + gcov + ) + target_link_libraries ( + ${PROJECT_NAME}_TestSuite_tpm_test ${PROJECT_NAME} gcov ) target_link_libraries ( - ${PROJECT_NAME}_Assertions_test + ${PROJECT_NAME}_Assertions_basic_test ${PROJECT_NAME} gcov ) diff --git a/include/internal/TestCPPTestSuite.h b/include/internal/TestCPPTestSuite.h index 1e7e2eb..9d9e83e 100644 --- a/include/internal/TestCPPTestSuite.h +++ b/include/internal/TestCPPTestSuite.h @@ -140,19 +140,29 @@ namespace TestCPP { void disableTestPassedMessage (); /** - * @brief Calculate the total number of tests in the suite that - * failed after the last suite run. + * @brief Retrieve the total number of tests in the suite that + * failed during the last suite run. * @return The total number of tests that failed in the last * suite run. */ unsigned getLastRunFailCount (); + /** + * @brief Retrieve the total number of tests in the suite that + * succeeded (passed) during the last suite run. + * @return The total number of tests that passed in the last + * suite run. + */ + unsigned getLastRunSuccessCount(); + /** * @brief Run all tests in the test suite. */ void run (); private: + unsigned zeroInit = 0; + bool firstRun; bool testSuitePassedMessage; bool lastRunSucceeded; @@ -173,8 +183,8 @@ namespace TestCPP { this->firstRun = true; this->testSuitePassedMessage = true; this->lastRunSucceeded = true; - this->lastRunFailCount = 0; - this->lastRunSuccessCount = 0; + this->lastRunFailCount = zeroInit; + this->lastRunSuccessCount = zeroInit; this->totalRuntime = 0; this->setSuiteName(std::forward(newSuiteName)); diff --git a/src/TestCPPTestSuite.cpp b/src/TestCPPTestSuite.cpp index 8e7a3eb..cfd7f21 100644 --- a/src/TestCPPTestSuite.cpp +++ b/src/TestCPPTestSuite.cpp @@ -74,6 +74,10 @@ namespace TestCPP { return this->lastRunFailCount; } + unsigned TestSuite::getLastRunSuccessCount() { + return this->lastRunSuccessCount; + } + void TestSuite::run () { if (this->tests.size() == 0) { clog << TCPPStr::NTR << endl; @@ -82,8 +86,8 @@ namespace TestCPP { if (!this->firstRun) { this->lastRunSucceeded = true; - this->lastRunFailCount = 0; - this->lastRunSuccessCount = 0; + this->lastRunFailCount = zeroInit; + this->lastRunSuccessCount = zeroInit; this->totalRuntime = 0; } else { diff --git a/test/include/Assertions/AssertionsSuites.h b/test/include/Assertions/AssertionsBasicSuite.h similarity index 99% rename from test/include/Assertions/AssertionsSuites.h rename to test/include/Assertions/AssertionsBasicSuite.h index 87f2e64..c165656 100644 --- a/test/include/Assertions/AssertionsSuites.h +++ b/test/include/Assertions/AssertionsBasicSuite.h @@ -1,7 +1,7 @@ #ifndef TESTCPP_ASSERTIONS_SUITE_ #define TESTCPP_ASSERTIONS_SUITE_ -#include "BasicAssertionsTests.h" +#include "AssertionsBasicTests.h" namespace TestCPP { namespace Testing { diff --git a/test/include/Assertions/BasicAssertionsTests.h b/test/include/Assertions/AssertionsBasicTests.h similarity index 100% rename from test/include/Assertions/BasicAssertionsTests.h rename to test/include/Assertions/AssertionsBasicTests.h diff --git a/test/include/TestSuite/TestSuiteConstructionSuite.h b/test/include/TestSuite/TestSuiteConstructionSuite.h new file mode 100644 index 0000000..fd9e86b --- /dev/null +++ b/test/include/TestSuite/TestSuiteConstructionSuite.h @@ -0,0 +1,42 @@ +#ifndef TESTCPP_TESTSUITE_CONSTRUCTION_SUITE_ +#define TESTCPP_TESTSUITE_CONSTRUCTION_SUITE_ + +#include "TestCPP.h" +#include "TestSuiteTests.h" + +namespace TestCPP { + namespace Testing { + namespace TestSuiteSuites { + TestSuite ctorSuite( + "TestCPP TestSuite Tests - Construction", + + make_tuple( + "Suite construction Test - no tests", + function( + TestSuiteTests::TestConstructSuiteBare + ) + ), + make_tuple( + "Suite construction Test - TestCases", + function( + TestSuiteTests::TestConstructSuiteTestCases + ) + ), + make_tuple( + "Suite construction Test - tuples", + function( + TestSuiteTests::TestConstructSuiteTuples + ) + ), + make_tuple( + "Suite construction Test - mixed", + function( + TestSuiteTests::TestConstructSuiteMixed + ) + ) + ); + } + } +} + +#endif diff --git a/test/include/TestSuite/TestSuiteRunningSuite.h b/test/include/TestSuite/TestSuiteRunningSuite.h new file mode 100644 index 0000000..e7d4511 --- /dev/null +++ b/test/include/TestSuite/TestSuiteRunningSuite.h @@ -0,0 +1,54 @@ +#ifndef TESTCPP_TESTSUITE_SUITERUN_SUITE_ +#define TESTCPP_TESTSUITE_SUITERUN_SUITE_ + +#include "TestCPP.h" +#include "TestSuiteTests.h" + +namespace TestCPP { + namespace Testing { + namespace TestSuiteSuites { + TestSuite runSuite( + "TestCPP TestSuite Tests - Suite Running", + + make_tuple( + "Suite run test - no tests", + function( + TestSuiteTests::TestSuiteRunNoTests + ) + ), + make_tuple( + "Suite run test - one test", + function( + TestSuiteTests::TestSuiteRunOneTest + ) + ), + make_tuple( + "Suite run test - many tests", + function( + TestSuiteTests::TestSuiteRunManyTests + ) + ), + make_tuple( + "Suite run test - no tests twice", + function( + TestSuiteTests::TestSuiteRunNoTestsTwice + ) + ), + make_tuple( + "Suite run test - one test twice", + function( + TestSuiteTests::TestSuiteRunOneTestTwice + ) + ), + make_tuple( + "Suite run test - many tests twice", + function( + TestSuiteTests::TestSuiteRunManyTestsTwice + ) + ) + ); + } + } +} + +#endif diff --git a/test/include/TestSuite/TestSuiteSuite.h b/test/include/TestSuite/TestSuiteTestPassedMessageSuite.h similarity index 59% rename from test/include/TestSuite/TestSuiteSuite.h rename to test/include/TestSuite/TestSuiteTestPassedMessageSuite.h index 68cef2c..6eab880 100644 --- a/test/include/TestSuite/TestSuiteSuite.h +++ b/test/include/TestSuite/TestSuiteTestPassedMessageSuite.h @@ -1,38 +1,15 @@ -#ifndef TESTCPP_TESTSUITE_SUITE_ -#define TESTCPP_TESTSUITE_SUITE_ +#ifndef TESTCPP_TESTSUITE_TESTPASSEDMESSAGE_SUITE_ +#define TESTCPP_TESTSUITE_TESTPASSEDMESSAGE_SUITE_ +#include "TestCPP.h" #include "TestSuiteTests.h" namespace TestCPP { namespace Testing { - namespace TestSuiteSuite { - TestSuite suite( - "TestCPP TestSuite Tests", + namespace TestSuiteSuites { + TestSuite testPassedMessageSuite( + "TestCPP TestSuite Tests - Test Passed Message enable/disable", - make_tuple( - "Suite construction Test - no tests", - function( - TestSuiteTests::TestConstructSuiteBare - ) - ), - make_tuple( - "Suite construction Test - TestCases", - function( - TestSuiteTests::TestConstructSuiteTestCases - ) - ), - make_tuple( - "Suite construction Test - tuples", - function( - TestSuiteTests::TestConstructSuiteTuples - ) - ), - make_tuple( - "Suite construction Test - mixed", - function( - TestSuiteTests::TestConstructSuiteMixed - ) - ), make_tuple( "Suite enable test passed message - no tests", function( diff --git a/test/include/TestSuite/TestSuiteTests.h b/test/include/TestSuite/TestSuiteTests.h index 878c6a6..655b750 100644 --- a/test/include/TestSuite/TestSuiteTests.h +++ b/test/include/TestSuite/TestSuiteTests.h @@ -8,6 +8,12 @@ namespace TestCPP { void TestConstructSuiteTestCases (); void TestConstructSuiteTuples (); void TestConstructSuiteMixed (); + void TestSuiteRunNoTests (); + void TestSuiteRunOneTest (); + void TestSuiteRunManyTests (); + void TestSuiteRunNoTestsTwice (); + void TestSuiteRunOneTestTwice (); + void TestSuiteRunManyTestsTwice (); void TestEnableTestPassedMessageNoTests (); void TestEnableTestPassedMessageOneTest (); void TestEnableTestPassedMessageManyTests (); diff --git a/test/src/Assertions/BasicAssertionsTests.cpp b/test/src/Assertions/AssertionsBasicTests.cpp similarity index 99% rename from test/src/Assertions/BasicAssertionsTests.cpp rename to test/src/Assertions/AssertionsBasicTests.cpp index 99e3764..82d3f83 100644 --- a/test/src/Assertions/BasicAssertionsTests.cpp +++ b/test/src/Assertions/AssertionsBasicTests.cpp @@ -1,5 +1,5 @@ #include "TestCPP.h" -#include "Assertions/BasicAssertionsTests.h" +#include "Assertions/AssertionsBasicTests.h" namespace TestCPP { namespace Testing { diff --git a/test/src/TestCPPAssertionsMain.cpp b/test/src/TestCPPAssertionsBasicMain.cpp similarity index 77% rename from test/src/TestCPPAssertionsMain.cpp rename to test/src/TestCPPAssertionsBasicMain.cpp index 8016bca..04e7c3b 100644 --- a/test/src/TestCPPAssertionsMain.cpp +++ b/test/src/TestCPPAssertionsBasicMain.cpp @@ -6,7 +6,7 @@ using std::string; using std::make_tuple; using std::function; -#include "Assertions/AssertionsSuites.h" +#include "Assertions/AssertionsBasicSuite.h" int main(void) { @@ -17,10 +17,7 @@ int main(void) getLastRunFailCount() ); - int allSuitesFailCount = 0; - allSuitesFailCount += basicSuiteFailCount; - - return allSuitesFailCount; + return basicSuiteFailCount; } catch (std::exception& e) { std::cerr << "Test suite run failed with an exception: " diff --git a/test/src/TestCPPTestSuiteConstructionMain.cpp b/test/src/TestCPPTestSuiteConstructionMain.cpp new file mode 100644 index 0000000..2d39584 --- /dev/null +++ b/test/src/TestCPPTestSuiteConstructionMain.cpp @@ -0,0 +1,25 @@ +#include "TestCPP.h" + +using TestCPP::TestCase; +using TestCPP::TestSuite; +using std::string; +using std::make_tuple; +using std::function; + +#include "TestSuite/TestSuiteConstructionSuite.h" + +int main(void) +{ + try { + TestCPP::Testing::TestSuiteSuites::ctorSuite.run(); + return TestCPP::Util::unsignedToSigned( + TestCPP::Testing::TestSuiteSuites::ctorSuite. + getLastRunFailCount() + ); + } + catch (std::exception& e) { + std::cerr << "Test suite run failed with an exception: " + << e.what() << std::endl; + return -1; + } +} diff --git a/test/src/TestCPPTestSuiteMain.cpp b/test/src/TestCPPTestSuiteRunningMain.cpp similarity index 73% rename from test/src/TestCPPTestSuiteMain.cpp rename to test/src/TestCPPTestSuiteRunningMain.cpp index 8cb0f8a..73b3e70 100644 --- a/test/src/TestCPPTestSuiteMain.cpp +++ b/test/src/TestCPPTestSuiteRunningMain.cpp @@ -6,14 +6,14 @@ using std::string; using std::make_tuple; using std::function; -#include "TestSuite/TestSuiteSuite.h" +#include "TestSuite/TestSuiteRunningSuite.h" int main(void) { try { - TestCPP::Testing::TestSuiteSuite::suite.run(); + TestCPP::Testing::TestSuiteSuites::runSuite.run(); return TestCPP::Util::unsignedToSigned( - TestCPP::Testing::TestSuiteSuite::suite. + TestCPP::Testing::TestSuiteSuites::runSuite. getLastRunFailCount() ); } diff --git a/test/src/TestCPPTestSuiteTestPassedMessageMain.cpp b/test/src/TestCPPTestSuiteTestPassedMessageMain.cpp new file mode 100644 index 0000000..c5390ab --- /dev/null +++ b/test/src/TestCPPTestSuiteTestPassedMessageMain.cpp @@ -0,0 +1,25 @@ +#include "TestCPP.h" + +using TestCPP::TestCase; +using TestCPP::TestSuite; +using std::string; +using std::make_tuple; +using std::function; + +#include "TestSuite/TestSuiteTestPassedMessageSuite.h" + +int main(void) +{ + try { + TestCPP::Testing::TestSuiteSuites::testPassedMessageSuite.run(); + return TestCPP::Util::unsignedToSigned( + TestCPP::Testing::TestSuiteSuites::testPassedMessageSuite. + getLastRunFailCount() + ); + } + catch (std::exception& e) { + std::cerr << "Test suite run failed with an exception: " + << e.what() << std::endl; + return -1; + } +} diff --git a/test/src/TestSuite/TestSuiteConstructionTests.cpp b/test/src/TestSuite/TestSuiteConstructionTests.cpp new file mode 100644 index 0000000..0b4051e --- /dev/null +++ b/test/src/TestSuite/TestSuiteConstructionTests.cpp @@ -0,0 +1,94 @@ +#include "TestCPP.h" +#include "TestSuite/TestSuiteTests.h" + +namespace TestCPP { + namespace Testing { + namespace TestSuiteTests { + void TestConstructSuiteBare () { + auto testSuite = unique_ptr(new TestSuite( + "Suite construction - bare" + )); + } + + void TestConstructSuiteTestCases () { + TestCase test1("dummy 1", [](){}), + test2("dummy 2", [](){}); + + auto testSuite = unique_ptr(new TestSuite( + "Suite construction - TestCases", + test1 + )); + testSuite = unique_ptr(new TestSuite( + "Suite construction - TestCases", + test1, test2 + )); + } + + void TestConstructSuiteTuples () { + auto testSuite = unique_ptr(new TestSuite( + "Suite construction - tuples", + make_tuple("dummy 1", function([](){})) + )); + testSuite = unique_ptr(new TestSuite( + "Suite construction - tuples", + make_tuple("dummy 1", function([](){})), + make_tuple("dummy 2", function([](){})) + )); + } + + void TestConstructSuiteMixed () { + TestCase test1("dummy 1", [](){}), + test2("dummy 2", [](){}); + auto testSuite = unique_ptr(new TestSuite( + "Suite construction - mixed", + test1, + make_tuple("dummy 1", function([](){})) + )); + testSuite = unique_ptr(new TestSuite( + "Suite construction - mixed", + test1, test2, + make_tuple("dummy 1", function([](){})) + )); + testSuite = unique_ptr(new TestSuite( + "Suite construction - mixed", + test1, + make_tuple("dummy 1", function([](){})), + make_tuple("dummy 2", function([](){})) + )); + testSuite = unique_ptr(new TestSuite( + "Suite construction - mixed", + test1, test2, + make_tuple("dummy 1", function([](){})), + make_tuple("dummy 2", function([](){})) + )); + testSuite = unique_ptr(new TestSuite( + "Suite construction - mixed", + test1, + make_tuple("dummy 1", function([](){})), + make_tuple("dummy 2", function([](){})), + test2 + )); + testSuite = unique_ptr(new TestSuite( + "Suite construction - mixed", + make_tuple("dummy 1", function([](){})), + test1, test2, + make_tuple("dummy 2", function([](){})) + )); + testSuite = unique_ptr(new TestSuite( + "Suite construction - mixed", + test1, + make_tuple("dummy 1", function([](){})), + test2, + make_tuple("dummy 2", function([](){})) + )); + testSuite = unique_ptr(new TestSuite( + "Suite construction - mixed", + make_tuple("dummy 1", function([](){})), + test2, + make_tuple("dummy 2", function([](){})), + test1 + )); + } + } + } +} diff --git a/test/src/TestSuite/TestSuiteRunningTests.cpp b/test/src/TestSuite/TestSuiteRunningTests.cpp new file mode 100644 index 0000000..986961a --- /dev/null +++ b/test/src/TestSuite/TestSuiteRunningTests.cpp @@ -0,0 +1,114 @@ +#include "TestCPP.h" +#include "TestSuite/TestSuiteTests.h" + +namespace TestCPP { + namespace Testing { + namespace TestSuiteTests { + unsigned zero = 0; + unsigned one = 1; + unsigned three = 3; + + void TestSuiteRunNoTests() { + auto testSuite = unique_ptr(new TestSuite( + "Suite run - no tests" + )); + + testSuite->run(); + Assertions::assertEquals(zero, + testSuite->getLastRunFailCount()); + Assertions::assertEquals(zero, + testSuite->getLastRunSuccessCount()); + } + void TestSuiteRunOneTest() { + TestCase test1("dummy 1", []() {}); + + auto testSuite = unique_ptr(new TestSuite( + "Suite run - one test", + test1 + )); + + testSuite->run(); + Assertions::assertEquals(zero, + testSuite->getLastRunFailCount()); + Assertions::assertEquals(one, + testSuite->getLastRunSuccessCount()); + } + void TestSuiteRunManyTests() { + TestCase test1("dummy 1", []() {}), + test2("dummy 2", []() {}), + test3("dummy 3", []() {}); + + auto testSuite = unique_ptr(new TestSuite( + "Suite run - many tests", + test1, test2, test3 + )); + + testSuite->run(); + Assertions::assertEquals(zero, + testSuite->getLastRunFailCount()); + Assertions::assertEquals(three, + testSuite->getLastRunSuccessCount()); + } + + void TestSuiteRunNoTestsTwice() { + auto testSuite = unique_ptr(new TestSuite( + "Suite double run - no tests" + )); + + testSuite->run(); + Assertions::assertEquals(zero, + testSuite->getLastRunFailCount()); + Assertions::assertEquals(zero, + testSuite->getLastRunSuccessCount()); + + testSuite->run(); + Assertions::assertEquals(zero, + testSuite->getLastRunFailCount()); + Assertions::assertEquals(zero, + testSuite->getLastRunSuccessCount()); + } + void TestSuiteRunOneTestTwice() { + TestCase test1("dummy 1", []() {}); + + auto testSuite = unique_ptr(new TestSuite( + "Suite double run - one test", + test1 + )); + + testSuite->run(); + Assertions::assertEquals(zero, + testSuite->getLastRunFailCount()); + Assertions::assertEquals(one, + testSuite->getLastRunSuccessCount()); + + testSuite->run(); + Assertions::assertEquals(zero, + testSuite->getLastRunFailCount()); + Assertions::assertEquals(one, + testSuite->getLastRunSuccessCount()); + } + void TestSuiteRunManyTestsTwice() { + TestCase test1("dummy 1", []() {}), + test2("dummy 2", []() {}), + test3("dummy 3", []() {}); + + auto testSuite = unique_ptr(new TestSuite( + "Suite double run - many tests", + test1, test2, test3 + )); + + testSuite->run(); + Assertions::assertEquals(zero, + testSuite->getLastRunFailCount()); + Assertions::assertEquals(three, + testSuite->getLastRunSuccessCount()); + + testSuite->run(); + Assertions::assertEquals(zero, + testSuite->getLastRunFailCount()); + Assertions::assertEquals(three, + testSuite->getLastRunSuccessCount()); + } + } + } +} diff --git a/test/src/TestSuite/TestSuiteTests.cpp b/test/src/TestSuite/TestSuiteTestPassedMessageTests.cpp similarity index 80% rename from test/src/TestSuite/TestSuiteTests.cpp rename to test/src/TestSuite/TestSuiteTestPassedMessageTests.cpp index 52189a1..57615a3 100644 --- a/test/src/TestSuite/TestSuiteTests.cpp +++ b/test/src/TestSuite/TestSuiteTestPassedMessageTests.cpp @@ -4,89 +4,6 @@ namespace TestCPP { namespace Testing { namespace TestSuiteTests { - void TestConstructSuiteBare () { - auto testSuite = unique_ptr(new TestSuite( - "Suite construction - bare" - )); - } - void TestConstructSuiteTestCases () { - TestCase test1("dummy 1", [](){}), - test2("dummy 2", [](){}); - - auto testSuite = unique_ptr(new TestSuite( - "Suite construction - TestCases", - test1 - )); - testSuite = unique_ptr(new TestSuite( - "Suite construction - TestCases", - test1, test2 - )); - } - void TestConstructSuiteTuples () { - auto testSuite = unique_ptr(new TestSuite( - "Suite construction - tuples", - make_tuple("dummy 1", function([](){})) - )); - testSuite = unique_ptr(new TestSuite( - "Suite construction - tuples", - make_tuple("dummy 1", function([](){})), - make_tuple("dummy 2", function([](){})) - )); - } - void TestConstructSuiteMixed () { - TestCase test1("dummy 1", [](){}), - test2("dummy 2", [](){}); - auto testSuite = unique_ptr(new TestSuite( - "Suite construction - mixed", - test1, - make_tuple("dummy 1", function([](){})) - )); - testSuite = unique_ptr(new TestSuite( - "Suite construction - mixed", - test1, test2, - make_tuple("dummy 1", function([](){})) - )); - testSuite = unique_ptr(new TestSuite( - "Suite construction - mixed", - test1, - make_tuple("dummy 1", function([](){})), - make_tuple("dummy 2", function([](){})) - )); - testSuite = unique_ptr(new TestSuite( - "Suite construction - mixed", - test1, test2, - make_tuple("dummy 1", function([](){})), - make_tuple("dummy 2", function([](){})) - )); - testSuite = unique_ptr(new TestSuite( - "Suite construction - mixed", - test1, - make_tuple("dummy 1", function([](){})), - make_tuple("dummy 2", function([](){})), - test2 - )); - testSuite = unique_ptr(new TestSuite( - "Suite construction - mixed", - make_tuple("dummy 1", function([](){})), - test1, test2, - make_tuple("dummy 2", function([](){})) - )); - testSuite = unique_ptr(new TestSuite( - "Suite construction - mixed", - test1, - make_tuple("dummy 1", function([](){})), - test2, - make_tuple("dummy 2", function([](){})) - )); - testSuite = unique_ptr(new TestSuite( - "Suite construction - mixed", - make_tuple("dummy 1", function([](){})), - test2, - make_tuple("dummy 2", function([](){})), - test1 - )); - } - void TestEnableTestPassedMessageNoTests() { auto testSuite = unique_ptr(new TestSuite( "SUBSUITE - Test Passed Message Enabled - no tests"