Skip to content

Commit

Permalink
WIP: Organize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thetic committed Nov 20, 2022
1 parent d2325e5 commit 1bedf47
Show file tree
Hide file tree
Showing 87 changed files with 311 additions and 2,085 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Expand Up @@ -152,10 +152,6 @@ target_compile_definitions(${CppUTestLibName}
HAVE_CONFIG_H
)

if (CPPUTEST_BUILD_TESTING)
add_subdirectory(tests)
endif ()

if (CPPUTEST_EXAMPLES)
add_subdirectory(examples)
endif()
Expand Down
4 changes: 4 additions & 0 deletions CppUTest/CMakeLists.txt
Expand Up @@ -98,6 +98,10 @@ if(NOT CPPUTEST_MEM_LEAK_DETECTION_DISABLED)
)
endif()

if(CPPUTEST_BUILD_TESTING)
add_subdirectory(tests)
endif()

# Installation
if(PROJECT_IS_TOP_LEVEL)
install(
Expand Down
74 changes: 74 additions & 0 deletions CppUTest/tests/CMakeLists.txt
@@ -0,0 +1,74 @@
add_executable(CppUTestTests
src/AllTests.cpp
src/SetPluginTest.cpp
src/CheatSheetTest.cpp
src/SimpleStringTest.cpp
src/SimpleStringCacheTest.cpp
src/CompatabilityTests.cpp
src/CommandLineArgumentsTest.cpp
src/TestFailureTest.cpp
src/TestFailureNaNTest.cpp
src/CommandLineTestRunnerTest.cpp
src/TestFilterTest.cpp
src/TestHarness_cTest.cpp
src/JUnitOutputTest.cpp
src/TestHarness_cTestCFile.c
src/DummyMemoryLeakDetector.cpp
src/MemoryLeakDetectorTest.cpp
src/TestInstallerTest.cpp
src/AllocLetTestFree.c
src/MemoryOperatorOverloadTest.cpp
src/TestMemoryAllocatorTest.cpp
src/MemoryLeakWarningTest.cpp
src/TestOutputTest.cpp
src/AllocLetTestFreeTest.cpp
src/TestRegistryTest.cpp
src/AllocationInCFile.c
src/PluginTest.cpp
src/TestResultTest.cpp
src/PreprocessorTest.cpp
src/TestUTestMacro.cpp
src/TestUTestStringMacro.cpp
src/AllocationInCppFile.cpp
src/UtestTest.cpp
src/SimpleMutexTest.cpp
src/UtestPlatformTest.cpp
src/TeamCityOutputTest.cpp
)

if(CPPUTEST_STD_C_LIB_DISABLED)
add_library(DummyUTestPlatform INTERFACE)
target_sources(DummyUTestPlatform
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/DummyUTestPlatform/DummyUTestPlatform.cpp
)
target_link_libraries(CppUTestTests PRIVATE DummyUTestPlatform)
endif()

target_include_directories(CppUTestTests
PRIVATE include
)

if(MINGW OR (${CMAKE_HOST_SYSTEM_NAME} MATCHES "OpenBSD"))
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
if(CMAKE_USE_PTHREADS_INIT)
target_link_libraries(CppUTestTests PRIVATE Threads::Threads)
endif()
endif()

target_link_libraries(CppUTestTests PRIVATE ${CppUTestLibName})

if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.13")
target_link_options(CppUTestTests
PRIVATE
$<$<CXX_COMPILER_ID:GNU,Clang>:LINKER:-Map=$<TARGET_FILE:CppUTestTests>.map>
"$<$<CXX_COMPILER_ID:MSVC>:/MAP>"
$<$<CXX_COMPILER_ID:IAR>:"SHELL:--map $<TARGET_FILE:CppUTestTests>.map">
)
endif()

if(CPPUTEST_TEST_DISCOVERY)
include(CppUTest)
cpputest_discover_tests(CppUTestTests)
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions CppUTestExt/CMakeLists.txt
Expand Up @@ -48,6 +48,10 @@ target_include_directories(${CppUTestExtLibName}

add_library(CppUTest::CppUTestExt ALIAS ${CppUTestExtLibName})

if(CPPUTEST_BUILD_TESTING)
add_subdirectory(tests)
endif()

if(PROJECT_IS_TOP_LEVEL)
install(
TARGETS ${CppUTestExtLibName}
Expand Down
68 changes: 68 additions & 0 deletions CppUTestExt/tests/CMakeLists.txt
@@ -0,0 +1,68 @@
add_executable(CppUTestExtTests
src/AllTests.cpp
src/CodeMemoryReporterTest.cpp
src/GMockTest.cpp
src/GTest1Test.cpp
src/IEEE754PluginTest.cpp
src/IEEE754PluginTest_c.c
src/MemoryReportAllocatorTest.cpp
src/MemoryReporterPluginTest.cpp
src/MemoryReportFormatterTest.cpp
src/MockActualCallTest.cpp
src/MockCheatSheetTest.cpp
src/MockCallTest.cpp
src/MockComparatorCopierTest.cpp
src/MockExpectedCallTest.cpp
src/ExpectedFunctionsListTest.cpp
src/MockFailureReporterForTest.cpp
src/MockFailureTest.cpp
src/MockHierarchyTest.cpp
src/MockNamedValueTest.cpp
src/MockParameterTest.cpp
src/MockPluginTest.cpp
src/MockSupportTest.cpp
src/MockSupport_cTestCFile.c
src/MockSupport_cTest.cpp
src/MockStrictOrderTest.cpp
src/MockReturnValueTest.cpp
src/OrderedTestTest_c.c
src/OrderedTestTest.cpp
)

if(CPPUTEST_STD_C_LIB_DISABLED)
target_link_libraries(CppUTestExtTests PRIVATE DummyUTestPlatform)
endif()

target_include_directories(CppUTestExtTests
PRIVATE include
)

if(MINGW)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
if(CMAKE_USE_PTHREADS_INIT)
target_link_libraries(CppUTestExtTests PRIVATE Threads::Threads)
endif()
endif()

target_link_libraries(CppUTestExtTests
PRIVATE
${CppUTestLibName}
${CppUTestExtLibName}
)

if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.13")
target_link_options(CppUTestExtTests
PRIVATE
$<$<CXX_COMPILER_ID:GNU,Clang>:LINKER:-Map=$<TARGET_FILE:CppUTestExtTests>.map>
"$<$<CXX_COMPILER_ID:MSVC>:/MAP>"
$<$<CXX_COMPILER_ID:IAR>:"SHELL:--map $<TARGET_FILE:CppUTestExtTests>.map">
)
endif()

if(CPPUTEST_TEST_DISCOVERY)
include(CppUTest)
cpputest_discover_tests(CppUTestExtTests
DETAILED FALSE
)
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
132 changes: 66 additions & 66 deletions Makefile.am
Expand Up @@ -156,41 +156,41 @@ CppUTestTests_LDADD = lib/libCppUTest.a $(CPPUTEST_LDADD)
CppUTestTests_LDFLAGS = $(AM_LDFLAGS) $(CPPUTEST_LDFLAGS) $(CPPUTEST_ADDITIONAL_LDFLAGS)

CppUTestTests_SOURCES = \
tests/CppUTest/AllocationInCFile.c \
tests/CppUTest/AllocationInCppFile.cpp \
tests/CppUTest/AllocLetTestFree.c \
tests/CppUTest/AllocLetTestFreeTest.cpp \
tests/CppUTest/AllTests.cpp \
tests/CppUTest/CheatSheetTest.cpp \
tests/CppUTest/CompatabilityTests.cpp \
tests/CppUTest/CommandLineArgumentsTest.cpp \
tests/CppUTest/CommandLineTestRunnerTest.cpp \
tests/CppUTest/DummyMemoryLeakDetector.cpp \
tests/CppUTest/JUnitOutputTest.cpp \
tests/CppUTest/MemoryLeakDetectorTest.cpp \
tests/CppUTest/MemoryOperatorOverloadTest.cpp \
tests/CppUTest/MemoryLeakWarningTest.cpp \
tests/CppUTest/PluginTest.cpp \
tests/CppUTest/PreprocessorTest.cpp \
tests/CppUTest/SetPluginTest.cpp \
tests/CppUTest/SimpleStringTest.cpp \
tests/CppUTest/SimpleStringCacheTest.cpp \
tests/CppUTest/SimpleMutexTest.cpp \
tests/CppUTest/TeamCityOutputTest.cpp \
tests/CppUTest/TestFailureNaNTest.cpp \
tests/CppUTest/TestFailureTest.cpp \
tests/CppUTest/TestFilterTest.cpp \
tests/CppUTest/TestHarness_cTest.cpp \
tests/CppUTest/TestHarness_cTestCFile.c \
tests/CppUTest/TestInstallerTest.cpp \
tests/CppUTest/TestMemoryAllocatorTest.cpp \
tests/CppUTest/TestOutputTest.cpp \
tests/CppUTest/TestRegistryTest.cpp \
tests/CppUTest/TestResultTest.cpp \
tests/CppUTest/TestUTestMacro.cpp \
tests/CppUTest/TestUTestStringMacro.cpp \
tests/CppUTest/UtestTest.cpp \
tests/CppUTest/UtestPlatformTest.cpp
CppUTest/tests/src/AllocationInCFile.c \
CppUTest/tests/src/AllocationInCppFile.cpp \
CppUTest/tests/src/AllocLetTestFree.c \
CppUTest/tests/src/AllocLetTestFreeTest.cpp \
CppUTest/tests/src/AllTests.cpp \
CppUTest/tests/src/CheatSheetTest.cpp \
CppUTest/tests/src/CompatabilityTests.cpp \
CppUTest/tests/src/CommandLineArgumentsTest.cpp \
CppUTest/tests/src/CommandLineTestRunnerTest.cpp \
CppUTest/tests/src/DummyMemoryLeakDetector.cpp \
CppUTest/tests/src/JUnitOutputTest.cpp \
CppUTest/tests/src/MemoryLeakDetectorTest.cpp \
CppUTest/tests/src/MemoryOperatorOverloadTest.cpp \
CppUTest/tests/src/MemoryLeakWarningTest.cpp \
CppUTest/tests/src/PluginTest.cpp \
CppUTest/tests/src/PreprocessorTest.cpp \
CppUTest/tests/src/SetPluginTest.cpp \
CppUTest/tests/src/SimpleStringTest.cpp \
CppUTest/tests/src/SimpleStringCacheTest.cpp \
CppUTest/tests/src/SimpleMutexTest.cpp \
CppUTest/tests/src/TeamCityOutputTest.cpp \
CppUTest/tests/src/TestFailureNaNTest.cpp \
CppUTest/tests/src/TestFailureTest.cpp \
CppUTest/tests/src/TestFilterTest.cpp \
CppUTest/tests/src/TestHarness_cTest.cpp \
CppUTest/tests/src/TestHarness_cTestCFile.c \
CppUTest/tests/src/TestInstallerTest.cpp \
CppUTest/tests/src/TestMemoryAllocatorTest.cpp \
CppUTest/tests/src/TestOutputTest.cpp \
CppUTest/tests/src/TestRegistryTest.cpp \
CppUTest/tests/src/TestResultTest.cpp \
CppUTest/tests/src/TestUTestMacro.cpp \
CppUTest/tests/src/TestUTestStringMacro.cpp \
CppUTest/tests/src/UtestTest.cpp \
CppUTest/tests/src/UtestPlatformTest.cpp

CppUTestExtTests_CPPFLAGS = $(lib_libCppUTestExt_a_CPPFLAGS)
CppUTestExtTests_CFLAGS = $(lib_libCppUTestExt_a_CFLAGS)
Expand All @@ -199,36 +199,36 @@ CppUTestExtTests_LDADD = lib/libCppUTestExt.a lib/libCppUTest.a $(CPPUTEST_LDADD
CppUTestExtTests_LDFLAGS = $(CppUTestTests_LDFLAGS)

CppUTestExtTests_SOURCES = \
tests/CppUTestExt/AllTests.cpp \
tests/CppUTestExt/CodeMemoryReporterTest.cpp \
tests/CppUTestExt/GMockTest.cpp \
tests/CppUTestExt/GTest1Test.cpp \
tests/CppUTestExt/GTest2ConvertorTest.cpp \
tests/CppUTestExt/IEEE754PluginTest.cpp \
tests/CppUTestExt/IEEE754PluginTest_c.c \
tests/CppUTestExt/MemoryReportAllocatorTest.cpp \
tests/CppUTestExt/MemoryReporterPluginTest.cpp \
tests/CppUTestExt/MemoryReportFormatterTest.cpp \
tests/CppUTestExt/MockActualCallTest.cpp \
tests/CppUTestExt/MockCheatSheetTest.cpp \
tests/CppUTestExt/MockCallTest.cpp \
tests/CppUTestExt/MockComparatorCopierTest.cpp \
tests/CppUTestExt/MockExpectedCallTest.cpp \
tests/CppUTestExt/ExpectedFunctionsListTest.cpp \
tests/CppUTestExt/MockFailureReporterForTest.cpp \
tests/CppUTestExt/MockFailureTest.cpp \
tests/CppUTestExt/MockHierarchyTest.cpp \
tests/CppUTestExt/MockNamedValueTest.cpp \
tests/CppUTestExt/MockParameterTest.cpp \
tests/CppUTestExt/MockPluginTest.cpp \
tests/CppUTestExt/MockSupportTest.cpp \
tests/CppUTestExt/MockSupport_cTest.cpp \
tests/CppUTestExt/MockSupport_cTestCFile.c \
tests/CppUTestExt/MockStrictOrderTest.cpp \
tests/CppUTestExt/MockReturnValueTest.cpp \
tests/CppUTestExt/OrderedTestTest.cpp \
tests/CppUTestExt/OrderedTestTest_c.c \
tests/CppUTestExt/MockFakeLongLong.cpp
CppUTestExt/tests/src/AllTests.cpp \
CppUTestExt/tests/src/CodeMemoryReporterTest.cpp \
CppUTestExt/tests/src/GMockTest.cpp \
CppUTestExt/tests/src/GTest1Test.cpp \
CppUTestExt/tests/src/GTest2ConvertorTest.cpp \
CppUTestExt/tests/src/IEEE754PluginTest.cpp \
CppUTestExt/tests/src/IEEE754PluginTest_c.c \
CppUTestExt/tests/src/MemoryReportAllocatorTest.cpp \
CppUTestExt/tests/src/MemoryReporterPluginTest.cpp \
CppUTestExt/tests/src/MemoryReportFormatterTest.cpp \
CppUTestExt/tests/src/MockActualCallTest.cpp \
CppUTestExt/tests/src/MockCheatSheetTest.cpp \
CppUTestExt/tests/src/MockCallTest.cpp \
CppUTestExt/tests/src/MockComparatorCopierTest.cpp \
CppUTestExt/tests/src/MockExpectedCallTest.cpp \
CppUTestExt/tests/src/ExpectedFunctionsListTest.cpp \
CppUTestExt/tests/src/MockFailureReporterForTest.cpp \
CppUTestExt/tests/src/MockFailureTest.cpp \
CppUTestExt/tests/src/MockHierarchyTest.cpp \
CppUTestExt/tests/src/MockNamedValueTest.cpp \
CppUTestExt/tests/src/MockParameterTest.cpp \
CppUTestExt/tests/src/MockPluginTest.cpp \
CppUTestExt/tests/src/MockSupportTest.cpp \
CppUTestExt/tests/src/MockSupport_cTest.cpp \
CppUTestExt/tests/src/MockSupport_cTestCFile.c \
CppUTestExt/tests/src/MockStrictOrderTest.cpp \
CppUTestExt/tests/src/MockReturnValueTest.cpp \
CppUTestExt/tests/src/OrderedTestTest.cpp \
CppUTestExt/tests/src/OrderedTestTest_c.c \
CppUTestExt/tests/src/MockFakeLongLong.cpp

DISTCLEANFILES = \
filename.map.txt \
Expand All @@ -244,7 +244,7 @@ if INCLUDE_GMOCKTESTS

#GTestTests_SOURCES = \
$(GMOCK_HOME)/test/gmock-spec-builders_test.cc \
tests/CppUTestExt/AllTests.cpp
CppUTestExt/tests/src/AllTests.cpp
endif

RUN_CPPUTEST_TESTS = ./$(CPPUTEST_TESTS)
Expand Down

0 comments on commit 1bedf47

Please sign in to comment.