Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b0984d6
Fix catching the object by value.
eljonny May 2, 2024
1525053
Fix catching the object by value.
eljonny May 2, 2024
4e6cf83
Hopefully this will fix the permissions issue.
eljonny May 2, 2024
294d398
Merge branch 'fix-cppcheck-catchexceptionbyvalue' of github.com:eljon…
eljonny May 2, 2024
5d3b582
Reverting the previous change, there was just a permission issue in the
eljonny May 2, 2024
e1972ea
Change TestCaseName to TestObjName, extract strings
eljonny May 3, 2024
432af2c
TestObjName does not allow construction with std::string
eljonny May 3, 2024
b7ed12a
Major refactor and API change
eljonny May 13, 2024
59ea694
Refactoring, new Assertions-specific test suite
eljonny May 13, 2024
caa1d05
Test coverage to get patch coverage up for the PR. Refactoring.
eljonny May 13, 2024
039a7e3
Version bump to 1.0.0. New test target. Install new internal headers.
eljonny May 13, 2024
1232cd4
Restructure and add to the CodeLite project.
eljonny May 13, 2024
0020270
Fix PRIVATE_HEADER property
eljonny May 13, 2024
651c2e4
Remove unnecessary include. Add necessary include.
eljonny May 13, 2024
c736989
Accidentally moved TestCaseTests.cpp to the wrong virtual directory
eljonny May 13, 2024
e0c3e6e
Let's try this again. Fix Assertions includes and add std usings.
eljonny May 13, 2024
b3e147d
Move the operator<< definition to the source file.
eljonny May 13, 2024
e871d72
Forgot to include ostream.
eljonny May 13, 2024
4535c33
This include should have been conditional.
eljonny May 13, 2024
268dc81
Fix clang error -wunused-lambda-capture
eljonny May 13, 2024
a8b5ef0
Workaround for MSVC error C3493
eljonny May 13, 2024
426adcd
Cleanup, TC member initialization, TC capture bools, fix message bug
eljonny Jun 22, 2024
700e235
Expand TestSuite test suite
eljonny Jun 22, 2024
316e501
Remove excess whitespace, add/fix/flesh-out docs, fix private API.
eljonny Jun 23, 2024
ef8dd17
Finish removing reliance on the parameter
eljonny Jun 23, 2024
4424d63
Remove unused function
eljonny Jun 23, 2024
cbcb133
Fix multiple frees on streams, make sure test failures aren't silenced
eljonny Jun 27, 2024
62e8525
Clean up how test failures in a suite are recorded; Fixed failing tests
eljonny Jun 27, 2024
4c57775
Another windows-only segfault
eljonny Jun 27, 2024
aee6136
Windows segfault - deeper debug logging
eljonny Jun 27, 2024
ad69700
Windows segfault debugging - remove some dbg logging, add deeper logging
eljonny Jun 28, 2024
4f337a1
Fixed a bug where cout buffer was being used instead of clog and cerr
eljonny Jun 28, 2024
b408120
It looks like that bug fix fixed the windows segfault in the TC tests
eljonny Jun 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.16)
set (PROJECT_NAME "TestCPP")
set (PROJECT_GROUP_NAME "cpptesting")

project (${PROJECT_NAME} VERSION 0.2.1 LANGUAGES CXX)
project (${PROJECT_NAME} VERSION 1.0.0 LANGUAGES CXX)

set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
22 changes: 20 additions & 2 deletions TestFramework.project
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@
<Description/>
<Dependencies/>
<VirtualDirectory Name="src">
<File Name="src/TestCPP.cpp"/>
<File Name="src/TestCPPUtil.cpp"/>
<File Name="src/TestCPPAssertions.cpp"/>
<File Name="src/TestCPPExceptions.cpp"/>
<File Name="src/TestCPPTestCase.cpp"/>
<File Name="src/TestCPPTestSuite.cpp"/>
</VirtualDirectory>
<VirtualDirectory Name="include">
<File Name="include/TestCPPUtil.h"/>
<File Name="include/TestCPP.h"/>
<VirtualDirectory Name="internal">
<File Name="include/internal/TestCPPAssertions.h"/>
<File Name="include/internal/TestCPPUtil.h"/>
<File Name="include/internal/TestCPPTestSuite.h"/>
<File Name="include/internal/TestCPPTestCase.h"/>
<File Name="include/internal/TestCPPExceptions.h"/>
<File Name="include/internal/TestCPPCommon.h"/>
</VirtualDirectory>
</VirtualDirectory>
<VirtualDirectory Name="git">
<File Name=".gitignore"/>
Expand Down Expand Up @@ -48,6 +58,10 @@
<VirtualDirectory Name="TestSuite">
<File Name="test/src/TestSuite/TestSuiteTests.cpp"/>
</VirtualDirectory>
<VirtualDirectory Name="Assertions">
<File Name="test/src/Assertions/AssertionsTests.cpp"/>
</VirtualDirectory>
<File Name="test/src/TestCPPAssertionsMain.cpp"/>
</VirtualDirectory>
<VirtualDirectory Name="include">
<VirtualDirectory Name="TestCase">
Expand All @@ -59,6 +73,10 @@
<File Name="test/include/TestSuite/TestSuiteSuite.h"/>
<File Name="test/include/TestSuite/TestSuiteTests.h"/>
</VirtualDirectory>
<VirtualDirectory Name="Assertions">
<File Name="test/include/Assertions/AssertionsSuite.h"/>
<File Name="test/include/Assertions/AssertionsTests.h"/>
</VirtualDirectory>
</VirtualDirectory>
</VirtualDirectory>
<VirtualDirectory Name="github">
Expand Down
55 changes: 47 additions & 8 deletions cmake/BuildTypeHandling.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,31 @@ endif ()
list (
APPEND
GCC_CLANG_RELEASE_BUILD_OPTS
-O3 # Optimize the Release build
-Wall # Enable most warnings
-Wextra # Enable even more warnings
-Wpedantic # Enable most of the rest of the warnings
-Werror # Treat all warnings as errors
-Wno-unused-parameter # Unused parameters occur in the Release
# build in debugLog
-O3 # Optimize the Release build
-Wall # Enable most warnings
-Wextra # Enable even more warnings
-Wpedantic # Enable most of the rest of the warnings
-Werror # Treat all warnings as errors
-Wno-unused-parameter # Unused parameters occur in the Release
# build in debugLog
-Wno-unused-lambda-capture # Avoid MSVC error C3493 - There is
# implementation divergence here and
# since we're not using >=C++14 there
# is no workaround other than to ignore
# this warning (the MSVC issue is an
# error). A workaround for >=C++14 is to
# use an explicit capture - if ever I
# change the library to use >=C++14 I
# can remove this and use an explicit
# capture.
)
list (
APPEND
GCC_CLANG_DEBUG_BUILD_OPTS
-g # Enable all debugging information
-Og # Ensure the compiler doesn't use optimizations that would harm
# debuggability of the resulting code
-Wall -Wextra -Wpedantic -Werror
-Wall -Wextra -Wpedantic -Werror -Wno-unused-lambda-capture
)
list (
APPEND
Expand Down Expand Up @@ -135,6 +145,12 @@ if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
PUBLIC
${MSVC_RELEASE_BUILD_OPTS}
)

target_compile_options (
${PROJECT_NAME}_Assertions_test
PUBLIC
${MSVC_RELEASE_BUILD_OPTS}
)
endif ()

else ()
Expand Down Expand Up @@ -164,6 +180,12 @@ if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
PUBLIC
${GCC_CLANG_RELEASE_BUILD_OPTS}
)

target_compile_options (
${PROJECT_NAME}_Assertions_test
PUBLIC
${GCC_CLANG_RELEASE_BUILD_OPTS}
)
endif ()
endif ()

Expand Down Expand Up @@ -195,6 +217,11 @@ else ()
PUBLIC
DEBUG_LOG
)
target_compile_definitions (
${PROJECT_NAME}_Assertions_test
PUBLIC
DEBUG_LOG
)
endif ()

if (MSVC)
Expand Down Expand Up @@ -224,6 +251,12 @@ else ()
PUBLIC
${MSVC_DEBUG_BUILD_OPTS}
)

target_compile_options (
${PROJECT_NAME}_Assertions_test
PUBLIC
${MSVC_DEBUG_BUILD_OPTS}
)
endif ()

else ()
Expand Down Expand Up @@ -256,6 +289,12 @@ else ()
${COVERAGE_BUILD_OPTS}
)

target_compile_options (
${PROJECT_NAME}_Assertions_test
PUBLIC
${COVERAGE_BUILD_OPTS}
)

else ()
target_compile_options (
${PROJECT_NAME}
Expand Down
6 changes: 6 additions & 0 deletions cmake/Includes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@ if (BUILD_TESTING)
test/include
include
)

target_include_directories (
${PROJECT_NAME}_Assertions_test PRIVATE
test/include
include
)
endif ()
27 changes: 26 additions & 1 deletion cmake/Installing.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
list (
APPEND
TESTCPP_PUBLIC_HEADERS
include/TestCPP.h
)

list (
APPEND
TESTCPP_PRIVATE_HEADERS
include/internal/TestCPPAssertions.h
include/internal/TestCPPCommon.h
include/internal/TestCPPExceptions.h
include/internal/TestCPPTestCase.h
include/internal/TestCPPTestSuite.h
include/internal/TestCPPUtil.h
)

set_target_properties (
${PROJECT_NAME}
PROPERTIES
PUBLIC_HEADER
include/TestCPP.h
"${TESTCPP_PUBLIC_HEADERS}"
)
set_target_properties (
${PROJECT_NAME}
PROPERTIES
PRIVATE_HEADER
"${TESTCPP_PRIVATE_HEADERS}"
)
include (GNUInstallDirs)
install (
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
PRIVATE_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/internal
)
export (
EXPORT ${PROJECT_NAME}Targets
Expand Down
33 changes: 33 additions & 0 deletions cmake/Linking.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ if (BUILD_TESTING)
ole32
dbgeng
)
target_link_libraries (
${PROJECT_NAME}_Assertions_test
${PROJECT_NAME}
gcov
ole32
dbgeng
)

elseif (${TESTCPP_STACKTRACE_ENABLED})
target_link_libraries (
Expand All @@ -60,6 +67,12 @@ if (BUILD_TESTING)
gcov
dl
)
target_link_libraries (
${PROJECT_NAME}_Assertions_test
${PROJECT_NAME}
gcov
dl
)

else ()
target_link_libraries (
Expand All @@ -72,6 +85,11 @@ if (BUILD_TESTING)
${PROJECT_NAME}
gcov
)
target_link_libraries (
${PROJECT_NAME}_Assertions_test
${PROJECT_NAME}
gcov
)
endif ()

else ()
Expand All @@ -88,6 +106,12 @@ if (BUILD_TESTING)
ole32
dbgeng
)
target_link_libraries (
${PROJECT_NAME}_Assertions_test
${PROJECT_NAME}
ole32
dbgeng
)

elseif (${TESTCPP_STACKTRACE_ENABLED})
target_link_libraries (
Expand All @@ -100,6 +124,11 @@ if (BUILD_TESTING)
${PROJECT_NAME}
dl
)
target_link_libraries (
${PROJECT_NAME}_Assertions_test
${PROJECT_NAME}
dl
)

else ()
target_link_libraries (
Expand All @@ -110,6 +139,10 @@ if (BUILD_TESTING)
${PROJECT_NAME}_TestSuite_test
${PROJECT_NAME}
)
target_link_libraries (
${PROJECT_NAME}_Assertions_test
${PROJECT_NAME}
)
endif ()
endif ()
endif ()
11 changes: 10 additions & 1 deletion cmake/Targets.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
add_library (
${PROJECT_NAME}
src/TestCPPAssertions.cpp
src/TestCPPExceptions.cpp
src/TestCPPTestCase.cpp
src/TestCPPTestSuite.cpp
src/TestCPPUtil.cpp
src/TestCPP.cpp
)
add_library (
${PROJECT_GROUP_NAME}::${PROJECT_NAME}
Expand Down Expand Up @@ -30,4 +33,10 @@ if (BUILD_TESTING)
test/src/TestSuite/TestSuiteTests.cpp
test/src/TestCPPTestSuiteMain.cpp
)

add_executable (
${PROJECT_NAME}_Assertions_test
test/src/Assertions/AssertionsTests.cpp
test/src/TestCPPAssertionsMain.cpp
)
endif ()
5 changes: 5 additions & 0 deletions cmake/Testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ if (BUILD_TESTING)
NAME ${PROJECT_NAME}TestSuiteTests
COMMAND ${PROJECT_NAME}_TestSuite_test
)

add_test (
NAME ${PROJECT_NAME}AssertionsTests
COMMAND ${PROJECT_NAME}_Assertions_test
)
endif ()
3 changes: 1 addition & 2 deletions demo/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "TestCPP.h"
#include "TestCPPUtil.h"

using TestCPP::TestSuite;
using std::string;
Expand All @@ -12,7 +11,7 @@ int main(void)
{
try {
TestSuite suite(
string("Demo Test Suite"),
"Demo Test Suite",

make_tuple(
"simpleTest",
Expand Down
7 changes: 5 additions & 2 deletions demo/src/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ namespace TestCPP {
void simpleTest () {
int lower = 5;
int higher = 9;
TestSuite::assertTrue(higher > lower, "Something is seriously wrong.");
Assertions::assertTrue(
higher > lower,
"Something is seriously wrong."
);
}

void otherSimpleTest () {
string s1 = string("A string");
string s2 = string("another string");
TestSuite::assertNotEquals(s1, s2);
Assertions::assertNotEquals(s1, s2);
}
}
}
Expand Down
Loading