This commit is contained in:
Attila Body 2025-05-29 23:38:13 +02:00
parent 1382dda88e
commit 7093d6835f
Signed by: abody
GPG key ID: BD0C6214E68FB5CF
478 changed files with 0 additions and 86899 deletions

106
.cproject
View file

@ -222,112 +222,6 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1840394059.960309647">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1840394059.960309647" moduleId="org.eclipse.cdt.core.settings" name="Unittest">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.config.gnu.exe.debug.1840394059.960309647" name="Unittest" parent="cdt.managedbuild.config.gnu.exe.debug" prebuildStep="cd ../platforms/platform-test-f4-ll &amp;&amp; ./build_cpputest.sh &amp;&amp; ./build_subhook.sh">
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1840394059.960309647." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1057380913" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform binaryParser="org.eclipse.cdt.core.GNU_ELF" id="cdt.managedbuild.target.gnu.platform.exe.debug.1321090068" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder buildPath="${workspace_loc:/unittest}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.136584919" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.832265716" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1288768928" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.2097482115" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option defaultValue="gnu.cpp.compiler.debugging.level.max" id="gnu.cpp.compiler.exe.debug.option.debugging.level.725888292" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.other.other.398052869" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -m32 -Wa,-adhlns=&quot;$@.lst&quot; -save-temps=obj" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.1623248717" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="../inc"/>
<listOptionValue builtIn="false" value="../components/f4ll_c/inc"/>
<listOptionValue builtIn="false" value="../platforms/platform-test-f4-ll"/>
<listOptionValue builtIn="false" value="../platforms/platform-test-f4-ll/cpputest_x86/include"/>
<listOptionValue builtIn="false" value="../platforms/platform-test-f4-ll/subhook_x86/include"/>
</option>
<option id="gnu.cpp.compiler.option.dialect.std.103125774" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++11" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.preprocessor.preprocess.42158302" name="Preprocess only (-E)" superClass="gnu.cpp.compiler.option.preprocessor.preprocess" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.preprocessor.def.235834792" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="UNITTEST"/>
</option>
<option id="gnu.cpp.compiler.option.pthread.267882737" name="Support for pthread (-pthread)" superClass="gnu.cpp.compiler.option.pthread" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1286027266" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.410436034" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.1973317917" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option defaultValue="gnu.c.debugging.level.max" id="gnu.c.compiler.exe.debug.option.debugging.level.1146118110" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.option.misc.other.444424359" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -m32 -Wa,-adhlns=&quot;$@.lst&quot; -save-temps=obj" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1725421165" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="../inc"/>
<listOptionValue builtIn="false" value="../components/f4ll_c/inc"/>
<listOptionValue builtIn="false" value="../platforms/platform-test-f4-ll"/>
<listOptionValue builtIn="false" value="../platforms/platform-test-f4-ll/cpputest_x86/include"/>
<listOptionValue builtIn="false" value="../platforms/platform-test-f4-ll/subhook_x86/include"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.preprocessor.def.symbols.1910702134" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="UNITTEST"/>
</option>
<option id="gnu.c.compiler.option.preprocessor.preprocess.654871536" name="Preprocess only (-E)" superClass="gnu.c.compiler.option.preprocessor.preprocess" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option id="gnu.c.compiler.option.dialect.std.1002651825" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.c11" valueType="enumerated"/>
<option id="gnu.c.compiler.option.pthread.2055057964" name="Support for pthread (-pthread)" superClass="gnu.c.compiler.option.pthread" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="gnu.c.compiler.option.optimization.flags.1990763554" name="Other optimization flags" superClass="gnu.c.compiler.option.optimization.flags" useByScannerDiscovery="false" value="-fno-inline" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.537079503" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1354834931" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug">
<option id="gnu.c.link.option.ldflags.1559659654" name="Linker flags" superClass="gnu.c.link.option.ldflags" useByScannerDiscovery="false" value="-m32" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.link.option.paths.835108555" name="Library search path (-L)" superClass="gnu.c.link.option.paths" useByScannerDiscovery="false" valueType="libPaths">
<listOptionValue builtIn="false" value="../gtest_i386/lib"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.link.option.libs.415232079" name="Libraries (-l)" superClass="gnu.c.link.option.libs" useByScannerDiscovery="false" valueType="libs">
<listOptionValue builtIn="false" value="gmock"/>
<listOptionValue builtIn="false" value="gmock_main"/>
<listOptionValue builtIn="false" value="gtest"/>
<listOptionValue builtIn="false" value="gtest_main"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.483012927" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1547977213" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.flags.892010408" name="Linker flags" superClass="gnu.cpp.link.option.flags" useByScannerDiscovery="false" value="-m32" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.link.option.paths.2050679230" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths">
<listOptionValue builtIn="false" value="../platforms/platform-test-f4-ll/cpputest_x86/lib"/>
<listOptionValue builtIn="false" value="../platforms/platform-test-f4-ll/subhook_x86/lib"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.link.option.libs.1965858469" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" useByScannerDiscovery="false" valueType="libs">
<listOptionValue builtIn="false" value="CppUTestExt"/>
<listOptionValue builtIn="false" value="CppUTest"/>
<listOptionValue builtIn="false" value="subhook"/>
</option>
<option id="gnu.cpp.link.option.pthread.1592295432" name="Support for pthread (-pthread)" superClass="gnu.cpp.link.option.pthread" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1591821302" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1226993747" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1564470498" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="platform/googletest|f4ll_c/test/googletest|f4ll_c/mocks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="components"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
<entry excluding="cpputest|cpputest_x86|subhook_x86|subhook" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="platforms/platform-test-f4-ll"/>
<entry excluding="googletest" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="platforms/test"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="f407ve_packetusart_c.null.1518214656" name="f407ve_packetusart_c"/>

View file

@ -5,9 +5,6 @@ default: firmware tests
firmware:
$(MAKE) -f firmware.mk
tests:
$(MAKE) -f tests.mk
clean:
$(MAKE) -f firmware.mk clean
$(MAKE) -f tests.mk clean

View file

@ -1,13 +0,0 @@
SELF_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
REL_DIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
ifeq ($(MKDBG), 1)
$(info >>> $(REL_DIR)/test.mk)
endif
$(eval C_SOURCES += $(wildcard $(REL_DIR)/src/*.c))
$(eval COMMON_INCLUDES += -I$(REL_DIR)/inc)
$(eval CXX_SOURCES += $(wildcard $(REL_DIR)/test/*.cpp))
ifeq ($(MKDBG), 1)
$(info <<<)
endif

View file

@ -1,431 +0,0 @@
/*
============================================================================
Name : unittest.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <thread>
#include <future>
#include <platform/dma_ll.h>
#include <f4ll_c/crcscheduler.h>
#include <CppUTest/TestHarness.h>
#include <CppUTestExt/MockSupport.h>
#include <subhook.h>
extern "C" void Crc_StartNextTask(struct crcstatus_t *status);
//
//DMA_TypeDef * DMA1 __attribute__((weak));
//DMA_TypeDef * DMA2 __attribute__((weak));
//
//static DMA_TypeDef dma1, dma2;
//static crcstatus_t crcStatus;
//static crcslot_t slot1, slot2;
//static crctask_t tasks1[2], tasks2[2];
//static CRC_TypeDef fakeCrc;
//
//static DMA_TypeDef *expectedDma;
//static uint32_t expectedStream;
//static uint32_t expectedSrcAddress;
//static uint32_t expectedDstAddress;
//static uint32_t expectedLength;
//static void *expectedCustomPtr;
//static uint8_t expectedSuccess;
//static uint32_t expectedCrc;
//
////////////////////////////////////////////////////////////////////////////////
//uint32_t effective_primask = 0;
//
//DEFINE_MOCK(__set_PRIMASK, mock, uint32_t primask) {
// effective_primask = primask;
// LEAVE_MOCK;
//}
//
//DEFINE_MOCK_RET(uint32_t, __get_PRIMASK, mock) {
// RETURN_MOCK(__get_PRIMASK, mock, effective_primask);
//}
//
//DEFINE_MOCK_VAR(crcslot_t *, __disable_irq, mock, firstslot_required);
//DEFINE_MOCK(__disable_irq, mock) {
// if(MOCK_CALLCOUNT(__disable_irq, mock) < 2) {
// EXPECT_EQ(crcStatus.firstSlot, MOCK_VAR(__disable_irq, mock, firstslot_required));
// }
// effective_primask = 1;
// LEAVE_MOCK;
//}
//
//DEFINE_MOCK(LL_DMA_EnableIT_TC, mock, DMA_TypeDef *dma, uint32_t stream) {
// EXPECT_EQ(expectedDma, dma);
// EXPECT_EQ(expectedStream, stream);
// LEAVE_MOCK;
//}
//
//DEFINE_MOCK(LL_DMA_EnableIT_TE, mock, DMA_TypeDef *dma, uint32_t stream) {
// EXPECT_EQ(expectedDma, dma);
// EXPECT_EQ(expectedStream, stream);
// LEAVE_MOCK;
//}
//
//DEFINE_MOCK(LL_DMA_SetM2MDstAddress, mock, DMA_TypeDef *dma, uint32_t stream, uint32_t address) {
// EXPECT_EQ(expectedDma, dma);
// EXPECT_EQ(expectedStream, stream);
// EXPECT_EQ(expectedDstAddress, address);
// LEAVE_MOCK;
//}
//
//DEFINE_MOCK(LL_DMA_SetM2MSrcAddress, mock, DMA_TypeDef *dma, uint32_t stream, uint32_t address) {
// EXPECT_EQ(expectedDma, dma);
// EXPECT_EQ(expectedStream, stream);
// EXPECT_EQ(expectedSrcAddress, address);
// LEAVE_MOCK;
//}
//
//DEFINE_MOCK(LL_DMA_SetDataLength, mock, DMA_TypeDef *dma, uint32_t stream, uint32_t length) {
// EXPECT_EQ(expectedDma, dma);
// EXPECT_EQ(expectedStream, stream);
// EXPECT_EQ(expectedLength, length);
// LEAVE_MOCK;
//}
//
//DEFINE_MOCK(LL_DMA_EnableStream, mock, DMA_TypeDef *dma, uint32_t stream) {
// EXPECT_EQ(expectedDma, dma);
// EXPECT_EQ(expectedStream, stream);
// LEAVE_MOCK;
//}
//
//DEFINE_MOCK(LL_DMA_DisableStream, mock, DMA_TypeDef *dma, uint32_t stream) {
// EXPECT_EQ(expectedDma, dma);
// EXPECT_EQ(expectedStream, stream);
// LEAVE_MOCK;
//}
//
//DEFINE_MOCK(Crc_StartNextTask, mock, struct crcstatus_t *status) {
// EXPECT_EQ(status, &crcStatus);
// LEAVE_MOCK
//}
//
//void FakeCallback_1(void*, uint32_t, uint8_t) {}
//void FakeCallback_2(void*, uint32_t, uint8_t) {}
//void FakeCallback_3(void*, uint32_t, uint8_t) {}
//
//void FakeCallbackCheck(void* ptr, uint32_t crc, uint8_t success)
//{
// EXPECT_EQ(ptr, expectedCustomPtr);
// EXPECT_EQ(crc, expectedCrc);
// EXPECT_EQ(success, expectedSuccess);
//}
//
//DEFINE_MOCK(Dma_Init, mock, struct dmainfo_t * info, DMA_TypeDef *dma, uint32_t stream)
//{
// LEAVE_MOCK;
//}
//
////////////////////////////////////////////////////////////////////////////////
//TEST(CrcScheduler, InitStatus)
//{
// expectedDma = DMA2;
// expectedStream = LL_DMA_STREAM_4;
// expectedDstAddress = (uint32_t)&fakeCrc;
// memset(&crcStatus, 0xff, sizeof(crcStatus));
//
// ACTIVATE_MOCK(LL_DMA_EnableIT_TC, mock);
// ACTIVATE_MOCK(LL_DMA_EnableIT_TE, mock);
// ACTIVATE_MOCK(LL_DMA_SetM2MDstAddress, mock);
// ACTIVATE_MOCK(Dma_Init, mock);
//
// Crc_InitStatus(&crcStatus, &fakeCrc, DMA2, LL_DMA_STREAM_4);
// EXPECT_EQ(crcStatus.crcUnit, &fakeCrc);
// EXPECT_EQ(crcStatus.activeSlot, nullptr);
// EXPECT_EQ(crcStatus.firstSlot, nullptr);
// EXPECT_EQ(MOCK_VAR(Dma_Init, mock, callcount), 1);
//}
//
//
//TEST(CrcScheduler, AttachTask_single)
//{
// DMA1 = &dma1;
// DMA2 = &dma2;
// effective_primask = 0;
// Crc_InitStatus(&crcStatus, &fakeCrc, DMA2, LL_DMA_STREAM_4);
// ACTIVATE_MOCK_RV(__get_PRIMASK, mock, 0);
// ACTIVATE_MOCK(__set_PRIMASK, mock);
// ACTIVATE_MOCK(__disable_irq, mock);
// MOCK_STORE(__disable_irq, mock, firstslot_required, nullptr);
//
// Crc_AttachTasks(&crcStatus, &slot1, tasks1, 2);
//
// EXPECT_EQ(MOCK_CALLCOUNT(__get_PRIMASK, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(__set_PRIMASK, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(__disable_irq, mock), 1);
// EXPECT_EQ(crcStatus.firstSlot, &slot1);
// EXPECT_EQ(slot1.next, nullptr);
// EXPECT_EQ(slot1.count, 2);
// EXPECT_EQ(crcStatus.activeSlot, nullptr);
//}
//
//// Are tasks attached in the expected order internally
//TEST(CrcScheduler, AttachTask_multiple)
//{
// ACTIVATE_MOCK_RV(__get_PRIMASK, mock, 1);
// ACTIVATE_MOCK(__set_PRIMASK, mock);
// ACTIVATE_MOCK(__disable_irq, mock);
// MOCK_STORE(__disable_irq, mock, firstslot_required, nullptr);
// DMA1 = &dma1;
// DMA2 = &dma2;
// Crc_InitStatus(&crcStatus, NULL, DMA2, LL_DMA_STREAM_4);
//
// Crc_AttachTasks(&crcStatus, &slot1, tasks1, 2);
// MOCK_STORE(__disable_irq, mock, firstslot_required, &slot1);
// Crc_AttachTasks(&crcStatus, &slot2, tasks2, 2);
//
// EXPECT_EQ(MOCK_CALLCOUNT(__get_PRIMASK, mock), 2);
// EXPECT_EQ(MOCK_CALLCOUNT(__set_PRIMASK, mock), 2);
// EXPECT_EQ(MOCK_CALLCOUNT(__disable_irq, mock), 2);
// EXPECT_EQ(crcStatus.firstSlot, &slot2);
// EXPECT_EQ(slot2.next, &slot1);
// EXPECT_EQ(slot1.next, nullptr);
// EXPECT_EQ(slot2.count, 2);
// EXPECT_EQ(crcStatus.activeSlot, nullptr);
//}
//
//// No blocking should occur if the the task is not busy
//TEST(CrcScheduler, Enqueue_nowait)
//{
// uint32_t fakeCrcResult;
// uint8_t testData[] = "qwerty";
// expectedDma = DMA2;
// expectedStream = LL_DMA_STREAM_4;
// expectedSrcAddress = (uint32_t)testData;
//
// memset(tasks1, 0, sizeof(tasks1));
// memset(&fakeCrc, 0, sizeof(fakeCrc));
//
// Crc_InitStatus(&crcStatus, &fakeCrc, DMA2, LL_DMA_STREAM_4);
// Crc_AttachTasks(&crcStatus, &slot1, tasks1, 2);
// expectedLength = 2;
//
// ACTIVATE_MOCK(LL_DMA_SetM2MSrcAddress, mock);
// ACTIVATE_MOCK(LL_DMA_SetDataLength, mock);
// ACTIVATE_MOCK(LL_DMA_EnableStream, mock);
//
// EXPECT_TRUE(Crc_Enqueue(&crcStatus, &slot1, 0, testData, sizeof(testData), FakeCallback_1, &fakeCrcResult));
//
// //first task should be picked up before return;
// EXPECT_EQ(slot1.tasks[0].address, nullptr);
// EXPECT_EQ((uintptr_t)slot1.tasks[0].callback, (uintptr_t)FakeCallback_1);
// EXPECT_EQ(MOCK_VAR(LL_DMA_SetM2MSrcAddress, mock, callcount), 1);
// EXPECT_EQ(MOCK_VAR(LL_DMA_SetDataLength, mock, callcount), 1);
// EXPECT_EQ(MOCK_VAR(LL_DMA_EnableStream, mock, callcount), 1);
//
// EXPECT_FALSE(Crc_Enqueue(&crcStatus, &slot1, 1, testData, 4, FakeCallback_1, &fakeCrcResult));
//
// // second task should be queued
// EXPECT_EQ(slot1.tasks[1].address, testData);
// EXPECT_EQ((uintptr_t)slot1.tasks[1].callback, (uintptr_t)FakeCallback_1);
// EXPECT_EQ(slot1.tasks[1].wordCount, 1);
//
// // should be no new calls to hardware handling functions
// EXPECT_EQ(MOCK_VAR(LL_DMA_SetM2MSrcAddress, mock, callcount), 1);
// EXPECT_EQ(MOCK_VAR(LL_DMA_SetDataLength, mock, callcount), 1);
// EXPECT_EQ(MOCK_VAR(LL_DMA_EnableStream, mock, callcount), 1);
//}
//
//// When trying to enqueue for a busy task it should blok firs
//// then when the previously blocked task finishes it should
//// enqueue the new one
//TEST(CrcScheduler, Enqueue_shouldblockthencontinue)
//{
// uint8_t testData[] = "qwerty";
// uint32_t fakeCrcResult;
//
// memset(tasks1, 0, sizeof(tasks1));
// memset(&fakeCrc, 0, sizeof(fakeCrc));
//
// Crc_InitStatus(&crcStatus, &fakeCrc, DMA2, LL_DMA_STREAM_4);
// Crc_AttachTasks(&crcStatus, &slot1, tasks1, 2);
// Crc_Enqueue(&crcStatus, &slot1, 0, testData, sizeof(testData), FakeCallback_1, &fakeCrcResult);
//
// // black magic to test if the function blocks (at least for 100ms)
// std::promise<bool> promisedFinished;
// auto futureResult = promisedFinished.get_future();
// pthread_t th;
// std::thread t([&testData](std::promise<bool>& finished) {
// pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
// Crc_Enqueue(&crcStatus, &slot1, 0, testData, sizeof(testData), FakeCallback_1, nullptr);
// finished.set_value(true);
// }, std::ref(promisedFinished));
// th = t.native_handle();
// t.detach();
// EXPECT_EQ(futureResult.wait_for(std::chrono::milliseconds(100)), std::future_status::timeout);
// tasks1[0].callback = nullptr;
// tasks1[0].callbackParam = nullptr;
// auto waitResult(futureResult.wait_for(std::chrono::milliseconds(100)));
// EXPECT_NE(waitResult, std::future_status::timeout);
// if(waitResult == std::future_status::timeout)
// pthread_cancel(th);
//}
//
//// StartNextTask should start the scheduled tasks in predefined order
//TEST(CrcScheduler, Crc_StartNextTask)
//{
// uint8_t testData[] = "qwerty";
// uint32_t fakeCrcResult1, fakeCrcResult2, fakeCrcResult3;
//
// memset(tasks1, 0, sizeof(tasks1));
// memset(tasks2, 0, sizeof(tasks2));
// memset(&fakeCrc, 0, sizeof(fakeCrc));
//
// Crc_InitStatus(&crcStatus, &fakeCrc, DMA2, LL_DMA_STREAM_4);
// Crc_AttachTasks(&crcStatus, &slot1, tasks1, 2);
// Crc_AttachTasks(&crcStatus, &slot2, tasks2, 2);
// Crc_Enqueue(&crcStatus, &slot1, 0, testData, sizeof(testData), FakeCallback_1, &fakeCrcResult1);
// Crc_Enqueue(&crcStatus, &slot1, 1, testData, sizeof(testData), FakeCallback_2, &fakeCrcResult2);
// Crc_Enqueue(&crcStatus, &slot2, 0, testData, sizeof(testData), FakeCallback_3, &fakeCrcResult3);
//
// EXPECT_EQ(crcStatus.activeSlot, &slot1);
// EXPECT_EQ(crcStatus.activeTask, 0);
// crcStatus.activeSlot->tasks[crcStatus.activeTask].callback = nullptr;
// crcStatus.activeSlot->tasks[crcStatus.activeTask].callbackParam = nullptr;
//
// ACTIVATE_MOCK(LL_DMA_SetM2MSrcAddress, mock);
// ACTIVATE_MOCK(LL_DMA_SetDataLength, mock);
// ACTIVATE_MOCK(LL_DMA_EnableStream, mock);
//
// expectedDma = DMA2;
// expectedStream = LL_DMA_STREAM_4;
// expectedSrcAddress = (uint32_t)testData;
// expectedLength = (sizeof(testData) + 3) / 4;
//
// Crc_StartNextTask(&crcStatus);
//
// EXPECT_EQ(crcStatus.activeSlot, &slot2);
// EXPECT_EQ(crcStatus.activeTask, 0);
// EXPECT_EQ(LL_DMA_SetM2MSrcAddress_mock_callcount, 1);
// EXPECT_EQ(LL_DMA_SetDataLength_mock_callcount, 1);
// EXPECT_EQ(LL_DMA_EnableStream_mock_callcount, 1);
// crcStatus.activeSlot->tasks[crcStatus.activeTask].callback = nullptr;
// crcStatus.activeSlot->tasks[crcStatus.activeTask].callbackParam = nullptr;
//
// Crc_StartNextTask(&crcStatus);
//
// EXPECT_EQ(crcStatus.activeSlot, &slot1);
// EXPECT_EQ(crcStatus.activeTask, 1);
// EXPECT_EQ(LL_DMA_SetM2MSrcAddress_mock_callcount, 2);
// EXPECT_EQ(LL_DMA_SetDataLength_mock_callcount, 2);
// EXPECT_EQ(LL_DMA_EnableStream_mock_callcount, 2);
//}
//
//// HandleDmaIrq should start the next scheduled task or
//// disable the CRC DMA engine if there is no other task scheduled.
//TEST(CrcScheduler, HandleDmaIrq_callback)
//{
// uint8_t testData[] = "qwerty";
// uint32_t FakeCustomData1, FakeCustomData2;
//
//
// memset(tasks1, 0, sizeof(tasks1));
// memset(tasks2, 0, sizeof(tasks2));
// memset(&fakeCrc, 0, sizeof(fakeCrc));
//
// fakeCrc.DR = 0xa5a55a5a;
//
// Crc_InitStatus(&crcStatus, &fakeCrc, DMA2, LL_DMA_STREAM_4);
// Crc_AttachTasks(&crcStatus, &slot1, tasks1, 2);
// Crc_AttachTasks(&crcStatus, &slot2, tasks2, 2);
// Crc_Enqueue(&crcStatus, &slot1, 1, testData, sizeof(testData), FakeCallbackCheck, &FakeCustomData1);
// // we need to set this up here to check if HandleDmaIrq calls Crc_StartNextTask or not;
// Crc_Enqueue(&crcStatus, &slot2, 0, testData, sizeof(testData), FakeCallbackCheck, &FakeCustomData2);
//
// ACTIVATE_MOCK(LL_DMA_DisableStream, mock);
// ACTIVATE_MOCK(LL_DMA_SetM2MSrcAddress, mock);
// ACTIVATE_MOCK(LL_DMA_SetDataLength, mock);
// ACTIVATE_MOCK(LL_DMA_EnableStream, mock);
// ACTIVATE_MOCK(Crc_StartNextTask, mock);
//
// expectedDma = DMA2;
// expectedStream = LL_DMA_STREAM_4;
//
// expectedCustomPtr = &FakeCustomData1;
// expectedCrc = fakeCrc.DR;
// expectedSuccess = 1;
//
// DMA2->HISR |= DMA_HISR_TCIF4;
// DMA2->HIFCR = 0;
//
// Crc_HandleDmaIrq(&crcStatus);
//
// EXPECT_EQ(LL_DMA_DisableStream_mock_callcount, 1);
//
// EXPECT_EQ(DMA2->HIFCR & DMA_HIFCR_CTCIF4, DMA_HIFCR_CTCIF4);
//
// expectedCustomPtr = &FakeCustomData2;
// DMA2->HISR |= DMA_HISR_TCIF4 | DMA_HISR_TEIF4;
// DMA2->HIFCR = 0;
// crcStatus.activeSlot->tasks[crcStatus.activeTask].callback = nullptr;
// crcStatus.activeSlot->tasks[crcStatus.activeTask].callbackParam = nullptr;
//
// Crc_HandleDmaIrq(&crcStatus);
//
// EXPECT_EQ(DMA2->HIFCR & (DMA_HIFCR_CTCIF4 | DMA_HIFCR_CTEIF4), DMA_HIFCR_CTCIF4 | DMA_HIFCR_CTEIF4);
// EXPECT_EQ(LL_DMA_DisableStream_mock_callcount, 2);
//}
//
//// Crc_StartNextTask starts executing the next task and removes it from the queue
//// Test if IsTaskQueued reflects this behaviour correctly
//TEST(CrcScheduler, IsTaskQueued)
//{
// uint8_t testData[] = "qwerty";
// uint32_t FakeCustomData1;
//
// Crc_InitStatus(&crcStatus, &fakeCrc, DMA2, LL_DMA_STREAM_4);
// Crc_AttachTasks(&crcStatus, &slot1, tasks1, 2);
// Crc_Enqueue(&crcStatus, &slot1, 0, testData, sizeof(testData), FakeCallback_1, &FakeCustomData1);
// Crc_Enqueue(&crcStatus, &slot1, 1, testData, sizeof(testData), FakeCallback_1, &FakeCustomData1);
//
// EXPECT_EQ(Crc_IsTaskQueued(&slot1, 0), 0);
// EXPECT_NE(Crc_IsTaskQueued(&slot1, 1), 0);
//
// Crc_StartNextTask(&crcStatus);
//
// EXPECT_EQ(Crc_IsTaskQueued(&slot1, 1), 0);
//}
//
//// Crc_HandleDmaIrq completes the active task and start executing the next (by calling StartNextTask)
//// Crc_IsTaskBusy should reflect these changes
//TEST(CrcScheduler, IsTaskBusy)
//{
// uint8_t testData[] = "qwerty";
// uint32_t FakeCustomData1;
//
// Crc_InitStatus(&crcStatus, &fakeCrc, DMA2, LL_DMA_STREAM_4);
// Crc_AttachTasks(&crcStatus, &slot1, tasks1, 2);
// Crc_Enqueue(&crcStatus, &slot1, 0, testData, sizeof(testData), FakeCallback_1, &FakeCustomData1);
// Crc_Enqueue(&crcStatus, &slot1, 1, testData, sizeof(testData), FakeCallback_1, &FakeCustomData1);
//
// EXPECT_NE(Crc_IsTaskBusy(&slot1, 0), 0);
// EXPECT_NE(Crc_IsTaskBusy(&slot1, 1), 0);
//
// DMA2->HISR |= DMA_HISR_TCIF4;
// Crc_HandleDmaIrq(&crcStatus);
//
// EXPECT_EQ(Crc_IsTaskBusy(&slot1, 0), 0);
// EXPECT_NE(Crc_IsTaskBusy(&slot1, 1), 0);
//
// DMA2->HISR |= DMA_HISR_TCIF4;
// Crc_HandleDmaIrq(&crcStatus);
//
// EXPECT_EQ(Crc_IsTaskBusy(&slot1, 0), 0);
// EXPECT_EQ(Crc_IsTaskBusy(&slot1, 1), 0);
//}
//

View file

@ -1,746 +0,0 @@
/*
* packetusart_unittest.cpp
*
* Created on: Dec 2, 2019
* Author: abody
*/
#include <stdlib.h>
#include <inttypes.h>
#include <thread>
#include <future>
#include <platform/usart_ll.h>
#include <f4ll_c/packetusart.h>
#include <CppUTest/TestHarness.h>
#include <CppUTestExt/MockSupport.h>
#include <subhook.h>
//static inline uint32_t RoundUpTo4(uint32_t inp)
//{
// return (inp + 3) & 0xfffc;
//}
//
//DMA_TypeDef* DMA1 __attribute__((weak));
//DMA_TypeDef* DMA2 __attribute__((weak));
//
//static DMA_TypeDef fakeDma1, fakeDma2;
//static CRC_TypeDef fakeCrc;
//static USART_TypeDef fakeUsart;
//
//static struct usartstatus_t usartStatus;
//static struct crcstatus_t crcStatus;
//
//uint8_t testData[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
//
////static uint32_t expected_stream;
////static uint32_t expected_srcaddress;
////static uint32_t expected_dstaddress;
////static uint32_t expected_length;
////static void *expected_customptr;
////static uint8_t expected_success;
////static struct usartstatus_t * expectedUsartStatus;
//static uint32_t expectedStreams[2] = { 0,7 };
//struct crcstatus_t *expectedCrcStatus;
//struct crcslot_t *expectedCrcSlotListItem;
//struct crctask_t *expectedTasks;
//uint8_t expectedTaskCount;
//uint32_t expectedCrcLength;
//uint32_t expectedLength;
//void* expectedCrcEnqueueAddress;
//void *expectedTransmitBuffer;
//
//static uint32_t expectedStream;
//uint32_t expectedSrcAddress;
//uint32_t expectedDstAddress;
//uint32_t expectedDirection;
//
//uint32_t fakePacketReceivedCallbackParam;
//
//
//// this isn't a real mov but we use the mockinginfrastructure
//// to automate administration (call count, etc)
//DEFINE_MOCK(FakePacketReceivedCallback, mock, void* userParam, struct usart_buffer_t *buffer)
//{
// EXPECT_EQ((void*)&fakePacketReceivedCallbackParam, userParam);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(Dma_Init, mock, struct dmainfo_t* dmaInfo, DMA_TypeDef *dma, uint32_t stream)
//{
// Dma_Init__(dmaInfo, dma, stream);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(Crc_AttachTasks, mock, struct crcstatus_t *status, struct crcslot_t *slot, struct crctask_t *tasks, uint8_t taskCount)
//{
// EXPECT_EQ(status, expectedCrcStatus);
// EXPECT_EQ(slot, expectedCrcSlotListItem);
// EXPECT_EQ(tasks, expectedTasks);
// EXPECT_EQ(taskCount, expectedTaskCount);
// Crc_AttachTasks__(status, slot, tasks, taskCount);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(LL_DMA_EnableIT_TC, init, DMA_TypeDef *dma, uint32_t stream)
//{
// EXPECT_EQ(dma, &fakeDma1);
// EXPECT_EQ(stream, expectedStreams[MOCK_VAR(LL_DMA_EnableIT_TC, init, callcount)-1]);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(LL_DMA_EnableIT_TE, init, DMA_TypeDef *dma, uint32_t stream)
//{
// EXPECT_EQ(dma, &fakeDma1);
// EXPECT_EQ(stream, expectedStreams[MOCK_VAR(LL_DMA_EnableIT_TE, init, callcount)-1]);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK_RET(uint32_t, LL_USART_DMA_GetRegAddr, mock, USART_TypeDef *usart)
//{
// RETURN_MOCK_PREDEF(LL_USART_DMA_GetRegAddr, mock)
//}
//
//DEFINE_MOCK(LL_DMA_ConfigAddresses, mock, DMA_TypeDef* dma, uint32_t stream, uint32_t srcAddress, uint32_t dstAddress, uint32_t direction)
//{
// EXPECT_EQ(dma, &fakeDma1);
// EXPECT_EQ(stream, expectedStream);
// EXPECT_EQ(srcAddress, expectedSrcAddress);
// EXPECT_EQ(dstAddress, expectedDstAddress);
// EXPECT_EQ(direction, expectedDirection);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(LL_DMA_SetDataLength, mock, DMA_TypeDef* dma, uint32_t stream, uint32_t length)
//{
// EXPECT_EQ(dma, &fakeDma1);
// EXPECT_EQ(stream, expectedStream);
// EXPECT_EQ(length, expectedLength);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK_RET(uint32_t, LL_DMA_GetDataLength, mock, DMA_TypeDef* dma, uint32_t stream)
//{
// EXPECT_EQ(dma, &fakeDma1);
// EXPECT_EQ(stream, expectedStream);
// RETURN_MOCK_PREDEF(LL_DMA_GetDataLength, mock)
//}
//
//DEFINE_MOCK(LL_DMA_EnableStream, mock, DMA_TypeDef* dma, uint32_t stream)
//{
// EXPECT_EQ(dma, &fakeDma1);
// EXPECT_EQ(stream, expectedStream);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(LL_DMA_DisableStream, mock, DMA_TypeDef* dma, uint32_t stream)
//{
// EXPECT_EQ(dma, &fakeDma1);
// EXPECT_EQ(stream, expectedStream);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(LL_USART_EnableDMAReq_TX, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(LL_USART_EnableDMAReq_RX, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(LL_USART_EnableIT_IDLE, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(LL_USART_EnableIT_TC, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(LL_USART_DisableIT_TC, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK_RET(uint32_t, LL_USART_IsActiveFlag_IDLE, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// RETURN_MOCK_PREDEF(LL_USART_IsActiveFlag_IDLE, mock)
//}
//
//DEFINE_MOCK_RET(uint32_t, LL_USART_IsActiveFlag_TC, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// RETURN_MOCK_PREDEF(LL_USART_IsActiveFlag_TC, mock)
//}
//
//DEFINE_MOCK(LL_USART_ClearFlag_IDLE, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// LEAVE_MOCK;
//}
//
//DEFINE_MOCK_RET(uint32_t, LL_USART_IsEnabledIT_IDLE, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// RETURN_MOCK_PREDEF(LL_USART_IsEnabledIT_IDLE, mock)
//}
//
//DEFINE_MOCK_RET(uint32_t, LL_USART_IsEnabledIT_TC, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// RETURN_MOCK_PREDEF(LL_USART_IsEnabledIT_TC, mock)
//}
//
//DEFINE_MOCK(LL_USART_EnableDirectionTx, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(LL_USART_DisableDirectionTx, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK(LL_USART_ClearFlag_ORE, mock, USART_TypeDef *usart)
//{
// EXPECT_EQ(usart, &fakeUsart);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK_RET(uint8_t, Crc_Enqueue, mock, struct crcstatus_t *status, struct crcslot_t *slot, uint8_t task,
// void *address, uint16_t len, void (*callback)(void*, uint32_t, uint8_t), void* callbackParam)
//{
// EXPECT_EQ(expectedCrcLength, len);
// EXPECT_EQ(expectedCrcEnqueueAddress, address);
// RETURN_MOCK_PREDEF(Crc_Enqueue, mock);
//}
//
//DEFINE_MOCK_RET(uint8_t, Crc_IsTaskQueued, mock, struct crcslot_t *slot, uint8_t task)
//{
// RETURN_MOCK_PREDEF(Crc_IsTaskQueued, mock);
//}
//
//DEFINE_MOCK(Pu_SetupTransmit, mock, USART_TypeDef *usart, DMA_TypeDef* dma, uint32_t stream, void *buffer, uint32_t length)
//{
// EXPECT_EQ(buffer, expectedTransmitBuffer);
// EXPECT_EQ(length, expectedLength);
// LEAVE_MOCK
//}
//
//DEFINE_MOCK_RET(uint8_t, Pu_CheckHeader, proxy, struct usartpacket_t *packet)
//{
// RETURN_MOCK(Pu_CheckHeader, proxy, Pu_CheckHeader__(packet));
//}
//
//DEFINE_MOCK(Pu_SetupReceive, mock, struct usartstatus_t *status)
//{
// LEAVE_MOCK
//}
//
//struct PacketUsart : public ::testing::Test {
// void SetUp()
// {
// DMA1 = &fakeDma1;
// DMA2 = &fakeDma2;
//
// memset(&usartStatus, 0x5a, sizeof(usartStatus));
// Crc_InitStatus(&crcStatus, &fakeCrc, &fakeDma2, 4);
//
// expectedCrcStatus = &crcStatus;
// expectedCrcSlotListItem = &usartStatus.crcSlot;
// expectedTasks = usartStatus.crcTasks;
// expectedTaskCount = 2;
// }
//};
//
////////////////////////////////////////////////////////////////////////////////
//TEST_F(PacketUsart, Init)
//{
// ACTIVATE_MOCK(Dma_Init, mock);
// ACTIVATE_MOCK(Crc_AttachTasks, mock);
// ACTIVATE_MOCK(LL_DMA_EnableIT_TC, init);
// ACTIVATE_MOCK(LL_DMA_EnableIT_TE, init);
// ACTIVATE_MOCK(LL_USART_EnableIT_IDLE, mock);
//
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
//
// EXPECT_EQ(fakeDma1.LIFCR, DMA_LISR_TCIF0 | DMA_LISR_HTIF0 | DMA_LISR_TEIF0 | DMA_LISR_FEIF0 | DMA_LISR_DMEIF0);
// EXPECT_EQ(fakeDma1.HIFCR, DMA_HISR_TCIF7 | DMA_HISR_HTIF7 | DMA_HISR_TEIF7 | DMA_HISR_FEIF7 | DMA_HISR_DMEIF7);
// EXPECT_EQ(MOCK_CALLCOUNT(Dma_Init, mock), 2);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_EnableIT_TC, init), 2);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_EnableIT_TE, init), 2);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_EnableIT_IDLE, mock), 1);
// EXPECT_EQ(usartStatus.usart, &fakeUsart);
// EXPECT_EQ(usartStatus.txBuffer.usartStatus, &usartStatus);
// EXPECT_EQ(usartStatus.txBuffer.busy, 0);
// EXPECT_EQ(usartStatus.txBuffer.error, 0);
// EXPECT_EQ(usartStatus.txBuffer.requestedLength, 0);
// EXPECT_EQ(usartStatus.rxBuffers[0].busy, 0);
// EXPECT_EQ(usartStatus.rxBuffers[0].error, 0);
// EXPECT_EQ(usartStatus.rxBuffers[0].requestedLength, 0);
// EXPECT_EQ(usartStatus.rxBuffers[0].usartStatus, &usartStatus );
// EXPECT_EQ(usartStatus.rxBuffers[1].busy, 0);
// EXPECT_EQ(usartStatus.rxBuffers[1].error, 0);
// EXPECT_EQ(usartStatus.rxBuffers[1].requestedLength, 0);
// EXPECT_EQ(usartStatus.rxBuffers[1].usartStatus, &usartStatus );
// EXPECT_TRUE(usartStatus.packetReceivedCallback == FakePacketReceivedCallback_mock);
// EXPECT_EQ(usartStatus.packetReceivedCallbackParam, &fakePacketReceivedCallbackParam);
// EXPECT_EQ(usartStatus.rxSerial, (uint8_t)-1);
// EXPECT_EQ(usartStatus.txSerial, 0);
// EXPECT_EQ(usartStatus.activeRxBuf, 0);
// EXPECT_EQ(usartStatus.crcStatus, &crcStatus);
//}
//
//TEST_F(PacketUsart, GetTxBuffer)
//{
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// EXPECT_EQ(Pu_GetTxBuffer(&usartStatus), (unsigned char*)&usartStatus.txBuffer.packet.payload);
//}
//
//// SetupTransmit should set all engines (DMA, USART) up properly for starting the transmission
//TEST_F(PacketUsart, SetupTransmit)
//{
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// expectedStream = 7;
// expectedSrcAddress = (uint32_t)testData;
// expectedDstAddress = (uint32_t)&fakeUsart.DR;
// expectedDirection = LL_DMA_DIRECTION_MEMORY_TO_PERIPH;
// expectedLength = sizeof(testData);
//
// ACTIVATE_MOCK(LL_DMA_ConfigAddresses, mock);
// ACTIVATE_MOCK(LL_DMA_SetDataLength , mock);
// ACTIVATE_MOCK(LL_DMA_EnableStream , mock);
// ACTIVATE_MOCK(LL_USART_EnableDMAReq_TX, mock);
// ACTIVATE_MOCK_RV(LL_USART_DMA_GetRegAddr, mock, expectedDstAddress);
//
// Pu_SetupTransmit(&fakeUsart, &fakeDma1, 7, testData, sizeof(testData));
//
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_ConfigAddresses, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_SetDataLength, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_EnableStream, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_EnableDMAReq_TX, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_DMA_GetRegAddr, mock), 1);
//}
//
//// Testing Pu_Post, not waiting for the crc scheduler to start processing our block
//TEST_F(PacketUsart, Post_copy_nowait)
//{
// struct usartpacketheader_t expectedHeader = { 0x95, 0, sizeof(testData), 0x95 ^ 0 ^ sizeof(testData) };
// expectedCrcLength = sizeof(usartStatus.txBuffer.packet.header) + 12;
// expectedCrcEnqueueAddress = &usartStatus.txBuffer.packet;
// expectedLength = sizeof(usartStatus.txBuffer.packet.header) + 12 + sizeof(uint32_t);
// expectedTransmitBuffer = &usartStatus.txBuffer.packet;
//
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
//
// ACTIVATE_MOCK_RV(Crc_Enqueue, mock, 1);
// ACTIVATE_MOCK(Pu_SetupTransmit, mock);
// ACTIVATE_MOCK_RV(Crc_IsTaskQueued, mock, 1);
//
// Pu_Post(&usartStatus, testData, sizeof(testData), false);
//
// EXPECT_EQ(usartStatus.txBuffer.busy, 1);
// EXPECT_EQ(usartStatus.txBuffer.requestedLength, expectedLength);
// EXPECT_EQ(memcmp(&usartStatus.txBuffer.packet.header, &expectedHeader, sizeof(expectedHeader)), 0);
// EXPECT_EQ(MOCK_CALLCOUNT(Crc_Enqueue, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(Pu_SetupTransmit, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(Crc_IsTaskQueued, mock), 0);
//}
//
//// Posting with free CRC engine (will execute our block immediately)
//TEST_F(PacketUsart, Post_copy_wait_nodelay)
//{
// expectedCrcLength = sizeof(usartStatus.txBuffer.packet.header) + 12;
// expectedCrcEnqueueAddress = &usartStatus.txBuffer.packet;
// expectedLength = sizeof(usartStatus.txBuffer.packet.header) + 12 + sizeof(uint32_t);
// expectedTransmitBuffer = &usartStatus.txBuffer.packet;
//
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
//
// ACTIVATE_MOCK_RV(Crc_Enqueue, mock, 1);
// ACTIVATE_MOCK(Pu_SetupTransmit, mock);
// ACTIVATE_MOCK_RV(Crc_IsTaskQueued, mock, 0);
//
// Pu_Post(&usartStatus, testData, sizeof(testData), true);
//
// EXPECT_EQ(MOCK_CALLCOUNT(Crc_IsTaskQueued, mock), 1);
//}
//
//// Posting with with busy CRC engine should block our call
//TEST_F(PacketUsart, Post_copy_wait_delay)
//{
// expectedCrcLength = sizeof(usartStatus.txBuffer.packet.header) + 12;
// expectedCrcEnqueueAddress = &usartStatus.txBuffer.packet;
// expectedLength = sizeof(usartStatus.txBuffer.packet.header) + 12 + sizeof(uint32_t);
// expectedTransmitBuffer = &usartStatus.txBuffer.packet;
//
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
//
// ACTIVATE_MOCK_RV(Crc_Enqueue, mock, 1);
// ACTIVATE_MOCK(Pu_SetupTransmit, mock);
// ACTIVATE_MOCK_RV(Crc_IsTaskQueued, mock, 1);
//
// // black magic to test if the function blocks (at least for 100ms)
// std::promise<bool> promiseFinished;
// auto futureResult = promiseFinished.get_future();
// pthread_t th;
// std::thread t([](std::promise<bool>& finished) {
// pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
// Pu_Post(&usartStatus, testData, sizeof(testData), true);;
// finished.set_value(true);
// }, std::ref(promiseFinished));
// th = t.native_handle();
// t.detach();
// EXPECT_EQ(futureResult.wait_for(std::chrono::milliseconds(100)), std::future_status::timeout);
// Crc_IsTaskQueued_mock_retval = 0;
// auto waitResult(futureResult.wait_for(std::chrono::milliseconds(100)));
// EXPECT_NE(waitResult, std::future_status::timeout);
// if(waitResult == std::future_status::timeout)
// pthread_cancel(th);
//}
//
//// HandleTxDmaIrq_tc should enable USART TC interrupt and disable DMA stream
//TEST_F(PacketUsart, HandleTxDmaIrq_tc)
//{
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_Post(&usartStatus, testData, sizeof(testData), true);
//
// memset(&fakeDma1, 0, sizeof(fakeDma1));
// fakeDma1.HISR = DMA_HISR_TCIF7;
// expectedStream = 7;
//
// ACTIVATE_MOCK(LL_USART_EnableIT_TC, mock);
// ACTIVATE_MOCK(LL_DMA_DisableStream, mock);
//
// Pu_HandleTxDmaIrq(&usartStatus);
//
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_EnableIT_TC, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_DisableStream, mock), 1);
// EXPECT_EQ(fakeDma1.HIFCR, DMA_HIFCR_CTCIF7);
//}
//
//// HandleTxDmaIrq_te should enable USART TC interrupt disable DMA stream and set the error flag
//TEST_F(PacketUsart, HandleTxDmaIrq_te)
//{
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_Post(&usartStatus, testData, sizeof(testData), true);
//
// memset(&fakeDma1, 0, sizeof(fakeDma1));
// fakeDma1.HISR = DMA_HISR_TEIF7;
// expectedStream = 7;
//
// Pu_HandleTxDmaIrq(&usartStatus);
//
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_EnableIT_TC, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_DisableStream, mock), 1);
// EXPECT_EQ(fakeDma1.HIFCR, DMA_HIFCR_CTEIF7);
// EXPECT_EQ(usartStatus.txBuffer.error, 1);
//}
//
//// HandleUsartIrq_tc should disable USART TC interrupt, pulse TX direction enabled to enforce an idle frame
//// and mark the tx buffer as free
//TEST_F(PacketUsart, HandleUsartIrq_tc)
//{
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_Post(&usartStatus, testData, sizeof(testData), true);
//
// ACTIVATE_MOCK_RV(LL_USART_IsActiveFlag_IDLE, mock, 0);
// ACTIVATE_MOCK_RV(LL_USART_IsActiveFlag_TC, mock, 1);
// ACTIVATE_MOCK_RV(LL_USART_IsEnabledIT_IDLE, mock, 1);
// ACTIVATE_MOCK_RV(LL_USART_IsEnabledIT_TC, mock, 1);
// ACTIVATE_MOCK(LL_USART_DisableIT_TC, mock);
// ACTIVATE_MOCK(LL_USART_EnableDirectionTx, mock);
// ACTIVATE_MOCK(LL_USART_DisableDirectionTx, mock);
//
// Pu_HandleUsartIrq(&usartStatus);
//
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_DisableIT_TC, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_DisableDirectionTx, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_EnableDirectionTx, mock), 1);
// EXPECT_EQ(usartStatus.txBuffer.busy, 0);
//}
//
//// SetupReceive must set USART and DMA engine up for reception
//TEST_F(PacketUsart, SetupReceive)
//{
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// expectedStream = 0;
// expectedDstAddress = (uint32_t)&usartStatus.rxBuffers[usartStatus.activeRxBuf].packet;
// expectedSrcAddress = (uint32_t)&fakeUsart.DR;
// expectedDirection = LL_DMA_DIRECTION_PERIPH_TO_MEMORY;
// expectedLength = sizeof(struct usartpacket_t);
//
// ACTIVATE_MOCK(LL_DMA_ConfigAddresses, mock);
// ACTIVATE_MOCK(LL_DMA_SetDataLength , mock);
// ACTIVATE_MOCK(LL_DMA_EnableStream , mock);
// ACTIVATE_MOCK(LL_USART_EnableDMAReq_RX, mock);
// ACTIVATE_MOCK(LL_USART_ClearFlag_ORE, mock);
//
// ACTIVATE_MOCK_RV(LL_USART_DMA_GetRegAddr, mock, expectedSrcAddress);
//
// Pu_SetupReceive(&usartStatus);
//
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_ConfigAddresses, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_SetDataLength, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_EnableStream, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_EnableDMAReq_RX, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_ClearFlag_ORE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_DMA_GetRegAddr, mock), 1);
//}
//
//// Test HandleUsartIrq with a received packet having a correct header checksum
//TEST_F(PacketUsart, HandleUsartIrq_idle_fullpacket_hdr_ok)
//{
// struct usartpacketheader_t fakeHeader = { 0x95, 0, sizeof(testData), 0x95 ^ 0 ^ sizeof(testData) };
//
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_SetupReceive(&usartStatus);
//
// expectedStream = 0;
// memcpy(&usartStatus.rxBuffers[0].packet.header, &fakeHeader, sizeof(fakeHeader));
//
// ACTIVATE_MOCK_RV(LL_USART_IsActiveFlag_IDLE, mock, 1);
// ACTIVATE_MOCK_RV(LL_USART_IsActiveFlag_TC, mock, 0);
// ACTIVATE_MOCK_RV(LL_USART_IsEnabledIT_IDLE, mock, 1);
// ACTIVATE_MOCK_RV(LL_USART_IsEnabledIT_TC, mock, 1);
// ACTIVATE_MOCK(LL_USART_ClearFlag_IDLE, mock);
// ACTIVATE_MOCK_RV(LL_DMA_GetDataLength, mock, sizeof(struct usartpacket_t) - sizeof(struct usartpacketheader_t) - RoundUpTo4(sizeof(testData)) - sizeof(uint32_t));
// ACTIVATE_MOCK_RV(Pu_CheckHeader, proxy, 1);
// ACTIVATE_MOCK(LL_DMA_DisableStream, mock);
//
// Pu_HandleUsartIrq(&usartStatus);
//
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_IsActiveFlag_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_IsEnabledIT_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_ClearFlag_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_GetDataLength, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(Pu_CheckHeader, proxy), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_DisableStream, mock), 1);
// EXPECT_EQ(usartStatus.rxBuffers[0].busy, 0);
// EXPECT_EQ(usartStatus.rxBuffers[0].error, 0);
//}
//
//// Test HandleUsartIrq with a received packet having a incorrect header checksum
//TEST_F(PacketUsart, HandleUsartIrq_idle_fullpacket_hdr_bad)
//{
// struct usartpacketheader_t fakeHeader = { 0x95, 0, sizeof(testData), 0xff ^ 0 ^ sizeof(testData) };
//
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_SetupReceive(&usartStatus);
//
// expectedStream = 0;
// memcpy(&usartStatus.rxBuffers[0].packet.header, &fakeHeader, sizeof(fakeHeader));
//
// ACTIVATE_MOCK_RV(LL_USART_IsActiveFlag_IDLE, mock, 1);
// ACTIVATE_MOCK_RV(LL_USART_IsActiveFlag_TC, mock, 0);
// ACTIVATE_MOCK_RV(LL_USART_IsEnabledIT_IDLE, mock, 1);
// ACTIVATE_MOCK_RV(LL_USART_IsEnabledIT_TC, mock, 1);
// ACTIVATE_MOCK(LL_USART_ClearFlag_IDLE, mock);
// ACTIVATE_MOCK_RV(LL_DMA_GetDataLength, mock, sizeof(struct usartpacket_t) - sizeof(struct usartpacketheader_t) - RoundUpTo4(sizeof(testData)) - sizeof(uint32_t));
// ACTIVATE_MOCK_RV(Pu_CheckHeader, proxy, 1);
// ACTIVATE_MOCK(LL_DMA_DisableStream, mock);
//
// Pu_HandleUsartIrq(&usartStatus);
//
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_IsActiveFlag_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_IsEnabledIT_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_ClearFlag_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_GetDataLength, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(Pu_CheckHeader, proxy), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_DisableStream, mock), 1);
// EXPECT_NE(usartStatus.rxBuffers[0].error, 0);
// EXPECT_NE(usartStatus.rxBuffers[0].busy, 0);
//}
//
//// Packet reception should continue if the packet is not fully received yet
//TEST_F(PacketUsart, HandleUsartIrq_idle_tooshort)
//{
// struct usartpacketheader_t fakeHeader = { 0x95, 0, sizeof(testData), 0x95 ^ 0 ^ sizeof(testData) };
//
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_SetupReceive(&usartStatus);
//
// expectedStream = 0;
// memcpy(&usartStatus.rxBuffers[0].packet.header, &fakeHeader, sizeof(fakeHeader));
//
// ACTIVATE_MOCK_RV(LL_USART_IsActiveFlag_IDLE, mock, 1);
// ACTIVATE_MOCK_RV(LL_USART_IsActiveFlag_TC, mock, 0);
// ACTIVATE_MOCK_RV(LL_USART_IsEnabledIT_IDLE, mock, 1);
// ACTIVATE_MOCK_RV(LL_USART_IsEnabledIT_TC, mock, 1);
// ACTIVATE_MOCK(LL_USART_ClearFlag_IDLE, mock);
// ACTIVATE_MOCK_RV(LL_DMA_GetDataLength, mock, sizeof(struct usartpacket_t) - sizeof(struct usartpacketheader_t) - RoundUpTo4(sizeof(testData)) - sizeof(uint32_t) + 1);
// ACTIVATE_MOCK_RV(Pu_CheckHeader, proxy, 1);
// ACTIVATE_MOCK(LL_DMA_DisableStream, mock);
//
// Pu_HandleUsartIrq(&usartStatus);
//
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_IsActiveFlag_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_IsEnabledIT_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_ClearFlag_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_GetDataLength, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(Pu_CheckHeader, proxy), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_DisableStream, mock), 0);
// EXPECT_EQ(usartStatus.rxBuffers[0].busy, 0);
// EXPECT_EQ(usartStatus.rxBuffers[0].error, 0);
//}
//
//// Packet reception should continue if the packet is shorter than the packet header
//TEST_F(PacketUsart, HandleUsartIrq_idle_tooshortforheadercheck)
//{
// struct usartpacketheader_t fakeHeader = { 0x95, 0, sizeof(testData), 0x95 ^ 0 ^ sizeof(testData) };
//
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_SetupReceive(&usartStatus);
//
// expectedStream = 0;
// memcpy(&usartStatus.rxBuffers[0].packet.header, &fakeHeader, sizeof(fakeHeader));
//
// ACTIVATE_MOCK_RV(LL_USART_IsActiveFlag_IDLE, mock, 1);
// ACTIVATE_MOCK_RV(LL_USART_IsActiveFlag_TC, mock, 0);
// ACTIVATE_MOCK_RV(LL_USART_IsEnabledIT_IDLE, mock, 1);
// ACTIVATE_MOCK_RV(LL_USART_IsEnabledIT_TC, mock, 1);
// ACTIVATE_MOCK(LL_USART_ClearFlag_IDLE, mock);
// ACTIVATE_MOCK_RV(LL_DMA_GetDataLength, mock, sizeof(struct usartpacket_t) - 3);
// ACTIVATE_MOCK_RV(Pu_CheckHeader, proxy, 1);
// ACTIVATE_MOCK(LL_DMA_DisableStream, mock);
//
// Pu_HandleUsartIrq(&usartStatus);
//
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_IsActiveFlag_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_IsEnabledIT_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_USART_ClearFlag_IDLE, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_GetDataLength, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(Pu_CheckHeader, proxy), 0);
// EXPECT_EQ(MOCK_CALLCOUNT(LL_DMA_DisableStream, mock), 0);
// EXPECT_EQ(usartStatus.rxBuffers[0].error, 0);
// EXPECT_EQ(usartStatus.rxBuffers[0].busy, 0);
//}
//
//// Reception DMA engine transfer complete interrupt is the real verification point of the packet
//// verify that the packet is really checked
//TEST_F(PacketUsart, HandleRxDmaIrq_tc_hdrok)
//{
// struct usartpacketheader_t fakeHeader = { 0x95, 0, sizeof(testData), 0x95 ^ 0 ^ sizeof(testData) };
//
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_SetupReceive(&usartStatus);
//
// memset(&fakeDma1, 0, sizeof(fakeDma1));
// memcpy(&usartStatus.rxBuffers[0].packet.header, &fakeHeader, sizeof(fakeHeader));
// expectedStream = 0;
// expectedCrcEnqueueAddress = &usartStatus.rxBuffers[0].packet;
// expectedCrcLength = RoundUpTo4(usartStatus.rxBuffers[0].packet.header.payloadLength) + sizeof(struct usartpacketheader_t);
// fakeDma1.LISR = DMA_LISR_TCIF0;
//
// ACTIVATE_MOCK(Pu_CheckHeader, proxy);
// ACTIVATE_MOCK_RV(Crc_Enqueue, mock, 0);
// ACTIVATE_MOCK(Pu_SetupReceive, mock);
//
// Pu_HandleRxDmaIrq(&usartStatus);
//
// EXPECT_EQ(MOCK_CALLCOUNT(Pu_CheckHeader, proxy), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(Crc_Enqueue, mock), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(Pu_SetupReceive, mock), 1);
// EXPECT_EQ(fakeDma1.LIFCR, DMA_LIFCR_CTCIF0);
// EXPECT_EQ(usartStatus.rxBuffers[0].error, 0);
// EXPECT_EQ(usartStatus.rxBuffers[0].busy, 0);
//}
//
//// In case of the header fails on the end of packet reception error flag should be set
//TEST_F(PacketUsart, HandleRxDmaIrq_tc_hdrfail)
//{
// struct usartpacketheader_t fakeHeader = { 0x95, 0, sizeof(testData), 0xff ^ 0 ^ sizeof(testData) };
//
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_SetupReceive(&usartStatus);
//
// memset(&fakeDma1, 0, sizeof(fakeDma1));
// memcpy(&usartStatus.rxBuffers[0].packet.header, &fakeHeader, sizeof(fakeHeader));
// expectedStream = 0;
// expectedCrcEnqueueAddress = &usartStatus.rxBuffers[0].packet;
// expectedCrcLength = RoundUpTo4(usartStatus.rxBuffers[0].packet.header.payloadLength) + sizeof(struct usartpacketheader_t);
// fakeDma1.LISR = DMA_LISR_TCIF0;
//
// ACTIVATE_MOCK(Pu_CheckHeader, proxy);
// ACTIVATE_MOCK_RV(Crc_Enqueue, mock, 0);
// ACTIVATE_MOCK(Pu_SetupReceive, mock);
//
// Pu_HandleRxDmaIrq(&usartStatus);
//
// EXPECT_EQ(MOCK_CALLCOUNT(Pu_CheckHeader, proxy), 1);
// EXPECT_EQ(MOCK_CALLCOUNT(Crc_Enqueue, mock), 0);
// EXPECT_EQ(fakeDma1.LIFCR, DMA_LIFCR_CTCIF0);
// EXPECT_EQ(usartStatus.rxBuffers[0].error, 1);
// EXPECT_EQ(usartStatus.rxBuffers[0].busy, 0);
//}
//
//// successfull CRC32 check, CRC32 match, callback should be called, busy flag should be set
//TEST_F(PacketUsart, HandleRxCrcComputedCallback_success_match)
//{
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_SetupReceive(&usartStatus);
//
// struct usartpacketheader_t fakeHeader = { 0x95, 0, sizeof(testData), 0xff ^ 0 ^ sizeof(testData) };
// memcpy(&usartStatus.rxBuffers[0].packet.header, &fakeHeader, sizeof(fakeHeader));
// memcpy(usartStatus.rxBuffers[0].packet.payload, &testData, sizeof(testData));
// *(uint32_t*)(usartStatus.rxBuffers[0].packet.payload + RoundUpTo4(sizeof(testData))) = 0xa55a;
// MOCK_CALLCOUNT(FakePacketReceivedCallback, mock) = 0;
//
// Pu_RxCrcComputedCallback(&usartStatus.rxBuffers[0], 0xa55a, 1);
//
// EXPECT_EQ(MOCK_CALLCOUNT(FakePacketReceivedCallback, mock), 1);
// EXPECT_NE(usartStatus.rxBuffers[0].busy, 0);
// EXPECT_EQ(usartStatus.rxBuffers[0].error, 0);
//}
//
//// successfull CRC32 check, CRC32 mismatch, callback should be called,
//// both busy and error flag should be set
//TEST_F(PacketUsart, HandleRxCrcComputedCallback_success_mismatch)
//{
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_SetupReceive(&usartStatus);
//
// struct usartpacketheader_t fakeHeader = { 0x95, 0, sizeof(testData), 0xff ^ 0 ^ sizeof(testData) };
// memcpy(&usartStatus.rxBuffers[0].packet.header, &fakeHeader, sizeof(fakeHeader));
// memcpy(usartStatus.rxBuffers[0].packet.payload, &testData, sizeof(testData));
// *(uint32_t*)(usartStatus.rxBuffers[0].packet.payload + RoundUpTo4(sizeof(testData))) = 0xa5a5;
// MOCK_CALLCOUNT(FakePacketReceivedCallback, mock) = 0;
//
// Pu_RxCrcComputedCallback(&usartStatus.rxBuffers[0], 0xa55a, 1);
//
// EXPECT_EQ(MOCK_CALLCOUNT(FakePacketReceivedCallback, mock), 1);
// EXPECT_NE(usartStatus.rxBuffers[0].busy, 0);
// EXPECT_NE(usartStatus.rxBuffers[0].error, 0);
//}
//
////failed CRC32 check, callback should be called,
//// both busy and error flag should be set
//TEST_F(PacketUsart, HandleRxCrcComputedCallback_failure)
//{
// Pu_Init(&usartStatus, &fakeUsart, DMA1, 0, 7, &crcStatus, FakePacketReceivedCallback_mock, &fakePacketReceivedCallbackParam);
// Pu_SetupReceive(&usartStatus);
//
// struct usartpacketheader_t fakeHeader = { 0x95, 0, sizeof(testData), 0xff ^ 0 ^ sizeof(testData) };
// memcpy(&usartStatus.rxBuffers[0].packet.header, &fakeHeader, sizeof(fakeHeader));
// memcpy(usartStatus.rxBuffers[0].packet.payload, &testData, sizeof(testData));
// *(uint32_t*)(usartStatus.rxBuffers[0].packet.payload + RoundUpTo4(sizeof(testData))) = 0xa5a5;
// MOCK_CALLCOUNT(FakePacketReceivedCallback, mock) = 0;
//
// Pu_RxCrcComputedCallback(&usartStatus.rxBuffers[0], 0xa55a, 1);
//
// EXPECT_EQ(MOCK_CALLCOUNT(FakePacketReceivedCallback, mock), 1);
// EXPECT_NE(usartStatus.rxBuffers[0].busy, 0);
// EXPECT_NE(usartStatus.rxBuffers[0].error, 0);
//}

View file

@ -1,2 +0,0 @@
/*_x86/

View file

@ -1,12 +0,0 @@
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
;
[subrepo]
remote = git@github.com:compihu/platform-test-f4-ll.git
branch = master
commit = bc411341f3ce6cc3ede4eb2f46f8bb083805febc
parent = 46ce55c6a0a2d420ac50b2147e9bd7a3a6f17620
method = merge
cmdver = 0.4.3

View file

@ -1,6 +0,0 @@
#!/bin/bash
SCRIPTDIR=$(readlink -f $(dirname "$0"))
cd "$SCRIPTDIR"/cpputest/cpputest_build
cmake -DCPPUTEST_C_FLAGS=-m32 -DCPPUTEST_CXX_FLAGS=-m32 -DCPPUTEST_LD_FLAGS=-m32 \
-DC++11=ON -DTESTS=OFF -DCMAKE_INSTALL_PREFIX:PATH="$SCRIPTDIR"/cpputest_x86 ..
make -j$(nproc) && make install

View file

@ -1,5 +0,0 @@
#!/bin/bash
SCRIPTDIR=$(readlink -f $(dirname "$0"))
cd "$SCRIPTDIR"/subhook
cmake -DSUBHOOK_FORCE_32BIT=1 -DSUBHOOK_STATIC=1 -DSUBHOOK_TESTS=0 -DCMAKE_INSTALL_PREFIX:PATH="$SCRIPTDIR/subhook_x86" .
make -j$(nproc) && make install

View file

@ -1,23 +0,0 @@
SELF_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
REL_DIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
ifeq ($(MKDBG), 1)
$(info >>> $(REL_DIR)/component.mk)
endif
$(eval C_SOURCES += $(wildcard $(REL_DIR)/platform/*.c))
$(eval COMMON_INCLUDES += \
-I$(REL_DIR) \
-I$(REL_DIR)/cpputest_i386/include \
-I$(REL_DIR)/subhook_i386/include)
$(eval LIBDIR += -L$(REL_DIR)/cpputest_i386/lib -L$(REL_DIR)/subhook_i386/lib)
$(eval LIBS += -lCppUTestExt -lCppUTest -lsubhook -lpthread)
$(eval COMPONENT_DEPS += $(REL_DIR)/cpputest_i386 $(REL_DIR)/subhook_i386)
$(REL_DIR)/cpputest_i386:
$(REL_DIR)/build_cpputest.sh
$(REL_DIR)/subhook_i386:
$(REL_DIR)/build_subhook.sh
ifeq ($(MKDBG), 1)
$(info <<<)
endif

View file

@ -1,141 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.581606933">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.581606933" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" description="" id="0.581606933" name="Debug" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.581606933." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.69076608" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.69076608.481036739" name=""/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/CppUTest}/cpputest_build" enableAutoBuild="true" id="org.eclipse.cdt.build.core.settings.default.builder.463471977" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.980890779" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.497481341" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1586102941" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;../${ECLIPSE_STDLIB}&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.914890443" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.946693891" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1938278235" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;../${ECLIPSE_STDLIB}&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1381830975" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.456763257" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.197274960" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;../${ECLIPSE_STDLIB}&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1106915402" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="0.581606933.864112877">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.581606933.864112877" moduleId="org.eclipse.cdt.core.settings" name="Check">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" description="" id="0.581606933.864112877" name="Check" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.581606933.864112877." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.427728365" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.427728365.725959122" name=""/>
<builder autoBuildTarget="tdd" buildPath="${workspace_loc:/CppUTest}/cpputest_build" enableAutoBuild="true" id="org.eclipse.cdt.build.core.settings.default.builder.1430383305" incrementalBuildTarget="tdd" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1899717736" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.1251878891" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.626609223" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;../${ECLIPSE_STDLIB}&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1247926451" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1076507031" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.18163399" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;../${ECLIPSE_STDLIB}&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.183401918" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.766024099" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.620775716" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;../${ECLIPSE_STDLIB}&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.474872889" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="CppUTest.null.1334537591" name="CppUTest"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="0.581606933">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Default">
<resource resourceType="PROJECT" workspacePath="/CppUTest"/>
</configuration>
<configuration configurationName="Check">
<resource resourceType="PROJECT" workspacePath="/CppUTest"/>
</configuration>
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/CppUTest"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="extensions" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>extensions</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="examples" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>examples</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="cleanExamples" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>cleanExamples</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>

View file

@ -1,20 +0,0 @@
* text=auto
*.c text
*.h text
*.cpp text
# Windows files
*.sln text eol=crlf
*.bat text eol=crlf
*.dsp text eol=crlf
*.dsw text eol=crlf
*.dep text eol=crlf
*.mak text eol=crlf
*.vcproj text eol=crlf
*.vcxproj text eol=crlf
*.sh text
*.ac text
*.am text

View file

@ -1,94 +0,0 @@
.DS_Store
*.swp
*.*~
.*~
*.d
*.o
*.a
.settings
*doxygen*
*.gcov
*.gcno
*.gcda
*_tests
*_cslim
*a.out
*.zip
tmp
pdfs
*.map
gcov
objs
lib
*_tests.txt
gcov*.html
ErrorLogs
testResults
.metadata
/ipch
Debug
Release
*/Debug/*
*/Release/*
*.exe
*.obj
*.ncb
*.opt
*.plg
*.idb
*.pdb
*.suo
*.sdf
*.opensdf
*.lib
*.log
*.tlog
*.cache
*.user
*.VC.db
*.VC.opendb
_build_
_build
builds/*gcc*
cpputest_build/Makefile
cpputest_build/generated
cpputest_build/src
cpputest_build/tests
/.deps
CppUTestExtTests
CppUTestTests
/Makefile
config.h
config.h.in
config.status
cpputest.pc
filename.map.txt
libtool
stamp-h1
INSTALL
Makefile.in
aclocal.m4
compile
config.guess
config.sub
configure
depcomp
install-sh
ltmain.sh
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
missing
test-driver
platforms/iar/settings
cpputest_*.xml
generated/
*.deps/
*.dirstamp
*.trs
#IAR automatically generated files
*.dep
*.ewt

View file

@ -1,12 +0,0 @@
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
;
[subrepo]
remote = git@github.com:cpputest/cpputest.git
branch = master
commit = 138c775b607b55d0fc4d2fcb072e8f71682989f5
parent = 03b975b8a2c934b3b62722af48313716387daff4
method = merge
cmdver = 0.4.3

View file

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CppUTest</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View file

@ -1,152 +0,0 @@
#Mon Jun 07 17:30:05 SGT 2010
eclipse.preferences.version=1
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
org.eclipse.cdt.core.formatter.alignment_for_compact_if=0
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=next_line
org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=next_line
org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=next_line
org.eclipse.cdt.core.formatter.compact_else_if=true
org.eclipse.cdt.core.formatter.continuation_indentation=2
org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
org.eclipse.cdt.core.formatter.indent_empty_lines=false
org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.cdt.core.formatter.indentation.size=4
org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=true
org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=true
org.eclipse.cdt.core.formatter.lineSplit=200
org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.cdt.core.formatter.tabulation.char=tab
org.eclipse.cdt.core.formatter.tabulation.size=4
org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false

View file

@ -1,4 +0,0 @@
#Tue Dec 29 09:23:19 SGT 2009
eclipse.preferences.version=1
formatter_profile=_CppUTest Coding Style
formatter_settings_version=1

View file

@ -1,196 +0,0 @@
# Global environment
language: cpp
os: linux
dist: bionic
# Avoid double build because of the tagging in the build.
branches:
except:
- latest-passing-build
# Build stages and the conditionals for the stages
stages:
- name: extensive daily tests
if: type = cron
- name: basic build & test
if: type != cron
- name: extended build & test
if: type != cron
- name: deploy latest
if: "(NOT type IN (pull_request)) AND (branch = master) AND (type != cron)"
jobs:
include:
# Basic builds
# Mac OSX
- stage: basic build & test
compiler: gcc
os: osx
env: BUILD=autotools
- compiler: clang
env: BUILD=autotools
os: osx
# Windows
- compiler: msbuild
os: windows
env: BUILD=vc_windows CPP_STD=17
- MSBUILD_PATH="c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
- VCTargetsPath="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets"
# Linux
- compiler: gcc
env: BUILD=cmake CPP_STD=17
- compiler: gcc
env: BUILD=autotools
- compiler: clang
env: BUILD=autotools
# Extended builds, different C++ version and build tools
- stage: extended build & test
# Mac OSX
compiler: clang
os: osx
env: BUILD=cmake CPP_STD=17
- compiler: gcc
os: osx
env: BUILD=cmake CPP_STD=14
# Linux
# CMake different C++ versions with clang
- compiler: clang
env: BUILD=cmake CPP_STD=98
- compiler: clang
env: BUILD=cmake CPP_STD=11
- compiler: clang
env: BUILD=cmake CPP_STD=14
- compiler: clang
env: BUILD=cmake CPP_STD=17
# CMake different C++ versions with gcc
- compiler: gcc
env: BUILD=cmake CPP_STD=98
- compiler: gcc
env: BUILD=cmake CPP_STD=11
- compiler: gcc
env: BUILD=cmake CPP_STD=14
- compiler: gcc
env: BUILD=cmake CPP_STD=17
# New compilers can be added here. Need to be cleared when compiler becomes standard
- compiler: gcc
env: BUILD=cmake CPP_STD=17
- CC=gcc-10
- CXX=g++-10
addons:
apt:
packages: ['g++-10']
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
- compiler: clang
env: BUILD=cmake CPP_STD=17
- CC=clang-11
- CXX=clang++-11
addons:
apt:
sources:
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
packages: ['clang-11', 'libc++-11-dev', 'libc++abi-11-dev']
# Specific other tests
- compiler: gcc
env: BUILD=test_report
addons:
apt:
packages:
- ant-optional
- compiler: gcc
env: BUILD=cmake_coverage
- compiler: gcc
env: BUILD=cmake_gtest
- compiler: clang
env: BUILD=autotools_gtest
- compiler: gcc
env: BUILD=autotools_cmake_install_test
# MS DOS Build
- env: BUILD=make_dos
addons:
apt:
packages:
- dosbox
# Docker images. Need to be cleared at times
- env: BUILD=docker_ubuntu_autotools
- env: BUILD=docker_ubuntu_dos
- env: BUILD=autotools_dist
- stage: extensive daily tests
compiler: gcc
env: BUILD=extensive_check
- compiler: clang
env: BUILD=extensive_check
- arch: ppc64le
compiler: gcc
env: BUILD=autotools
- arch: s390x
compiler: gcc
env: BUILD=autotools
- arch: arm64
compiler: gcc
env: BUILD=autotools
- compiler: gcc
env: BUILD=makefileworker
- compiler: clang
env: BUILD=autotools_install_and_test_examples
# Deploy to github releases
- stage: deploy latest
env: BUILD=autotools_dist
script:
- export DATE=`date`
- git tag -f latest-passing-build -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER at $DATE"
- git push -f https://cpputest-travis:$GH_TOKEN@github.com/cpputest/cpputest.git --tags
- ../scripts/travis_ci_build.sh
- pwd
- ls
deploy:
provider: releases
#:
edge: true
token: $GH_TOKEN
tag_name: latest-passing-build
name: Latest passing build
release_notes: "This is the automatic release from Travis CI.\n\nWhenever a build passes, it gets released as Latest Passing Build.\n\nBuild number: $TRAVIS_BUILD_NUMBER\nDate: $DATE\nLog: $TRAVIS_BUILD_WEB_URL"
file:
- cpputest-latest.tar.gz
- cpputest-latest.zip
overwrite: true
on:
tags: false
before_script:
- export CPPUTEST_BUILD_DIR=$TRAVIS_BUILD_DIR/cpputest_build
- mkdir -p $CPPUTEST_BUILD_DIR && cd $CPPUTEST_BUILD_DIR
script:
- "../scripts/travis_ci_build.sh"
after_failure:
- "../scripts/travis_ci_after.sh"
after_success:
- "../scripts/travis_ci_after.sh"
notifications:
slack:
secure: oOx4AGIiJB+j1pkIxlLeQh5qp7TF89Sj+3RzJRQuo6z0HocTz9yJgXPlDh1H9rLj5SxK/UKsk+WFafVuPdWakQ40LeYO49C/+e+mCDcS0ujLka6dvIE8v0SEb1PuaAGjJWdhiviAhSqu9YOKPYZs37lD3oqepuEpxeiXwsur9QU=
env:
global:
secure: H6djbn5YP1P62n//ergaRZ4lIkneCzWp1Ok4F71kvvNiwlRzYDGll4kJT6MhVq6bBHeR81W/lwUd+RdjyqsJpVhj7DHXC/0k0h0xpAAm7LUhOl+6mIII1uhcMFqbeHvilwvDCzTQ6qv8Mzd1g0QfUECrmti9/U+/TTFJG0r0Zuc=

View file

@ -1,5 +0,0 @@
The current main authors of CppUTest are James Grenning and Bas Vodde.
Thanks for all the other contributions. You can find them on github at:
https://github.com/cpputest/cpputest/graphs/contributors

View file

@ -1,223 +0,0 @@
# 2.6.3 is needed for ctest support
# 3.1 is needed for target_sources
cmake_minimum_required(VERSION 3.1)
project(CppUTest)
set(CppUTest_version_major 4)
set(CppUTest_version_minor 0)
###############
# Conan support
###############
if (EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
message(STATUS "conan_basic_setup()")
conan_basic_setup()
endif()
# Check for functions before setting a lot of stuff
include(CheckFunctionExists)
set (CMAKE_REQUIRED_INCLUDES "unistd.h")
check_function_exists(fork HAVE_FORK)
if(HAVE_FORK)
add_definitions(-DCPPUTEST_HAVE_FORK)
endif(HAVE_FORK)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
if(HAVE_GETTIMEOFDAY)
add_definitions(-DCPPUTEST_HAVE_GETTIMEOFDAY=1)
endif(HAVE_GETTIMEOFDAY)
check_function_exists(pthread_mutex_lock HAVE_PTHREAD_MUTEX_LOCK)
if(HAVE_PTHREAD_MUTEX_LOCK)
add_definitions(-DCPPUTEST_HAVE_PTHREAD_MUTEX_LOCK=1)
endif(HAVE_PTHREAD_MUTEX_LOCK)
if (NOT IAR)
check_function_exists(strdup HAVE_STRDUP)
if(HAVE_STRDUP)
add_definitions(-DCPPUTEST_HAVE_STRDUP=1)
endif(HAVE_STRDUP)
endif(NOT IAR)
if (MINGW)
# Apply workaround for MinGW timespec redefinition (pthread.h / time.h)
include(CheckStructHasMember)
check_struct_has_member("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC)
if (HAVE_STRUCT_TIMESPEC)
add_definitions(-D_TIMESPEC_DEFINED=1)
endif()
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Apply workaround for static/shared libraries on MinGW C/C++ compiler
# Issue occurs with CMake >= 3.9.0, it doesn't filter out gcc,gcc_s,gcc_eh from
# the implicit library list anymore, so the C++ linker is getting passed the static
# gcc_eh library since that's what the C linker uses by default. Only solution appears
# to be to force static linkage.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
endif()
endif()
option(STD_C "Use the standard C library" ON)
option(STD_CPP "Use the standard C++ library" ON)
option(CPPUTEST_FLAGS "Use the CFLAGS/CXXFLAGS/LDFLAGS set by CppUTest" ON)
option(MEMORY_LEAK_DETECTION "Enable memory leak detection" ON)
option(EXTENSIONS "Use the CppUTest extension library" ON)
option(LONGLONG "Support long long" OFF)
option(MAP_FILE "Enable the creation of a map file" OFF)
option(COVERAGE "Enable running with coverage" OFF)
option(C++11 "Compile with C++11 support" OFF)
option(WERROR "Compile with warnings as errors" OFF)
option(TESTS "Compile and make tests for the code?" ON)
option(TESTS_DETAILED "Run each test separately instead of grouped?" OFF)
option(TESTS_BUILD_DISCOVER "Build time test discover" ON)
option(EXAMPLES "Compile and make examples?" OFF)
option(VERBOSE_CONFIG "Print configuration to stdout during generation" ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "What kind of build this is" FORCE)
endif(NOT CMAKE_BUILD_TYPE)
# Pkg-config file
include(FindPkgConfig)
set(CppUTest_PKGCONFIG_FILE cpputest.pc)
set(CppUTestRootDirectory ${PROJECT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CppUTestRootDirectory}/cmake/Modules)
include("${CppUTestRootDirectory}/cmake/Modules/CppUTestConfigurationOptions.cmake")
include(CTest)
#include("${CppUTestRootDirectory}/cmake/Modules/CheckFunctionExists.cmake")
include("${CppUTestRootDirectory}/cmake/Modules/CppUTestBuildTimeDiscoverTests.cmake")
include("${CppUTestRootDirectory}/cmake/Modules/CppUTestNormalizeTestOutputLocation.cmake")
include(GNUInstallDirs)
enable_testing()
configure_file (
"${PROJECT_SOURCE_DIR}/config.h.cmake"
"${PROJECT_BINARY_DIR}/generated/CppUTestGeneratedConfig.h"
)
include_directories(${PROJECT_BINARY_DIR})
add_definitions(-DHAVE_CONFIG_H)
include_directories(${CppUTestRootDirectory}/include)
add_subdirectory(src/CppUTest)
if (EXTENSIONS)
add_subdirectory(src/CppUTestExt)
endif (EXTENSIONS)
if (TESTS)
add_subdirectory(tests/CppUTest)
if (EXTENSIONS)
add_subdirectory(tests/CppUTestExt)
endif (EXTENSIONS)
endif (TESTS)
if (EXAMPLES)
add_subdirectory(examples)
endif(EXAMPLES)
set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
set (INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
# Pkg-config file.
set (prefix "${CMAKE_INSTALL_PREFIX}")
set (exec_prefix "\${prefix}")
set (libdir "\${exec_prefix}/${LIB_INSTALL_DIR}")
set (includedir "\${prefix}/${INCLUDE_INSTALL_DIR}")
set (PACKAGE_VERSION "${CppUTest_version_major}.${CppUTest_version_minor}")
configure_file (cpputest.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${CppUTest_PKGCONFIG_FILE} @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CppUTest_PKGCONFIG_FILE}
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/generated/CppUTestGeneratedConfig.h"
DESTINATION "${INCLUDE_INSTALL_DIR}/CppUTest"
)
# Try to include helper module
include(CMakePackageConfigHelpers OPTIONAL
RESULT_VARIABLE PkgHelpers_AVAILABLE)
# guard against older versions of cmake which do not provide it
if(PkgHelpers_AVAILABLE)
configure_package_config_file(CppUTestConfig.cmake.install.in
${CMAKE_CURRENT_BINARY_DIR}/install/CppUTestConfig.cmake
INSTALL_DESTINATION ${LIB_INSTALL_DIR}/CppUTest/cmake
PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/install/CppUTestConfigVersion.cmake
VERSION ${CppUTest_version_major}.${CppUTest_version_minor}
COMPATIBILITY SameMajorVersion )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/install/CppUTestConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/install/CppUTestConfigVersion.cmake
DESTINATION ${LIB_INSTALL_DIR}/CppUTest/cmake )
install(EXPORT CppUTestTargets
DESTINATION ${LIB_INSTALL_DIR}/CppUTest/cmake)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Scripts/CppUTestBuildTimeDiscoverTests.cmake
DESTINATION ${LIB_INSTALL_DIR}/CppUTest/cmake/Scripts)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/CppUTestBuildTimeDiscoverTests.cmake
DESTINATION ${LIB_INSTALL_DIR}/CppUTest/cmake/Modules)
configure_package_config_file(CppUTestConfig.cmake.build.in
${CMAKE_CURRENT_BINARY_DIR}/CppUTestConfig.cmake
INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
PATH_VARS INCLUDE_DIR CMAKE_CURRENT_BINARY_DIR)
if (EXTENSIONS)
export(TARGETS CppUTest CppUTestExt
FILE "${CMAKE_CURRENT_BINARY_DIR}/CppUTestTargets.cmake")
else()
export(TARGETS CppUTest
FILE "${CMAKE_CURRENT_BINARY_DIR}/CppUTestTargets.cmake")
endif()
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/CppUTestConfigVersion.cmake
VERSION ${CppUTest_version_major}.${CppUTest_version_minor}
COMPATIBILITY SameMajorVersion )
set(CppUTest_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "The directory containing a CMake configuration file for CppUTest.")
else()
message("If you wish to use find_package(CppUTest) in your own project to find CppUTest library"
" please update cmake to version which provides CMakePackageConfighelpers module"
" or write generators for CppUTestConfig.cmake by yourself.")
endif()
if(VERBOSE_CONFIG)
message("
-------------------------------------------------------
CppUTest Version ${CppUTest_version_major}.${CppUTest_version_minor}
Current compiler options:
CC: ${CMAKE_C_COMPILER}
CXX: ${CMAKE_CXX_COMPILER}
CppUTest CFLAGS: ${CPPUTEST_C_FLAGS}
CppUTest CXXFLAGS: ${CPPUTEST_CXX_FLAGS}
CppUTest LDFLAGS: ${CPPUTEST_LD_FLAGS}
Features configured in CppUTest:
Memory Leak Detection: ${MEMORY_LEAK_DETECTION}
Compiling Extensions: ${EXTENSIONS}
Support Long Long: ${LONGLONG}
Use CppUTest flags: ${CPPUTEST_FLAGS}
Using Standard C library: ${STD_C}
Using Standard C++ library: ${STD_CPP}
Using C++11 library: ${C++11}
Generating map file: ${MAP_FILE}
Compiling with coverage: ${COVERAGE}
Compile and run self-tests ${TESTS}
Run self-tests separately ${TESTS_DETAILED}
-------------------------------------------------------
")
endif()

View file

@ -1,10 +0,0 @@
Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -1,4 +0,0 @@
For changelog check the github page:
https://github.com/cpputest/cpputest

View file

@ -1,29 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AllTests", "tests\AllTests.vcproj", "{E66A12BB-1E17-4CFE-A358-9E0FA85E0F15}"
ProjectSection(ProjectDependencies) = postProject
{EC28C821-4AB8-458F-A821-C6E65607B781} = {EC28C821-4AB8-458F-A821-C6E65607B781}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppUTest", "CppUTest.vcproj", "{EC28C821-4AB8-458F-A821-C6E65607B781}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E66A12BB-1E17-4CFE-A358-9E0FA85E0F15}.Debug|Win32.ActiveCfg = Debug|Win32
{E66A12BB-1E17-4CFE-A358-9E0FA85E0F15}.Debug|Win32.Build.0 = Debug|Win32
{E66A12BB-1E17-4CFE-A358-9E0FA85E0F15}.Release|Win32.ActiveCfg = Release|Win32
{E66A12BB-1E17-4CFE-A358-9E0FA85E0F15}.Release|Win32.Build.0 = Release|Win32
{EC28C821-4AB8-458F-A821-C6E65607B781}.Debug|Win32.ActiveCfg = Debug|Win32
{EC28C821-4AB8-458F-A821-C6E65607B781}.Debug|Win32.Build.0 = Debug|Win32
{EC28C821-4AB8-458F-A821-C6E65607B781}.Release|Win32.ActiveCfg = Release|Win32
{EC28C821-4AB8-458F-A821-C6E65607B781}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load diff

View file

@ -1,298 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F468F539-27BD-468E-BE64-DDE641400B51}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">lib\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cpputest_build\Debug\$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cpputest_build\Debug\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">lib\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cpputest_build\Release\$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cpputest_build\Release\$(ProjectName)\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)d</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)d</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;.\include\Platforms\VisualCpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;STDC_WANT_SECURE_LIB;CPPUTEST_USE_LONG_LONG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug/CppUTestd.bsc</OutputFile>
</Bscmake>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent />
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;.\include\Platforms\VisualCpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;STDC_WANT_SECURE_LIB;CPPUTEST_USE_LONG_LONG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug/CppUTestd.bsc</OutputFile>
</Bscmake>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent />
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;.\include\Platforms\VisualCpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;STDC_WANT_SECURE_LIB;CPPUTEST_USE_LONG_LONG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Release/CppUTest.bsc</OutputFile>
</Bscmake>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent />
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;.\include\Platforms\VisualCpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;STDC_WANT_SECURE_LIB;CPPUTEST_USE_LONG_LONG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Release/CppUTest.bsc</OutputFile>
</Bscmake>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent />
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\CppUTestExt\CodeMemoryReportFormatter.cpp" />
<ClCompile Include="src\CppUTestExt\GTest.cpp" />
<ClCompile Include="src\CppUTestExt\IEEE754ExceptionsPlugin.cpp" />
<ClCompile Include="src\CppUTestExt\MemoryReportAllocator.cpp" />
<ClCompile Include="src\CppUTestExt\MemoryReporterPlugin.cpp" />
<ClCompile Include="src\CppUTestExt\MemoryReportFormatter.cpp" />
<ClCompile Include="src\CppUTestExt\MockActualCall.cpp" />
<ClCompile Include="src\CppUTestExt\MockExpectedCall.cpp" />
<ClCompile Include="src\CppUTestExt\MockExpectedCallsList.cpp" />
<ClCompile Include="src\CppUTestExt\MockFailure.cpp" />
<ClCompile Include="src\CppUTestExt\MockNamedValue.cpp" />
<ClCompile Include="src\CppUTestExt\MockSupport.cpp" />
<ClCompile Include="src\CppUTestExt\MockSupportPlugin.cpp" />
<ClCompile Include="src\CppUTestExt\MockSupport_c.cpp" />
<ClCompile Include="src\CppUTestExt\OrderedTest.cpp" />
<ClCompile Include="src\CppUTest\CommandLineArguments.cpp" />
<ClCompile Include="src\CppUTest\CommandLineTestRunner.cpp" />
<ClCompile Include="src\CppUTest\JUnitTestOutput.cpp" />
<ClCompile Include="src\CppUTest\TeamCityTestOutput.cpp" />
<ClCompile Include="src\CppUTest\MemoryLeakDetector.cpp" />
<ClCompile Include="src\CppUTest\MemoryLeakWarningPlugin.cpp" />
<ClCompile Include="src\CppUTest\SimpleMutex.cpp" />
<ClCompile Include="src\CppUTest\SimpleString.cpp" />
<ClCompile Include="src\CppUTest\SimpleStringInternalCache.cpp" />
<ClCompile Include="src\CppUTest\TestFailure.cpp" />
<ClCompile Include="src\CppUTest\TestFilter.cpp" />
<ClCompile Include="src\CppUTest\TestHarness_c.cpp" />
<ClCompile Include="src\CppUTest\TestMemoryAllocator.cpp" />
<ClCompile Include="src\CppUTest\TestOutput.cpp" />
<ClCompile Include="src\CppUTest\TestPlugin.cpp" />
<ClCompile Include="src\CppUTest\TestRegistry.cpp" />
<ClCompile Include="src\CppUTest\TestResult.cpp" />
<ClCompile Include="src\CppUTest\TestTestingFixture.cpp" />
<ClCompile Include="src\CppUTest\Utest.cpp" />
<ClCompile Include="src\Platforms\VisualCpp\UtestPlatform.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\CppUTestExt\CodeMemoryReportFormatter.h" />
<ClInclude Include="include\CppUTestExt\GMock.h" />
<ClInclude Include="include\CppUTestExt\GTest.h" />
<ClInclude Include="include\CppUTestExt\GTestSupport.h" />
<ClInclude Include="include\CppUTestExt\GTestConvertor.h" />
<ClInclude Include="include\cpputestext\ieee754exceptionsplugin.h" />
<ClInclude Include="include\CppUTestExt\MemoryReportAllocator.h" />
<ClInclude Include="include\CppUTestExt\MemoryReporterPlugin.h" />
<ClInclude Include="include\CppUTestExt\MemoryReportFormatter.h" />
<ClInclude Include="include\CppUTestExt\MockActualCall.h" />
<ClInclude Include="include\CppUTestExt\MockCheckedActualCall.h" />
<ClInclude Include="include\CppUTestExt\MockCheckedExpectedCall.h" />
<ClInclude Include="include\CppUTestExt\MockExpectedCall.h" />
<ClInclude Include="include\CppUTestExt\MockExpectedCallsList.h" />
<ClInclude Include="include\CppUTestExt\MockFailure.h" />
<ClInclude Include="include\CppUTestExt\MockNamedValue.h" />
<ClInclude Include="include\CppUTestExt\MockSupport.h" />
<ClInclude Include="include\CppUTestExt\MockSupportPlugin.h" />
<ClInclude Include="include\CppUTestExt\MockSupport_c.h" />
<ClInclude Include="include\CppUTestExt\OrderedTest.h" />
<ClInclude Include="include\CppUTest\CommandLineArguments.h" />
<ClInclude Include="include\CppUTest\CommandLineTestRunner.h" />
<ClInclude Include="include\cpputest\cpputestconfig.h" />
<ClInclude Include="include\CppUTest\CppUTestGeneratedConfig.h" />
<ClInclude Include="include\CppUTest\JUnitTestOutput.h" />
<ClInclude Include="include\cpputest\platformspecificfunctions_c.h" />
<ClInclude Include="include\CppUTest\TeamCityTestOutput.h" />
<ClInclude Include="include\CppUTest\MemoryLeakDetector.h" />
<ClInclude Include="include\CppUTest\MemoryLeakDetectorMallocMacros.h" />
<ClInclude Include="include\CppUTest\MemoryLeakDetectorNewMacros.h" />
<ClInclude Include="include\CppUTest\MemoryLeakWarningPlugin.h" />
<ClInclude Include="include\CppUTest\PlatformSpecificFunctions.h" />
<ClInclude Include="include\CppUTest\SimpleMutex.h" />
<ClInclude Include="include\CppUTest\SimpleString.h" />
<ClInclude Include="include\CppUTest\SimpleStringInternalCache.h" />
<ClInclude Include="include\CppUTest\StandardCLibrary.h" />
<ClInclude Include="include\CppUTest\TestFailure.h" />
<ClInclude Include="include\CppUTest\TestFilter.h" />
<ClInclude Include="include\CppUTest\TestHarness.h" />
<ClInclude Include="include\CppUTest\TestHarness_c.h" />
<ClInclude Include="include\CppUTest\TestMemoryAllocator.h" />
<ClInclude Include="include\CppUTest\TestOutput.h" />
<ClInclude Include="include\CppUTest\TestPlugin.h" />
<ClInclude Include="include\CppUTest\TestRegistry.h" />
<ClInclude Include="include\CppUTest\TestResult.h" />
<ClInclude Include="include\CppUTest\TestTestingFixture.h" />
<ClInclude Include="include\CppUTest\Utest.h" />
<ClInclude Include="include\CppUTest\UtestMacros.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,9 +0,0 @@
@PACKAGE_INIT@
set_and_check(CppUTest_INCLUDE_DIRS "@PACKAGE_INCLUDE_DIR@")
if(NOT TARGET CppUTest)
include("${CMAKE_CURRENT_LIST_DIR}/CppUTestTargets.cmake")
endif()
set(CppUTest_LIBRARIES CppUTest CppUTestExt)
check_required_components(CppUTest)

View file

@ -1,8 +0,0 @@
@PACKAGE_INIT@
set_and_check(CppUTest_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
include("${CMAKE_CURRENT_LIST_DIR}/CppUTestTargets.cmake")
set(CppUTest_LIBRARIES CppUTest CppUTestExt)
include("${CMAKE_CURRENT_LIST_DIR}/Modules/CppUTestBuildTimeDiscoverTests.cmake")
check_required_components(CppUTest)

View file

@ -1,36 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AllTests", "tests\AllTests.vcxproj", "{913088F6-37C0-4195-80E9-548C7C5303CB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppUTest", "CppUTest.vcxproj", "{F468F539-27BD-468E-BE64-DDE641400B51}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{913088F6-37C0-4195-80E9-548C7C5303CB}.Debug|Win32.ActiveCfg = Debug|Win32
{913088F6-37C0-4195-80E9-548C7C5303CB}.Debug|Win32.Build.0 = Debug|Win32
{913088F6-37C0-4195-80E9-548C7C5303CB}.Debug|x64.ActiveCfg = Debug|x64
{913088F6-37C0-4195-80E9-548C7C5303CB}.Debug|x64.Build.0 = Debug|x64
{913088F6-37C0-4195-80E9-548C7C5303CB}.Release|Win32.ActiveCfg = Release|Win32
{913088F6-37C0-4195-80E9-548C7C5303CB}.Release|Win32.Build.0 = Release|Win32
{913088F6-37C0-4195-80E9-548C7C5303CB}.Release|x64.ActiveCfg = Release|x64
{913088F6-37C0-4195-80E9-548C7C5303CB}.Release|x64.Build.0 = Release|x64
{F468F539-27BD-468E-BE64-DDE641400B51}.Debug|Win32.ActiveCfg = Debug|Win32
{F468F539-27BD-468E-BE64-DDE641400B51}.Debug|Win32.Build.0 = Debug|Win32
{F468F539-27BD-468E-BE64-DDE641400B51}.Debug|x64.ActiveCfg = Debug|x64
{F468F539-27BD-468E-BE64-DDE641400B51}.Debug|x64.Build.0 = Debug|x64
{F468F539-27BD-468E-BE64-DDE641400B51}.Release|Win32.ActiveCfg = Release|Win32
{F468F539-27BD-468E-BE64-DDE641400B51}.Release|Win32.Build.0 = Release|Win32
{F468F539-27BD-468E-BE64-DDE641400B51}.Release|x64.ActiveCfg = Release|x64
{F468F539-27BD-468E-BE64-DDE641400B51}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load diff

View file

@ -1,441 +0,0 @@
ACLOCAL_AMFLAGS = -I m4
CPPUTEST_TESTS = CppUTestTests
CPPUTESTEXT_TESTS = CppUTestExtTests
EXTRA_LIBRARIES = lib/libCppUTestExt.a
EXTRA_PROGRAMS = CppUTestExtTests
lib_LIBRARIES = lib/libCppUTest.a
check_PROGRAMS = $(CPPUTEST_TESTS)
if INCLUDE_CPPUTEST_EXT
lib_LIBRARIES+= lib/libCppUTestExt.a
check_PROGRAMS += $(CPPUTESTEXT_TESTS)
endif
if INCLUDE_GMOCKTESTS
# check_PROGRAMS += GTestTests
endif
TESTS = $(check_PROGRAMS)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = cpputest.pc
cmakemodulesdir = $(libdir)/CppUTest/cmake/Modules
cmakemodules_DATA = \
cmake/Modules/CppUTestBuildTimeDiscoverTests.cmake
cmakescriptsdir = $(libdir)/CppUTest/cmake/Scripts
cmakescripts_DATA = \
cmake/Scripts/CppUTestBuildTimeDiscoverTests.cmake
cmakedir = $(libdir)/CppUTest/cmake
cmake_DATA = \
build/cmake_package_files/CppUTestConfig.cmake \
build/cmake_package_files/CppUTestConfigVersion.cmake \
build/cmake_package_files/CppUTestTargets-relwithdebinfo.cmake \
build/cmake_package_files/CppUTestTargets.cmake
EXTRA_DIST = \
cpputest.pc.in \
$(ALL_FILES_IN_GIT)
lib_libCppUTest_a_CPPFLAGS = $(AM_CPPFLAGS) $(CPPUTEST_CPPFLAGS) $(CPPUTEST_ADDITIONAL_CPPFLAGS)
lib_libCppUTest_a_CFLAGS = $(AM_CFLAGS) $(CPPUTEST_CFLAGS) $(CPPUTEST_ADDITIONAL_CFLAGS)
lib_libCppUTest_a_CXXFLAGS = $(AM_CXXFLAGS) $(CPPUTEST_CXXFLAGS) $(CPPUTEST_ADDITIONAL_CXXFLAGS)
lib_libCppUTest_a_SOURCES = \
src/CppUTest/CommandLineArguments.cpp \
src/CppUTest/CommandLineTestRunner.cpp \
src/CppUTest/JUnitTestOutput.cpp \
src/CppUTest/MemoryLeakDetector.cpp \
src/CppUTest/MemoryLeakWarningPlugin.cpp \
src/CppUTest/SimpleString.cpp \
src/CppUTest/SimpleStringInternalCache.cpp \
src/CppUTest/SimpleMutex.cpp \
src/CppUTest/TeamCityTestOutput.cpp \
src/CppUTest/TestFailure.cpp \
src/CppUTest/TestFilter.cpp \
src/CppUTest/TestHarness_c.cpp \
src/CppUTest/TestMemoryAllocator.cpp \
src/CppUTest/TestOutput.cpp \
src/CppUTest/TestPlugin.cpp \
src/CppUTest/TestRegistry.cpp \
src/CppUTest/TestResult.cpp \
src/CppUTest/TestTestingFixture.cpp \
src/CppUTest/Utest.cpp \
src/Platforms/@CPP_PLATFORM@/UtestPlatform.cpp
include_cpputestdir = $(includedir)/CppUTest
include_cpputest_HEADERS = \
include/CppUTest/CommandLineArguments.h \
include/CppUTest/CommandLineTestRunner.h \
include/CppUTest/CppUTestConfig.h \
include/CppUTest/JUnitTestOutput.h \
include/CppUTest/MemoryLeakDetector.h \
include/CppUTest/MemoryLeakDetectorMallocMacros.h \
include/CppUTest/MemoryLeakDetectorNewMacros.h \
include/CppUTest/MemoryLeakWarningPlugin.h \
include/CppUTest/PlatformSpecificFunctions.h \
include/CppUTest/PlatformSpecificFunctions_c.h \
include/CppUTest/SimpleString.h \
include/CppUTest/SimpleStringInternalCache.h \
include/CppUTest/SimpleMutex.h \
include/CppUTest/StandardCLibrary.h \
include/CppUTest/TeamCityTestOutput.h \
include/CppUTest/TestFailure.h \
include/CppUTest/TestFilter.h \
include/CppUTest/TestHarness.h \
include/CppUTest/TestHarness_c.h \
include/CppUTest/TestMemoryAllocator.h \
include/CppUTest/TestOutput.h \
include/CppUTest/TestPlugin.h \
include/CppUTest/TestRegistry.h \
include/CppUTest/TestResult.h \
include/CppUTest/TestTestingFixture.h \
include/CppUTest/Utest.h \
include/CppUTest/UtestMacros.h \
generated/CppUTestGeneratedConfig.h
lib_libCppUTestExt_a_CPPFLAGS = $(lib_libCppUTest_a_CPPFLAGS)
lib_libCppUTestExt_a_CFLAGS = $(lib_libCppUTest_a_CFLAGS)
lib_libCppUTestExt_a_CXXFLAGS = $(lib_libCppUTest_a_CXXFLAGS)
lib_libCppUTestExt_a_SOURCES = \
src/CppUTestExt/CodeMemoryReportFormatter.cpp \
src/CppUTestExt/GTest.cpp \
src/CppUTestExt/IEEE754ExceptionsPlugin.cpp \
src/CppUTestExt/MemoryReportAllocator.cpp \
src/CppUTestExt/MemoryReporterPlugin.cpp \
src/CppUTestExt/MemoryReportFormatter.cpp \
src/CppUTestExt/MockActualCall.cpp \
src/CppUTestExt/MockExpectedCall.cpp \
src/CppUTestExt/MockExpectedCallsList.cpp \
src/CppUTestExt/MockFailure.cpp \
src/CppUTestExt/MockNamedValue.cpp \
src/CppUTestExt/MockSupport.cpp \
src/CppUTestExt/MockSupportPlugin.cpp \
src/CppUTestExt/MockSupport_c.cpp \
src/CppUTestExt/OrderedTest.cpp
if INCLUDE_CPPUTEST_EXT
include_cpputestextdir = $(includedir)/CppUTestExt
include_cpputestext_HEADERS = \
include/CppUTestExt/CodeMemoryReportFormatter.h \
include/CppUTestExt/GMock.h \
include/CppUTestExt/GTest.h \
include/CppUTestExt/GTestSupport.h \
include/CppUTestExt/GTestConvertor.h \
include/CppUTestExt/IEEE754ExceptionsPlugin.h \
include/CppUTestExt/MemoryReportAllocator.h \
include/CppUTestExt/MemoryReporterPlugin.h \
include/CppUTestExt/MemoryReportFormatter.h \
include/CppUTestExt/MockActualCall.h \
include/CppUTestExt/MockCheckedActualCall.h \
include/CppUTestExt/MockCheckedExpectedCall.h \
include/CppUTestExt/MockExpectedCall.h \
include/CppUTestExt/MockExpectedCallsList.h \
include/CppUTestExt/MockFailure.h \
include/CppUTestExt/MockNamedValue.h \
include/CppUTestExt/MockSupport.h \
include/CppUTestExt/MockSupportPlugin.h \
include/CppUTestExt/MockSupport_c.h \
include/CppUTestExt/OrderedTest.h
endif
CppUTestTests_CPPFLAGS = $(lib_libCppUTest_a_CPPFLAGS)
CppUTestTests_CFLAGS = $(lib_libCppUTest_a_CFLAGS)
CppUTestTests_CXXFLAGS = $(lib_libCppUTest_a_CXXFLAGS)
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
CppUTestExtTests_CPPFLAGS = $(lib_libCppUTestExt_a_CPPFLAGS)
CppUTestExtTests_CFLAGS = $(lib_libCppUTestExt_a_CFLAGS)
CppUTestExtTests_CXXFLAGS = $(lib_libCppUTestExt_a_CXXFLAGS)
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
DISTCLEANFILES = \
filename.map.txt \
generated/CppUTestGeneratedConfig.h
if INCLUDE_GMOCKTESTS
#GTestTests_CPPFLAGS = $(lib_libCppUTestExt_a_CPPFLAGS)
#GTestTests_CFLAGS = $(lib_libCppUTestExt_a_CFLAGS)
#GTestTests_CXXFLAGS = $(lib_libCppUTestExt_a_CXXFLAGS) -DCPPUTEST_USE_MEM_LEAK_DETECTION=0 -DGMOCK_RENAME_MAIN=1 -D_THREAD_SAFE -DGTEST_HAS_PTHREAD=1
#GTestTests_LDADD = lib/libCppUTestExt.a lib/libCppUTest.a $(CPPUTEST_LDADD)
#GTestTests_LDFLAGS = $(CppUTestTests_LDFLAGS)
#GTestTests_SOURCES = \
$(GMOCK_HOME)/test/gmock-spec-builders_test.cc \
tests/CppUTestExt/AllTests.cpp
endif
RUN_CPPUTEST_TESTS = ./$(CPPUTEST_TESTS)
RUN_CPPUTESTEXT_TESTS = ./$(CPPUTESTEXT_TESTS)
valgrind: check
@if test "x$(CPPUTEST_HAS_VALGRIND)" = xno; then echo "Running the valgrind target without having valgrind. Perhaps install it first?"; exit 1; fi
valgrind --dsymutil=yes --suppressions=$(srcdir)/valgrind.suppressions --gen-suppressions=all --error-exitcode=1 ./$(CPPUTEST_TESTS)
tdd: $(CPPUTEST_TESTS)$(EXEEXT) $(CPPUTESTEXT_TESTS)$(EXEEXT)
./$(CPPUTEST_TESTS)
if INCLUDE_CPPUTEST_EXT
./$(CPPUTESTEXT_TESTS)
endif
cpputest_build_gtest18:
mkdir -p cpputest_build_gtest18
cd cpputest_build_gtest18; \
wget https://github.com/google/googletest/archive/release-1.8.0.zip -O gtest-1.8.0.zip && unzip gtest-1.8.0.zip; \
cd googletest-release-1.8.0; cmake .; make
cpputest_build_gtest17:
mkdir -p cpputest_build_gtest17
cd cpputest_build_gtest17; \
wget https://github.com/google/googletest/archive/release-1.7.0.zip -O gtest-1.7.0.zip && unzip gtest-1.7.0.zip; \
wget https://github.com/google/googlemock/archive/release-1.7.0.zip -O gmock-1.7.0.zip && unzip gmock-1.7.0.zip; \
mv googletest-release-1.7.0 googlemock-release-1.7.0/gtest; \
cd googlemock-release-1.7.0; autoreconf -i; ./configure && make
cpputest_build_gtest16:
mkdir -p cpputest_build_gtest16
cd cpputest_build_gtest16; \
wget https://github.com/google/googletest/archive/release-1.6.0.zip -O gtest-1.6.0.zip && unzip gtest-1.6.0.zip; \
wget https://github.com/google/googlemock/archive/release-1.6.0.zip -O gmock-1.6.0.zip && unzip gmock-1.6.0.zip; \
mv googletest-release-1.6.0 googlemock-release-1.6.0/gtest; \
cd googlemock-release-1.6.0; autoreconf -i; ./configure CXXFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 && make
cpputest_build_gtest15:
mkdir -p cpputest_build_gtest15
cd cpputest_build_gtest15; \
wget https://github.com/google/googletest/archive/release-1.5.0.zip -O gtest-1.5.0.zip && unzip gtest-1.5.0.zip; \
wget https://github.com/google/googlemock/archive/release-1.5.0.zip -O gmock-1.5.0.zip && unzip gmock-1.5.0.zip; \
mv googletest-release-1.5.0 googlemock-release-1.5.0/gtest; \
cd googlemock-release-1.5.0; autoreconf -i; ./configure CXXFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 && make
check_gtest15: cpputest_build_gtest15
@echo "Build using gmock 1.5";
export GMOCK_HOME=`pwd`/cpputest_build_gtest15/googlemock-release-1.5.0; \
make distclean; $(srcdir)/configure --enable-std-cpp98; make check
check_gtest16: cpputest_build_gtest16
@echo "Build using gmock 1.6";
export GMOCK_HOME=`pwd`/cpputest_build_gtest16/googlemock-release-1.6.0; \
make distclean; $(srcdir)/configure --enable-std-cpp98; make check
check_gtest17: cpputest_build_gtest17
@echo "Build using gmock 1.7"
export GMOCK_HOME=`pwd`/cpputest_build_gtest17/googlemock-release-1.7.0; \
make distclean; $(srcdir)/configure --enable-std-cpp98; make check
check_gtest18: cpputest_build_gtest18
@echo "Build using gmock 1.8"
export GMOCK_HOME=`pwd`/cpputest_build_gtest18/googletest-release-1.8.0/googlemock; \
export GTEST_HOME=`pwd`/cpputest_build_gtest18/googletest-release-1.8.0/googletest; \
make distclean; $(srcdir)/configure --enable-std-cpp98; make check
remove_gtest_directories:
rm -rf cpputest_build_gtest15
rm -rf cpputest_build_gtest16
rm -rf cpputest_build_gtest17
rm -rf cpputest_build_gtest18
check_gtest: remove_gtest_directories check_gtest15 check_gtest16 check_gtest17 check_gtest18
check_basic:
@echo "If dash is available, run the configure with dash to find bash-isms and increase portability"
make distclean; if test "x$(CPPUTEST_HAS_DASH)" = xyes; then CONFIG_SHELL=dash $(srcdir)/configure; fi
@echo "Building and valgrinding (skipping this on MacOS due to buggy Valgrind"
if test "x$(CPPUTEST_ON_MACOSX)" = xno; then \
make distclean; $(srcdir)/configure; make valgrind; \
fi
@echo "Building without extensions"
make distclean; $(srcdir)/configure --disable-extensions; make check
@echo "Building with the Std C++ 98 turned on. Compiler acts differently then."
make distclean; $(srcdir)/configure --enable-std-cpp98; make
@echo "Building with the Std C++ 11 turned on. Compiler acts differently then."
make distclean; $(srcdir)/configure --enable-std-cpp11; make
@echo "Building with the Std C++ 14 turned on. Compiler acts differently then."
make distclean; $(srcdir)/configure --enable-std-cpp14; make
@echo "Building with the Std C++ 17 turned on. Compiler acts differently then."
make distclean; $(srcdir)/configure --enable-std-cpp17; make
@echo "Building with the Std C++ 20 turned on. Compiler acts differently then."
make distclean; $(srcdir)/configure --enable-std-cpp20; make
@echo "Building without the Standard C library"
make distclean; $(srcdir)/configure --disable-std-c; make
@echo "Building without the Standard C++ library and without long long"
make distclean; $(srcdir)/configure --disable-std-cpp --disable-long-long; make check
@echo "Building without memory leak detection"
make distclean; $(srcdir)/configure --disable-memory-leak-detection; make check
@echo "Building with address sanitizer"
make distclean; $(srcdir)/configure --enable-sanitize-address; make check
@echo "Building without memory leak detection and without Standard C++"
make distclean; $(srcdir)/configure --disable-memory-leak-detection --disable-std-cpp; make check
@echo "Generate a map file while building"
make distclean; $(srcdir)/configure -enable-generate-map-file; make check
if [ -s CppUTest.o.map.txt ]; then echo "Generating map file failed. Build failed!"; exit 1; fi
check_special_situations:
@echo "Does the system have gcc? $(CPPUTEST_HAS_GCC)"
if test "x$(CPPUTEST_HAS_GCC)" = xyes; then echo "Compiling with gcc"; make distclean; $(srcdir)/configure CC="gcc" CXX="g++"; make check; fi
@echo "Does the system have clang and is a Mac? $(CPPUTEST_HAS_CLANG)"
if test "x$(CPPUTEST_HAS_CLANG)" = xyes && test "x$(CPPUTEST_ON_MACOSX)" = xyes; then \
echo "Compiling with clang"; make distclean; $(srcdir)/configure CC="clang" CXX="clang++"; make check; \
fi
@echo Testing JUnit output
make distclean; $(srcdir)/configure; make check
./$(CPPUTEST_TESTS) -ojunit > junit_run_output
if [ -s junit_run_output ]; then echo "JUnit run has output. Build failed!"; exit 1; fi
rm junit_run_output; rm cpputest_*.xml
@echo "Building with all flags turned off"
make distclean; $(srcdir)/configure --disable-cpputest-flags CFLAGS="" CXXFLAGS="" CPPFLAGS="-I $(srcdir)/include -I$(srcdir)/include/CppUTestExt/CppUTestGTest -I$(srcdir)/include/CppUTestExt/CppUTestGMock" --disable-dependency-tracking; make check
check_coverage:
@echo "Compile with coverage (switch to clang for Mac OSX)"
if test "x$(CPPUTEST_HAS_CLANG)" = xyes && test "x$(CPPUTEST_ON_MACOSX)" = xyes; then \
echo "Compiling with clang"; make distclean; $(srcdir)/configure CC="clang" CXX="clang++" --enable-coverage CFLAGS="-O0" CXXFLAGS="-O0"; \
else \
make distclean; $(srcdir)/configure -enable-coverage CFLAGS="-O0" CXXFLAGS="-O0"; \
fi
make check
./$(CPPUTEST_TESTS) >> test_output.txt; ./$(CPPUTESTEXT_TESTS) >> test_output.txt
$(SILENCE)for f in `ls *.gcno` ; do \
gcov $(CppUTestExtTests_SOURCES) $(CppUTestTests_SOURCES) $(lib_libCppUTest_a_SOURCES) $(lib_libCppUTestExt_a_SOURCES) -o $$f 1>>gcov_output.txt 2>>gcov_error.txt; \
done
$(srcdir)/scripts/filterGcov.sh gcov_output.txt gcov_error.txt gcov_report.txt test_output.txt
cat gcov_report.txt
if test "x$(CPPUTEST_HAS_LCOV)" = xyes; then lcov -c -d . -o temp.info; lcov -r temp.info /usr\* -o coverage.info; genhtml -o test_coverage coverage.info; fi
remove_coverage_output:
rm -f gcov_output.txt gcov_error.txt gcov_report.txt test_output.txt gcov_report.txt.html temp.info coverage.info
rm -rf test_coverage
check_examples:
@echo "Using the old Makefile and examples"
make distclean
$(MAKE) -C $(srcdir) -f Makefile_using_MakefileWorker extensions
$(MAKE) -C $(srcdir)/examples all clean
@echo "Compiling and running the examples. This will use the old Makefile"
make distclean; $(srcdir)/configure; make; $(MAKE) -C $(srcdir)/examples all clean CPPUTEST_LIB_LINK_DIR="`pwd`/lib"
check_all: check_basic check_special_situations check_coverage remove_coverage_output check_examples check_gtest
@echo "Last... one normal build and test"
make distclean; $(srcdir)/configure; make check;
@echo "Check running tests repeatedly"
$(RUN_CPPUTEST_TESTS) - r; $(RUN_CPPUTESTEXT_TESTS) -r
@echo "Check running tests in separate process (CppUTestExtTests TEST_GROUP(TestOrderedTestMacro) would have to fail)"
$(RUN_CPPUTEST_TESTS) -p;
# Mac OSX adds an annoying directory when packaging. This can be prevented by setting COPYFILE_DISABLE=1
# However, I've not figured out how to set it automatically and neither google nor stackoverflow knew the answer.
# The automake mailing list is still thinking about it, and thus, I've added this check so that I don't forget to do it :)
# More info: http://superuser.com/questions/61185/why-do-i-get-files-like-foo-in-my-tarball-on-os-x
dist-hook:
if test "x$(CPPUTEST_ON_MACOSX)" = "xyes"; then \
if test ! "x$(COPYFILE_DISABLE)" = "x1"; then \
echo ""; \
echo 'ERROR: When packaging on MacOSX, please run "COPYFILE_DISABLE=1 make dist"'; \
echo ""; \
exit 1; \
fi \
fi
distclean-local:
test -z "generated" || rmdir generated

View file

@ -1,25 +0,0 @@
#Set this to @ to keep the makefile quiet
ifndef SILENCE
SILENCE = @
endif
#---- Outputs ----#
COMPONENT_NAME = CppUTestExt
#--- Inputs ----#
CPPUTEST_HOME = .
CPP_PLATFORM = Gcc
WARNINGFLAGS = -pedantic-errors -Wall -Wextra -Werror -Wshadow -Wswitch-default -Wswitch-enum -Wconversion
SRC_DIRS = src/CppUTestExt
TEST_SRC_DIRS = tests/CppUTestExt
INCLUDE_DIRS = $(CPPUTEST_HOME)/include
LD_LIBRARIES += -lstdc++ -L$(CPPUTEST_LIB_DIR)/$(TARGET_PLATFORM) -lCppUTest
include $(CPPUTEST_HOME)/build/MakefileWorker.mk

View file

@ -1,107 +0,0 @@
#Set this to @ to keep the makefile quiet
SILENCE = @
#--- Inputs ----#
COMPONENT_NAME = CppUTest
ifeq ($(CPPUTEST_USE_STD_C_LIB), N)
CPP_PLATFORM = GccNoStdC
else
CPP_PLATFORM = Gcc
endif
CPPUTEST_HOME = .
OLD_MAKE = oldmake
MAKE_CMD = make -f $(CPPUTEST_HOME)/Makefile_using_MakefileWorker
CPPUTEST_ENABLE_DEBUG = Y
SRC_DIRS = \
src/CppUTest \
src/Platforms/$(CPP_PLATFORM)
TEST_SRC_DIRS = \
tests/CppUTest
INCLUDE_DIRS =\
include
include $(CPPUTEST_HOME)/build/MakefileWorker.mk
#these are a sample of the other alternative flag settings
.PHONY: test_all
test_all: start
@echo Building with the default flags.
$(MAKE_CMD) clean
$(TIME) $(MAKE_CMD)
./$(TEST_TARGET) -r
$(MAKE_CMD) clean
@echo Building with the STDC++ new disabled.
$(TIME) $(MAKE_CMD) CPPUTEST_USE_STD_CPP_LIB=Y extensions
$(MAKE_CMD) CPPUTEST_USE_STD_CPP_LIB=Y cleanExtensions
@echo Building with Memory Leak Detection disabled
$(TIME) $(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N extensions
$(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N cleanExtensions
@echo Building with Memory Leak Detection disabled and STD C++ disabled
$(TIME) $(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N CPPUTEST_USE_STD_CPP_LIB=Y extensions
$(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N CPPUTEST_USE_STD_CPP_LIB=Y cleanExtensions
@echo Building with debug disabled
$(TIME) $(MAKE_CMD) CPPUTEST_ENABLE_DEBUG=N extensions
$(MAKE_CMD) CPPUTEST_ENABLE_DEBUG=N cleanExtensions
@echo Building with overridden CXXFLAGS and CFLAGS and CPPFLAGS
$(TIME) $(MAKE_CMD) CLFAGS="" CXXFLAGS="" CPPFLAGS="-Iinclude"
$(MAKE_CMD) CFLAGS="" CXXFLAGS="" clean
@echo Building without Standard C library includes
$(TIME) $(MAKE_CMD) CPPUTEST_USE_STD_C_LIB=N all_no_tests
$(MAKE_CMD) CPPUTEST_USE_STD_C_LIB=N clean
@echo Building with a different TARGET_PLATFORM
$(MAKE_CMD) TARGET_PLATFORM=real_platform
@echo Building with overridden CXXFLAGS and CFLAGS and memory leak and STDC++ disabled
$(TIME) $(MAKE_CMD) CLFAGS="" CXXFLAGS="" CPPFLAGS="-Iinclude -DCPPUTEST_STD_CPP_LIB_DISABLED -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED"
$(MAKE_CMD) CFLAGS="" CXXFLAGS="" CPPFLAGS="-DCPPUTEST_STD_CPP_LIB_DISABLED -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED" clean
@echo Building examples
$(MAKE_CMD) cleanExamples
$(TIME) $(MAKE_CMD) examples
$(MAKE_CMD) cleanExamples
@echo Testing JUnit output
$(TIME) $(MAKE_CMD)
$(SILENCE)./$(TEST_TARGET) -ojunit > junit_run_output
$(SILENCE)if [ -s junit_run_output ]; then echo "JUnit run has output. Build failed!"; exit 1; fi
$(MAKE_CMD) clean
$(MAKE_CMD) CPPUTEST_MAP_FILE=map.txt
$(MAKE_CMD) clean
@echo Testing GCOV usage
$(TIME) $(MAKE_CMD) CPPUTEST_USE_GCOV=Y everythingInstall
$(MAKE_CMD) gcov
$(MAKE) -f Makefile_CppUTestExt gcov
$(MAKE) -C examples gcov
$(MAKE_CMD) cleanEverythingInstall
@echo Testing VPATH usage
$(TIME) $(MAKE_CMD) CPPUTEST_USE_GCOV=Y CPPUTEST_USE_VPATH=Y everythingInstall
$(MAKE_CMD) CPPUTEST_USE_VPATH=Y gcov
$(MAKE) CPPUTEST_USE_VPATH=Y -f Makefile_CppUTestExt gcov
$(MAKE) CPPUTEST_USE_VPATH=Y -C examples gcov
$(MAKE_CMD) clean cleanExamples
@echo Testing VPATH usage
$(TIME) $(MAKE_CMD) CPPUTEST_USE_VPATH=Y everythingInstall
$(MAKE_CMD) CPPUTEST_USE_VPATH=Y cleanEverythingInstall
$(MAKE_CMD) flags
$(MAKE_CMD) debug
.PHONY: examples
examples: $(TEST_TARGET) extensions
+$(TIME) $(MAKE) -C examples all CPPUTEST_USE_STD_CPP_LIB=$(CPPUTEST_USE_STD_CPP_LIB) CPPUTEST_USE_MEM_LEAK_DETECTION=$(CPPUTEST_USE_MEM_LEAK_DETECTION)
extensions: $(TEST_TARGET)
+$(TIME) $(MAKE) -f Makefile_CppUTestExt all CPPUTEST_USE_STD_CPP_LIB=$(CPPUTEST_USE_STD_CPP_LIB) CPPUTEST_USE_MEM_LEAK_DETECTION=$(CPPUTEST_USE_MEM_LEAK_DETECTION) TARGET_PLATFORM=$(TARGET_PLATFORM)
cleanExtensions: clean
+$(TIME) $(MAKE) -f Makefile_CppUTestExt clean CPPUTEST_USE_STD_CPP_LIB=$(CPPUTEST_USE_STD_CPP_LIB) CPPUTEST_USE_MEM_LEAK_DETECTION=$(CPPUTEST_USE_MEM_LEAK_DETECTION) TARGET_PLATFORM=$(TARGET_PLATFORM)
cleanExamples: clean cleanExtensions
+$(TIME) $(MAKE) -C examples clean CPPUTEST_USE_STD_CPP_LIB=$(CPPUTEST_USE_STD_CPP_LIB) CPPUTEST_USE_MEM_LEAK_DETECTION=$(CPPUTEST_USE_MEM_LEAK_DETECTION)
.PHONY: everythingInstall
everythingInstall: all extensions examples
.PHONY: cleanEverythingInstall
cleanEverythingInstall: clean cleanExtensions cleanExamples

View file

@ -1,3 +0,0 @@
You can find the main NEWS at:
https://github.com/cpputest/cpputest

View file

@ -1,3 +0,0 @@
Please see the README.md. This file exists to be compliant to GNU coding standards.

View file

@ -1,253 +0,0 @@
CppUTest
========
[![Build Status](https://travis-ci.org/cpputest/cpputest.png?branch=master)](https://travis-ci.org/cpputest/cpputest)
[![Build status](https://ci.appveyor.com/api/projects/status/irh38i4wblsb5tew?svg=true)](https://ci.appveyor.com/project/basvodde/cpputest)
[![Coverage Status](https://coveralls.io/repos/cpputest/cpputest/badge.svg?branch=master&service=github)](https://coveralls.io/github/cpputest/cpputest?branch=master)
[![ConanCenter package](https://repology.org/badge/version-for-repo/conancenter/cpputest.svg)](https://conan.io/center/cpputest)
CppUTest unit testing and mocking framework for C/C++
[More information on the project page](http://cpputest.github.com)
Slack channel:
[Join if link not expired](https://join.slack.com/t/cpputest/shared_invite/zt-epq97u9h-6yBQHHl2cvUADjEENtdASw)
## Getting Started
You'll need to do the following to get started:
Building from source (unix-based, cygwin, MacOSX):
* git clone git://github.com/cpputest/cpputest.git
* cd cpputest_build
* autoreconf .. -i
* ../configure
* make
You can use `make install` if you want to install CppUTest system-wide
You can also use CMake, which also works for Windows Visual Studio.
* Download latest version
* cmake CMakeLists.txt
* make
Then to get started, you'll need to do the following:
* Add the include path to the Makefile. Something like:
* CPPFLAGS += -I$(CPPUTEST_HOME)/include
* Add the memory leak macros to your Makefile (needed for additional debug info!). Something like:
* CXXFLAGS += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorNewMacros.h
* CFLAGS += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorMallocMacros.h
* Add the library linking to your Makefile. Something like:
* LD_LIBRARIES = -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
After this, you can write your first test:
```C++
TEST_GROUP(FirstTestGroup)
{
};
TEST(FirstTestGroup, FirstTest)
{
FAIL("Fail me!");
}
```
## Command line switches
* -h help, shows the latest help, including the parameters we've implemented after updating this README page.
* -v verbose, print each test name as it runs
* -r# repeat the tests some number of times, default is one, default if # is not specified is 2. This is handy if you are experiencing memory leaks related to statics and caches.
* -s# random shuffle the test execution order. # is an integer used for seeding the random number generator. # is optional, and if omitted, the seed value is chosen automatically, which results in a different order every time. The seed value is printed to console to make it possible to reproduce a previously generated execution order. Handy for detecting problems related to dependencies between tests.
* -g group only run test whose group contains the substring group
* -n name only run test whose name contains the substring name
* -f crash on fail, run the tests as normal but, when a test fails, crash rather than report the failure in the normal way
## Test Macros
* TEST(group, name) - define a test
* IGNORE_TEST(group, name) - turn off the execution of a test
* TEST_GROUP(group) - Declare a test group to which certain tests belong. This will also create the link needed from another library.
* TEST_GROUP_BASE(group, base) - Same as TEST_GROUP, just use a different base class than Utest
* TEST_SETUP() - Declare a void setup method in a TEST_GROUP - this is the same as declaring void setup()
* TEST_TEARDOWN() - Declare a void setup method in a TEST_GROUP
* IMPORT_TEST_GROUP(group) - Export the name of a test group so it can be linked in from a library. Needs to be done in main.
## Set up and tear down support
* Each TEST_GROUP may contain a setup and/or a teardown method.
* setup() is called prior to each TEST body and teardown() is called after the test body.
## Assertion Macros
The failure of one of these macros causes the current test to immediately exit
* CHECK(boolean condition) - checks any boolean result
* CHECK_TRUE(boolean condition) - checks for true
* CHECK_FALSE(boolean condition) - checks for false
* CHECK_EQUAL(expected, actual) - checks for equality between entities using ==. So if you have a class that supports operator==() you can use this macro to compare two instances.
* STRCMP_EQUAL(expected, actual) - check const char* strings for equality using strcmp
* LONGS_EQUAL(expected, actual) - Compares two numbers
* BYTES_EQUAL(expected, actual) - Compares two numbers, eight bits wide
* POINTERS_EQUAL(expected, actual) - Compares two const void *
* DOUBLES_EQUAL(expected, actual, tolerance) - Compares two doubles within some tolerance
* ENUMS_EQUAL_INT(excepted, actual) - Compares two enums which their underlying type is int
* ENUMS_EQUAL_TYPE(underlying_type, excepted, actual) - Compares two enums which they have the same underlying type
* FAIL(text) - always fails
* TEST_EXIT - Exit the test without failure - useful for contract testing (implementing an assert fake)
Customize CHECK_EQUAL to work with your types that support operator==()
* Create the function: `SimpleString StringFrom(const yourType&)`
The Extensions directory has a few of these.
## Building default checks with TestPlugin
* CppUTest can support extra checking functionality by inserting TestPlugins
* TestPlugin is derived from the TestPlugin class and can be inserted in the TestRegistry via the installPlugin method.
* TestPlugins can be used for, for example, system stability and resource handling like files, memory or network connection clean-up.
* In CppUTest, the memory leak detection is done via a default enabled TestPlugin
Example of a main with a TestPlugin:
```C++
int main(int ac, char** av)
{
LogPlugin logPlugin;
TestRegistry::getCurrentRegistry()->installPlugin(&logPlugin);
int result = CommandLineTestRunner::RunAllTests(ac, av);
TestRegistry::getCurrentRegistry()->resetPlugins();
return result;
}
```
Memory leak detection
* A platform specific memory leak detection mechanism is provided.
* If a test fails and has allocated memory prior to the fail and that memory is not cleaned up by TearDown, a memory leak is reported.
It is best to only chase memory leaks when other errors have been eliminated.
* Some code uses lazy initialization and appears to leak when it really does not (for example: gcc stringstream used to in an earlier release). One cause is that some standard library calls allocate something and do not free it until after main (or never).
To find out if a memory leak is due to lazy initialization set the -r switch to run tests twice. The signature of this situation is that the first run shows leaks and the second run shows no leaks. When both runs show leaks, you have a leak to find.
## How is memory leak detection implemented?
* Before setup() a memory usage checkpoint is recorded
* After teardown() another checkpoint is taken and compared to the original checkpoint
* In Visual Studio the MS debug heap capabilities are used
* For GCC a simple new/delete count is used in overridden operators new, new[], delete and delete[]
If you use some leaky code that you can't or won't fix you can tell a TEST to ignore a certain number of leaks as in this example:
```C++
TEST(MemoryLeakWarningTest, Ignore1)
{
EXPECT_N_LEAKS(1);
char* arrayToLeak1 = new char[100];
}
```
## Example Main
```C++
#include "CppUTest/CommandLineTestRunner.h"
int main(int ac, char** av)
{
return RUN_ALL_TESTS(ac, av);
}
```
## Example Test
```C++
#include "CppUTest/TestHarness.h"
#include "ClassName.h"
TEST_GROUP(ClassName)
{
ClassName* className;
void setup()
{
className = new ClassName();
}
void teardown()
{
delete className;
}
};
TEST(ClassName, Create)
{
CHECK(0 != className);
CHECK(true);
CHECK_EQUAL(1,1);
LONGS_EQUAL(1,1);
DOUBLES_EQUAL(1.000, 1.001, .01);
STRCMP_EQUAL("hello", "hello");
FAIL("The prior tests pass, but this one doesn't");
}
```
There are some scripts that are helpful in creating your initial h, cpp, and
Test files. See scripts/README.TXT
## Conan
CppUTest is available through [conan-center][conan-center].
##### conanfile.txt
```ini
[requires]
cpputest/4.0
[generators]
cmake_find_package
cmake_paths
```
##### CMake
```cmake
find_package(CppUTest REQUIRED)
add_executable(example_test ExampleTest.cpp)
target_link_libraries(example_test PRIVATE
CppUTest::CppUTest
CppUTest::CppUTestExt)
```
## Integration as external CMake project
Sometimes you want to use CppUTest in your project without installing it to your system or for having control over the version you are using. This little snippet get the wanted version from Github and builds it as a library.
```cmake
# CppUTest
include(FetchContent)
FetchContent_Declare(
CppUTest
GIT_REPOSITORY https://github.com/cpputest/cpputest.git
GIT_TAG latest-passing-build # or use release tag, eg. v3.8
)
# Set this to ON if you want to have the CppUTests in your project as well.
set(TESTS OFF CACHE BOOL "Switch off CppUTest Test build")
FetchContent_MakeAvailable(CppUTest)
```
It can be used then like so:
```cmake
add_executable(run_tests UnitTest1.cpp UnitTest2.cpp)
target_link_libraries(run_tests PRIVATE CppUTest CppUTestExt)
```
[conan-center]: https://conan.io/center/cpputest

View file

@ -1,67 +0,0 @@
CPPUTest can and has been used for testing C code also. When testing
C code there are a couple of things to keep in mind and a couple of
common problems to solve.
---++ Using extern "C"
When including C-header files or when declaring C-variables and routines
in a .cpp file, you'll have to surround them with an extern "C". This is
because the C++ linker works different than the C linker and you need to
instruct the compiler about this. If you do NOT do this, you will probably
get a linker error, like unresolved symbols, for a routine that you did
implement.
An example:
extern "C" {
#include "hello.h"
extern HelloWorldApi theRealHelloWorldApi;
}
---++ CppUTest support for C
CppUTest comes with a file called TestHarness_c.h which contains a couple
of routines that can be used in C code, like C-versions of the CHECK-macro's.
The file also contains malloc and free routines that can be used for using
the CppUTest memory leak detector. These routines should be used instead of
the normal malloc/free. This can be achieved by #defining them somewhere, for
examples as a compiler option: -Dmalloc=cpputest_malloc.
It's important to remember that TestHarness_c.h is a C-header file. It can be
used in C code, but when using in C++ code, you need to use extern "C" before
including it.
---++ C++ keywords used
It sometimes happens that a C file uses a C++ keyword as a type or something
else. The most common one is the bool-type. This can typically be solved by
#defining the bool to something else. For example:
extern "C" {
#define bool helloBool
#include "hello.h"
#undef bool
}
The #undef is optional. It is possible that this solution leads to problems in
some situation (never happened to me). The same solution works for other C++
key-words
---++ Other
* In C, sometimes people use empty structs. The sizeof(empty struct) would be
0. In C++, the sizeof(empty struct) would be something. The best way to fix
this is to not use empty structs in C.
According to http://www.glenmccl.com/bett.htm an empty struct in C is illegal
anyway.
---++ References
* http://www.glenmccl.com/bett.htm
Describes some differences between C and C++
* http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B
Wikipedia entry on the compatibility between C and C++

View file

@ -1,60 +0,0 @@
1. Unzip into <someDirectory>, resulting in
<someDirectory>/CppUTest/
MAKE SURE <someDirectory> DOES NOT HAVE SPACES IN IT
MAKE SURE <someDirectory> DOES NOT HAVE SPACES IN IT
MAKE SURE <someDirectory> DOES NOT HAVE SPACES IN IT
2. Build CppUTest and examples
2a. For unix/gcc (including cygwin)
> cd <someDirectory>/CppUTest/cpputest_build
> ../configure
> make
> make tdd # This is to run the CppUTest unit tests
2b. For Microsoft Visual C++ V6
We couldn't install the compiler anymore. We removed the project files.
You will need to make your own
2c. For ARMCC from Keil MDK-ARM (building CppUTest library only)
> make all -C platforms/armcc
Please see README and Makefile in platforms/armcc to adjust options, default
CPU architecture is ARM7TDMI and default CPU execution mode is THUMB.
3c. For Microsoft Visual Studio 2008
Double click <someDirectory>/CppUTest/CppUTest.sln
If Visual studio reports that the solution file was created with a
newer version of Visual Studio, then try 3d
Then press control-F5 to "Start without debugging"
See CppUTest build and run its tests.
3d. For Older Microsoft Visual Studio .NET
Double click <someDirectory>/CppUTest/CppUTest.dsw
Allow VS.NET to convert the files by clicking "yes to all"
Run without debugging, see the test results in the command window
Exit MS VS.NET
Allow VS.NET to convert the files by clicking "yes to all"
Run without debugging, see the test results in the command window
NOTE: To create your own project, you need to have CppUTest and your project
compiled with the same compile and link settings
4. to setup the support scripts. These scripts work in various unix systems
and cygwin. (these are quite handy) If you are using windows
install some tool like cygwin, msys or MKSToolkit to run these scripts.
> cd <someDirectory>/CppUTest
> ./scripts/InstallScripts.sh
This command adds some symbolic links to /usr/local/bin, so you have
to run it as root.
sudo ./InstallScripts.sh
MSYS - http://www.mingw.org/msys.shtml
CYGWIN - http://www.cygwin.com/
MKSToolkit - http://mkstoolkit.com/

View file

@ -1,51 +0,0 @@
version: 3.7.0-ci{build}
image: Visual Studio 2015
cache:
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml
- C:\Tools\MinGW32 -> appveyor.yml
- C:\Tools\MinGW64 -> appveyor.yml
environment:
Configuration: Release
matrix:
- Platform: Cygwin32
- Platform: MinGW32
PlatformToolset: 4.8.5
- Platform: MinGW64
PlatformToolset: 4.8.5
- Platform: MinGW32
PlatformToolset: 5.3.0
- Platform: MinGW64
PlatformToolset: 5.3.0
- Platform: MinGWClang64
PlatformToolset: 5.3.0
- Platform: MinGWClang32
PlatformToolset: 5.3.0
- Platform: Win32
PlatformToolset: v90
- Platform: Win32
PlatformToolset: v100
- Platform: Win32
PlatformToolset: v110
- Platform: Win32
PlatformToolset: v120
- Platform: Win32
PlatformToolset: v140
- Platform: x64
PlatformToolset: v140
install:
- ps: if ($env:Platform -like 'MinGW*') { choco install mingw --version $env:PlatformToolset $( if ($env:Platform -like '*32') { Write-Output --forcex86 --params /exception:dwarf } ) }
build_script:
- ps: scripts\appveyor_ci_build.ps1
test_script:
- ps: scripts\appveyor_ci_test.ps1
artifacts:
- path: lib\CppUTest.lib
name: CppUTest

View file

@ -1,7 +0,0 @@
#!/bin/sh
#
# cpputest autogen.sh
#
# Run this to generate all the initial makefiles, etc.
autoreconf -i

View file

@ -1,226 +0,0 @@
#---------
#
# ComponentMakefile
#
# Include this file in your makefile
# It makes
# A static library
# A test executable
#
# The necessary parameters are shown in
# ComponentMakefileExampleParameters
#
# Inputs
# SRC_FILES - Specific source files to build into library
# SRC_DIRS - Directories of source files to build into the library
# TEST_SRC - unit test code build into the unit test runner
# MOCKS_SRC - mock objects built into the test runner
# INCLUDES - List of -I files
# CPPUTEST_CXXFLAGS - flags for the C++ compiler
# CPPUTEST_CPPFLAGS - flags for the C++ AND C compiler
# CPPUTEST_CFLAGS - C complier
# CPPUTEST_LDFLAGS - Linker flags
# LIB_DIR - the directory for the created library
# COMPONENT_NAME - the name of the thing being created
# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make
# other targets. Like CSlim, which is part of fitnesse
#----------
ifeq ("$(COMPONENT_NAME)", "")
COMPONENT_NAME = name_this_in_the_makefile
endif
ifeq ("$(OBJS_DIR)", "")
OBJS_DIR = objs
endif
ifeq ("$(LIB_DIR)", "")
LIB_DIR = lib
endif
ifeq ("$CPPUTEST_USE_MALLOC_LEAK_DETECTION","")
CPPUTEST_USE_MALLOC_LEAK_DETECTION = Y
echo "leak on by default"
endif
#CPPUTEST_USE_OPERATOR_NEW_LEAK_DETECTION = Y
#CXXFLAGS += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorNewMacros.h
#CFLAGS += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorMallocMacros.h
TARGET_LIB = \
$(LIB_DIR)/lib$(COMPONENT_NAME).a
TEST_TARGET = \
$(COMPONENT_NAME)_tests
#Helper Functions
get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.c)
get_dirs_from_dirspec = $(wildcard $1)
get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir)))
src_to_o = $(subst .c,.o, $(subst .cpp,.o,$1))
src_to_d = $(subst .c,.d, $(subst .cpp,.d,$1))
change_o_file_location = $(patsubst %.o,$(OBJS_DIR)/%.o, $1)
change_d_file_location = $(patsubst %.d,$(OBJS_DIR)/%.d, $1)
src_to = $(subst .c,$1, $(subst .cpp,$1,$2))
#Derived
STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB)
SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES)
#OBJ = $(call src_to_o,$(SRC))
OBJ = $(call change_o_file_location, $(call src_to_o,$(SRC)))
STUFF_TO_CLEAN += $(OBJ)
TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS))
#TEST_OBJS = $(call src_to_o,$(TEST_SRC))
TEST_OBJS = $(call change_o_file_location, $(call src_to_o,$(TEST_SRC)))
STUFF_TO_CLEAN += $(TEST_OBJS)
MOCKS_SRC = $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS))
#MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC))
MOCKS_OBJS = $(call change_o_file_location, $(call src_to_o,$(MOCKS_SRC)))
STUFF_TO_CLEAN += $(MOCKS_OBJS)
ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC)
#Test coverage with gcov
GCOV_OUTPUT = gcov_output.txt
GCOV_REPORT = gcov_report.txt
GCOV_ERROR = gcov_error.txt
GCOV_GCDA_FILES = $(call src_to,.gcda, $(ALL_SRC))
GCOV_GCNO_FILES = $(call src_to,.gcno, $(ALL_SRC))
TEST_OUTPUT = $(TEST_TARGET).txt
STUFF_TO_CLEAN += \
$(GCOV_OUTPUT)\
$(GCOV_REPORT)\
$(GCOV_ERROR)\
$(GCOV_GCDA_FILES)\
$(GCOV_GCNO_FILES)\
$(TEST_OUTPUT)
#Other stuff needed
CPPUTEST_LIB = $(CPPUTEST_HOME)/lib/libCppUTest.a
ifdef CPPUTEST_USE_EXTENSIONS
CPPUTEST_LIB += $(CPPUTEST_HOME)/lib/libCppUTestExt.a
endif
CPPUTEST_CPPFLAGS += $(INCLUDES) $(GCOVFLAGS)
#The gcda files for gcov need to be deleted before each run
#To avoid annoying messages.
GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR)
RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(CPPUTEST_EXE_FLAGS)
ifneq "$(OTHER_MAKEFILE_TO_INCLUDE)" ""
-include $(OTHER_MAKEFILE_TO_INCLUDE)
endif
ifneq "$(MAP_FILE)" ""
CPPUTEST_LDFLAGS += -Wl,-map,$(MAP_FILE)
endif
INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS))
INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir))
MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS))
INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir))
DEP_FILES = $(call src_to_d, $(ALL_SRC))
STUFF_TO_CLEAN += $(DEP_FILES) + $(PRODUCTION_CODE_START) + $(PRODUCTION_CODE_END)
STUFF_TO_CLEAN += $(STDLIB_CODE_START) + $(MAP_FILE) + cpputest_*.xml junit_run_output
# We'll use the CPPUTEST_CFLAGS etc so that you can override AND add to the CppUTest flags
CFLAGS = $(CPPUTEST_CFLAGS) $(CPPUTEST_ADDITIONAL_CFLAGS)
CPPFLAGS = $(CPPUTEST_CPPFLAGS) $(CPPUTEST_ADDITIONAL_CPPFLAGS)
CXXFLAGS = $(CPPUTEST_CXXFLAGS) $(CPPUTEST_ADDITIONAL_CXXFLAGS)
LDFLAGS = $(CPPUTEST_LDFLAGS) $(CPPUTEST_ADDITIONAL_LDFLAGS)
# Targets
.PHONY: all
all: $(TEST_TARGET)
$(RUN_TEST_TARGET)
@echo "Component makefile is no longer supported, convert to MakefileInclude.mk"
.PHONY: all_no_tests
all_no_tests: $(TEST_TARGET)
.PHONY: flags
flags:
$(SILENCE)echo Compile with these flags:
$(SILENCE)for f in $(CPPFLAGS) ; do \
echo " C++ $$f" ; \
done
$(SILENCE)for f in $(CFLAGS) ; do \
echo " C $$f" ; \
done
$(SILENCE)for f in $(LDFLAGS) ; do \
echo " LD $$f" ; \
done
$(SILENCE)for f in $(ARFLAGS) ; do \
echo " AR $$f" ; \
done
$(TEST_TARGET): $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(CPPUTEST_LIB) $(STDLIB_CODE_START)
$(SILENCE)echo Linking $@
$(SILENCE)$(LINK.o) -o $@ $^ $(LD_LIBRARIES)
$(TARGET_LIB): $(OBJ)
$(SILENCE)echo Building archive $@
$(SILENCE)mkdir -p lib
$(SILENCE)$(AR) $(ARFLAGS) $@ $^
$(SILENCE)$(RANLIB) $@
test: $(TEST_TARGET)
$(RUN_TEST_TARGET) | tee $(TEST_OUTPUT)
vtest: $(TEST_TARGET)
$(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT)
$(OBJS_DIR)/%.o: %.cpp
@echo compiling $(notdir $<)
$(SILENCE)mkdir -p $(dir $@)
$(SILENCE)$(COMPILE.cpp) -M -MF $(subst .o,.d,$@) -MT "$@ $(subst .o,.d,$@)" $<
$(SILENCE)$(COMPILE.cpp) $(OUTPUT_OPTION) $<
$(OBJS_DIR)/%.o: %.c
@echo compiling $(notdir $<)
$(SILENCE)mkdir -p $(dir $@)
$(SILENCE)$(COMPILE.c) -M -MF $(subst .o,.d,$@) -MT "$@ $(subst .o,.d,$@)" $<
$(SILENCE)$(COMPILE.c) $(OUTPUT_OPTION) $<
ifneq "$(MAKECMDGOALS)" "clean"
-include $(DEP_FILES)
endif
.PHONY: clean
clean:
$(SILENCE)echo Making clean
$(SILENCE)$(RM) $(STUFF_TO_CLEAN)
$(SILENCE)find . -name "*.gcov" | xargs rm -f
$(SILENCE)find . -name "*.[do]" | xargs rm -f
gcov: test
$(SILENCE)for d in $(SRC_DIRS) ; do \
gcov -o $$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \
done
$(CPPUTEST_HOME)/scripts/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT)
cat $(GCOV_REPORT)
.PHONY: format
format:
$(CPPUTEST_HOME)/scripts/reformat.sh $(PROJECT_HOME_DIR)
debug:
echo Stuff to clean
$(SILENCE)for f in $(STUFF_TO_CLEAN) ; do \
echo "$$f" ; \
done
echo Includes
$(SILENCE)for i in $(INCLUDES) ; do \
echo "$$i" ; \
done

View file

@ -1,46 +0,0 @@
#Set this to @ to keep the makefile quiet
SILENCE = @
#---- Outputs ----#
COMPONENT_NAME = ProjectName
TARGET_LIB = \
lib/lib$(COMPONENT_NAME).a
TEST_TARGET = \
$(COMPONENT_NAME)_tests
#--- Inputs ----#
PROJECT_HOME_DIR = .
CPPUTEST_HOME = ../CppUTest
CPP_PLATFORM = Gcc
#CFLAGS are set to override malloc and free to get memory leak detection in C programs
CFLAGS = -Dmalloc=cpputest_malloc -Dfree=cpputest_free
CPPFLAGS =
GCOVFLAGS = -fprofile-arcs -ftest-coverage
#SRC_DIRS is a list of source directories that make up the target library
#If test files are in these directories, their IMPORT_TEST_GROUPs need
#to be included in main to force them to be linked in. By convention
#put them into an AllTests.h file in each directory
SRC_DIRS = \
src
#TEST_SRC_DIRS is a list of directories including
# - A test main (AllTests.cpp by conventin)
# - OBJ files in these directories are included in the TEST_TARGET
# - Consequently - AllTests.h containing the IMPORT_TEST_GROUPS is not needed
# -
TEST_SRC_DIRS = \
tests
#includes for all compiles
INCLUDES =\
-I.\
-I$(CPPUTEST_HOME)/include\
#Flags to pass to ld
LDFLAGS +=
USER_LIBS =
include $(CPPUTEST_HOME)/build/ComponentMakefile

View file

@ -1,583 +0,0 @@
#---------
#
# MakefileWorker.mk
#
# Include this helper file in your makefile
# It makes
# A static library
# A test executable
#
# See this example for parameter settings
# examples/Makefile
#
#----------
# Inputs - these variables describe what to build
#
# INCLUDE_DIRS - Directories used to search for include files.
# This generates a -I for each directory
# SRC_DIRS - Directories containing source files to build into the library
# SRC_FILES - Specific source files to build into library. Helpful when not all code
# in a directory can be built for test (hopefully a temporary situation)
# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner
# These do not go in a library. They are explicitly included in the test runner
# TEST_SRC_FILES - Specific source files to build into the unit test runner
# These do not go in a library. They are explicitly included in the test runner
# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner
# These do not go in a library. They are explicitly included in the test runner
#----------
# You can adjust these variables to influence how to build the test target
# and where to put and name outputs
# See below to determine defaults
# COMPONENT_NAME - the name of the thing being built
# TEST_TARGET - name of the test executable. By default it is
# $(COMPONENT_NAME)_tests
# Helpful if you want 1 > make files in the same directory with different
# executables as output.
# CPPUTEST_HOME - where CppUTest home dir found
# TARGET_PLATFORM - Influences how the outputs are generated by modifying the
# CPPUTEST_OBJS_DIR and CPPUTEST_LIB_DIR to use a sub-directory under the
# normal objs and lib directories. Also modifies where to search for the
# CPPUTEST_LIB to link against.
# CPPUTEST_OBJS_DIR - a directory where o and d files go
# CPPUTEST_LIB_DIR - a directory where libs go
# CPPUTEST_ENABLE_DEBUG - build for debug
# CPPUTEST_USE_MEM_LEAK_DETECTION - Links with overridden new and delete
# CPPUTEST_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out
# of the test harness
# CPPUTEST_USE_GCOV - Turn on coverage analysis
# Clean then build with this flag set to Y, then 'make gcov'
# CPPUTEST_MAPFILE - generate a map file
# CPPUTEST_WARNINGFLAGS - overly picky by default
# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make
# other targets. Like CSlim, which is part of fitnesse
# CPPUTEST_USE_VPATH - Use Make's VPATH functionality to support user
# specification of source files and directories that aren't below
# the user's Makefile in the directory tree, like:
# SRC_DIRS += ../../lib/foo
# It defaults to N, and shouldn't be necessary except in the above case.
#----------
#
# Other flags users can initialize to sneak in their settings
# CPPUTEST_CXXFLAGS - flags for the C++ compiler
# CPPUTEST_CPPFLAGS - flags for the C++ AND C preprocessor
# CPPUTEST_CFLAGS - flags for the C complier
# CPPUTEST_LDFLAGS - Linker flags
#----------
# Some behavior is weird on some platforms. Need to discover the platform.
# Platforms
UNAME_OUTPUT = "$(shell uname -a)"
MACOSX_STR = Darwin
MINGW_STR = MINGW
CYGWIN_STR = CYGWIN
LINUX_STR = Linux
SUNOS_STR = SunOS
UNKNWOWN_OS_STR = Unknown
# Compilers
CC_VERSION_OUTPUT ="$(shell $(CXX) -v 2>&1)"
CLANG_STR = clang
SUNSTUDIO_CXX_STR = SunStudio
UNAME_OS = $(UNKNWOWN_OS_STR)
ifeq ($(findstring $(MINGW_STR),$(UNAME_OUTPUT)),$(MINGW_STR))
UNAME_OS = $(MINGW_STR)
endif
ifeq ($(findstring $(CYGWIN_STR),$(UNAME_OUTPUT)),$(CYGWIN_STR))
UNAME_OS = $(CYGWIN_STR)
endif
ifeq ($(findstring $(LINUX_STR),$(UNAME_OUTPUT)),$(LINUX_STR))
UNAME_OS = $(LINUX_STR)
endif
ifeq ($(findstring $(MACOSX_STR),$(UNAME_OUTPUT)),$(MACOSX_STR))
UNAME_OS = $(MACOSX_STR)
#lion has a problem with the 'v' part of -a
UNAME_OUTPUT = "$(shell uname -pmnrs)"
endif
ifeq ($(findstring $(SUNOS_STR),$(UNAME_OUTPUT)),$(SUNOS_STR))
UNAME_OS = $(SUNOS_STR)
SUNSTUDIO_CXX_ERR_STR = CC -flags
ifeq ($(findstring $(SUNSTUDIO_CXX_ERR_STR),$(CC_VERSION_OUTPUT)),$(SUNSTUDIO_CXX_ERR_STR))
CC_VERSION_OUTPUT ="$(shell $(CXX) -V 2>&1)"
COMPILER_NAME = $(SUNSTUDIO_CXX_STR)
endif
endif
ifeq ($(findstring $(CLANG_STR),$(CC_VERSION_OUTPUT)),$(CLANG_STR))
COMPILER_NAME = $(CLANG_STR)
endif
#Kludge for mingw, it does not have cc.exe, but gcc.exe will do
ifeq ($(UNAME_OS),$(MINGW_STR))
CC := gcc
endif
#And another kludge. Exception handling in gcc 4.6.2 is broken when linking the
# Standard C++ library as a shared library. Unbelievable.
ifeq ($(UNAME_OS),$(MINGW_STR))
CPPUTEST_LDFLAGS += -static
endif
ifeq ($(UNAME_OS),$(CYGWIN_STR))
CPPUTEST_LDFLAGS += -static
endif
#Kludge for MacOsX gcc compiler on Darwin9 who can't handle pendantic
ifeq ($(UNAME_OS),$(MACOSX_STR))
ifeq ($(findstring Version 9,$(UNAME_OUTPUT)),Version 9)
CPPUTEST_PEDANTIC_ERRORS = N
endif
endif
ifndef COMPONENT_NAME
COMPONENT_NAME = name_this_in_the_makefile
endif
# Debug on by default
ifndef CPPUTEST_ENABLE_DEBUG
CPPUTEST_ENABLE_DEBUG = Y
endif
# new and delete for memory leak detection on by default
ifndef CPPUTEST_USE_MEM_LEAK_DETECTION
CPPUTEST_USE_MEM_LEAK_DETECTION = Y
endif
# Use the standard C library
ifndef CPPUTEST_USE_STD_C_LIB
CPPUTEST_USE_STD_C_LIB = Y
endif
# Use the standard C++ library
ifndef CPPUTEST_USE_STD_CPP_LIB
CPPUTEST_USE_STD_CPP_LIB = Y
endif
# Use long long, off by default
ifndef CPPUTEST_USE_LONG_LONG
CPPUTEST_USE_LONG_LONG = N
endif
# Use gcov, off by default
ifndef CPPUTEST_USE_GCOV
CPPUTEST_USE_GCOV = N
endif
ifndef CPPUTEST_PEDANTIC_ERRORS
CPPUTEST_PEDANTIC_ERRORS = Y
endif
# Default warnings
ifndef CPPUTEST_WARNINGFLAGS
CPPUTEST_WARNINGFLAGS = -Wall -Wextra -Werror -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wno-long-long
ifeq ($(CPPUTEST_PEDANTIC_ERRORS), Y)
CPPUTEST_WARNINGFLAGS += -pedantic-errors
endif
ifeq ($(UNAME_OS),$(LINUX_STR))
CPPUTEST_WARNINGFLAGS += -Wsign-conversion
endif
CPPUTEST_CXX_WARNINGFLAGS = -Woverloaded-virtual
CPPUTEST_C_WARNINGFLAGS = -Wstrict-prototypes
endif
#Wonderful extra compiler warnings with clang
ifeq ($(COMPILER_NAME),$(CLANG_STR))
# -Wno-disabled-macro-expansion -> Have to disable the macro expansion warning as the operator new overload warns on that.
# -Wno-padded -> I sort-of like this warning but if there is a bool at the end of the class, it seems impossible to remove it! (except by making padding explicit)
# -Wno-global-constructors Wno-exit-time-destructors -> Great warnings, but in CppUTest it is impossible to avoid as the automatic test registration depends on the global ctor and dtor
# -Wno-weak-vtables -> The TEST_GROUP macro declares a class and will automatically inline its methods. Thats ok as they are only in one translation unit. Unfortunately, the warning can't detect that, so it must be disabled.
# -Wno-old-style-casts -> We only use old style casts by decision
# -Wno-c++11-long-long -> When it detects long long, then we can use it and no need for a warning about that
# -Wno-c++98-compat-pedantic -> Incompatibilities with C++98, these are happening through #define.
# -Wno-reserved-id-macro -> Macro uses __ in MINGW... can't change that.
# -Wno-keyword-macro -> new overload
CPPUTEST_CXX_WARNINGFLAGS += -Weverything -Wno-disabled-macro-expansion -Wno-padded -Wno-global-constructors -Wno-exit-time-destructors -Wno-weak-vtables -Wno-old-style-cast -Wno-c++11-long-long -Wno-c++98-compat-pedantic -Wno-reserved-id-macro -Wno-keyword-macro
CPPUTEST_C_WARNINGFLAGS += -Weverything -Wno-padded
# Clang "7" or newer (Xcode 7 or newer command-line tools) introduced new warnings by default that don't exist on previous versions of clang and cause errors when present.
CLANG_VERSION := $(shell echo $(CC_VERSION_OUTPUT) | grep -o 'clang-[0-9][0-9][0-9]*.')
CLANG_VERSION_NUM := $(subst .,,$(subst clang-,,$(CLANG_VERSION)))
CLANG_VERSION_NUM_GT_700 := $(shell [[ $(CLANG_VERSION_NUM) -ge 700 ]] && echo Y)
ifeq ($(CLANG_VERSION_NUM_GT_700), Y)
# -Wno-reserved-id-macro -> Many CppUTest macros start with __, which is a reserved namespace
# -Wno-keyword-macro -> CppUTest redefines the 'new' keyword for memory leak tracking
CPPUTEST_CXX_WARNINGFLAGS += -Wno-reserved-id-macro -Wno-keyword-macro
CPPUTEST_C_WARNINGFLAGS += -Wno-reserved-id-macro -Wno-keyword-macro
endif
endif
# Uhm. Maybe put some warning flags for SunStudio here?
ifeq ($(COMPILER_NAME),$(SUNSTUDIO_CXX_STR))
CPPUTEST_CXX_WARNINGFLAGS =
CPPUTEST_C_WARNINGFLAGS =
endif
# Default dir for temporary files (d, o)
ifndef CPPUTEST_OBJS_DIR
ifndef TARGET_PLATFORM
CPPUTEST_OBJS_DIR = objs
else
CPPUTEST_OBJS_DIR = objs/$(TARGET_PLATFORM)
endif
endif
# Default dir for the outout library
ifndef CPPUTEST_LIB_DIR
ifndef TARGET_PLATFORM
CPPUTEST_LIB_DIR = lib
else
CPPUTEST_LIB_DIR = lib/$(TARGET_PLATFORM)
endif
endif
# No map by default
ifndef CPPUTEST_MAP_FILE
CPPUTEST_MAP_FILE = N
endif
# No extentions is default
ifndef CPPUTEST_USE_EXTENSIONS
CPPUTEST_USE_EXTENSIONS = N
endif
# No VPATH is default
ifndef CPPUTEST_USE_VPATH
CPPUTEST_USE_VPATH := N
endif
# Make empty, instead of 'N', for usage in $(if ) conditionals
ifneq ($(CPPUTEST_USE_VPATH), Y)
CPPUTEST_USE_VPATH :=
endif
ifndef TARGET_PLATFORM
CPPUTEST_LIB_LINK_DIR = $(CPPUTEST_HOME)/lib
else
CPPUTEST_LIB_LINK_DIR = $(CPPUTEST_HOME)/lib/$(TARGET_PLATFORM)
endif
# --------------------------------------
# derived flags in the following area
# --------------------------------------
# Without the C library, we'll need to disable the C++ library and ...
ifeq ($(CPPUTEST_USE_STD_C_LIB), N)
CPPUTEST_USE_STD_CPP_LIB = N
CPPUTEST_USE_MEM_LEAK_DETECTION = N
CPPUTEST_CPPFLAGS += -DCPPUTEST_STD_C_LIB_DISABLED
CPPUTEST_CPPFLAGS += -nostdinc
endif
ifeq ($(CPPUTEST_USE_MEM_LEAK_DETECTION), N)
CPPUTEST_CPPFLAGS += -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED
else
ifndef CPPUTEST_MEMLEAK_DETECTOR_NEW_MACRO_FILE
CPPUTEST_MEMLEAK_DETECTOR_NEW_MACRO_FILE = -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorNewMacros.h
endif
ifndef CPPUTEST_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE
CPPUTEST_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorMallocMacros.h
endif
endif
ifeq ($(CPPUTEST_USE_LONG_LONG), Y)
CPPUTEST_CPPFLAGS += -DCPPUTEST_USE_LONG_LONG
endif
ifeq ($(CPPUTEST_ENABLE_DEBUG), Y)
CPPUTEST_CXXFLAGS += -g
CPPUTEST_CFLAGS += -g
CPPUTEST_LDFLAGS += -g
endif
ifeq ($(CPPUTEST_USE_STD_CPP_LIB), N)
CPPUTEST_CPPFLAGS += -DCPPUTEST_STD_CPP_LIB_DISABLED
ifeq ($(CPPUTEST_USE_STD_C_LIB), Y)
CPPUTEST_CXXFLAGS += -nostdinc++
endif
endif
ifdef $(GMOCK_HOME)
GTEST_HOME = $(GMOCK_HOME)/gtest
CPPUTEST_CPPFLAGS += -I$(GMOCK_HOME)/include
GMOCK_LIBRARY = $(GMOCK_HOME)/lib/.libs/libgmock.a
LD_LIBRARIES += $(GMOCK_LIBRARY)
CPPUTEST_CPPFLAGS += -DCPPUTEST_INCLUDE_GTEST_TESTS
CPPUTEST_WARNINGFLAGS =
CPPUTEST_CPPFLAGS += -I$(GTEST_HOME)/include -I$(GTEST_HOME)
GTEST_LIBRARY = $(GTEST_HOME)/lib/.libs/libgtest.a
LD_LIBRARIES += $(GTEST_LIBRARY)
endif
ifeq ($(CPPUTEST_USE_GCOV), Y)
CPPUTEST_CXXFLAGS += -fprofile-arcs -ftest-coverage
CPPUTEST_CFLAGS += -fprofile-arcs -ftest-coverage
endif
CPPUTEST_CXXFLAGS += $(CPPUTEST_WARNINGFLAGS) $(CPPUTEST_CXX_WARNINGFLAGS)
CPPUTEST_CPPFLAGS += $(CPPUTEST_WARNINGFLAGS)
CPPUTEST_CXXFLAGS += $(CPPUTEST_MEMLEAK_DETECTOR_NEW_MACRO_FILE)
CPPUTEST_CPPFLAGS += $(CPPUTEST_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE)
CPPUTEST_CFLAGS += $(CPPUTEST_C_WARNINGFLAGS)
TARGET_MAP = $(COMPONENT_NAME).map.txt
ifeq ($(CPPUTEST_MAP_FILE), Y)
CPPUTEST_LDFLAGS += -Wl,-map,$(TARGET_MAP)
endif
# Link with CppUTest lib
CPPUTEST_LIB = $(CPPUTEST_LIB_LINK_DIR)/libCppUTest.a
ifeq ($(CPPUTEST_USE_EXTENSIONS), Y)
CPPUTEST_LIB += $(CPPUTEST_LIB_LINK_DIR)/libCppUTestExt.a
endif
ifdef CPPUTEST_STATIC_REALTIME
LD_LIBRARIES += -lrt
endif
TARGET_LIB = \
$(CPPUTEST_LIB_DIR)/lib$(COMPONENT_NAME).a
ifndef TEST_TARGET
ifndef TARGET_PLATFORM
TEST_TARGET = $(COMPONENT_NAME)_tests
else
TEST_TARGET = $(COMPONENT_NAME)_$(TARGET_PLATFORM)_tests
endif
endif
#Helper Functions
get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.cc) $(wildcard $1/*.c)
get_dirs_from_dirspec = $(wildcard $1)
get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir)))
__src_to = $(subst .c,$1, $(subst .cc,$1, $(subst .cpp,$1,$(if $(CPPUTEST_USE_VPATH),$(notdir $2),$2))))
src_to = $(addprefix $(CPPUTEST_OBJS_DIR)/,$(call __src_to,$1,$2))
src_to_o = $(call src_to,.o,$1)
src_to_d = $(call src_to,.d,$1)
src_to_gcda = $(call src_to,.gcda,$1)
src_to_gcno = $(call src_to,.gcno,$1)
time = $(shell date +%s)
delta_t = $(eval minus, $1, $2)
debug_print_list = $(foreach word,$1,echo " $(word)";) echo;
#Derived
STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP)
SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES)
OBJ = $(call src_to_o,$(SRC))
STUFF_TO_CLEAN += $(OBJ)
TEST_SRC += $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) $(TEST_SRC_FILES)
TEST_OBJS = $(call src_to_o,$(TEST_SRC))
STUFF_TO_CLEAN += $(TEST_OBJS)
MOCKS_SRC += $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS))
MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC))
STUFF_TO_CLEAN += $(MOCKS_OBJS)
ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC)
# If we're using VPATH
ifeq ($(CPPUTEST_USE_VPATH), Y)
# gather all the source directories and add them
VPATH += $(sort $(dir $(ALL_SRC)))
# Add the component name to the objs dir path, to differentiate between same-name objects
CPPUTEST_OBJS_DIR := $(addsuffix /$(COMPONENT_NAME),$(CPPUTEST_OBJS_DIR))
endif
#Test coverage with gcov
GCOV_OUTPUT = gcov_output.txt
GCOV_REPORT = gcov_report.txt
GCOV_ERROR = gcov_error.txt
GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC))
GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC))
TEST_OUTPUT = $(TEST_TARGET).txt
STUFF_TO_CLEAN += \
$(GCOV_OUTPUT)\
$(GCOV_REPORT)\
$(GCOV_REPORT).html\
$(GCOV_ERROR)\
$(GCOV_GCDA_FILES)\
$(GCOV_GCNO_FILES)\
$(TEST_OUTPUT)
#The gcda files for gcov need to be deleted before each run
#To avoid annoying messages.
GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR)
RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(CPPUTEST_EXE_FLAGS)
ifeq ($(CPPUTEST_USE_GCOV), Y)
ifeq ($(COMPILER_NAME),$(CLANG_STR))
LD_LIBRARIES += --coverage
else
LD_LIBRARIES += -lgcov
endif
endif
INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS))
INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir))
MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS))
INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir))
CPPUTEST_CPPFLAGS += $(INCLUDES)
DEP_FILES = $(call src_to_d, $(ALL_SRC))
STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END)
STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output
# We'll use the CPPUTEST_CFLAGS etc so that you can override AND add to the CppUTest flags
CFLAGS = $(CPPUTEST_CFLAGS) $(CPPUTEST_ADDITIONAL_CFLAGS)
CPPFLAGS = $(CPPUTEST_CPPFLAGS) $(CPPUTEST_ADDITIONAL_CPPFLAGS)
CXXFLAGS = $(CPPUTEST_CXXFLAGS) $(CPPUTEST_ADDITIONAL_CXXFLAGS)
LDFLAGS = $(CPPUTEST_LDFLAGS) $(CPPUTEST_ADDITIONAL_LDFLAGS)
# Don't consider creating the archive a warning condition that does STDERR output
ARFLAGS := $(ARFLAGS)c
DEP_FLAGS=-MMD -MP
# Some macros for programs to be overridden. For some reason, these are not in Make defaults
RANLIB = ranlib
# Targets
.PHONY: all
all: start $(TEST_TARGET)
$(RUN_TEST_TARGET)
.PHONY: start
start: $(TEST_TARGET)
$(SILENCE)START_TIME=$(call time)
.PHONY: all_no_tests
all_no_tests: $(TEST_TARGET)
.PHONY: flags
flags:
@echo
@echo "OS ${UNAME_OS}"
@echo "Compile C and C++ source with CPPFLAGS:"
@$(call debug_print_list,$(CPPFLAGS))
@echo "Compile C++ source with CXXFLAGS:"
@$(call debug_print_list,$(CXXFLAGS))
@echo "Compile C source with CFLAGS:"
@$(call debug_print_list,$(CFLAGS))
@echo "Link with LDFLAGS:"
@$(call debug_print_list,$(LDFLAGS))
@echo "Link with LD_LIBRARIES:"
@$(call debug_print_list,$(LD_LIBRARIES))
@echo "Create libraries with ARFLAGS:"
@$(call debug_print_list,$(ARFLAGS))
TEST_DEPS = $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(CPPUTEST_LIB) $(STDLIB_CODE_START)
test-deps: $(TEST_DEPS)
$(TEST_TARGET): $(TEST_DEPS)
@echo Linking $@
$(SILENCE)$(CXX) -o $@ $^ $(LD_LIBRARIES) $(LDFLAGS)
$(TARGET_LIB): $(OBJ)
@echo Building archive $@
$(SILENCE)mkdir -p $(dir $@)
$(SILENCE)$(AR) $(ARFLAGS) $@ $^
$(SILENCE)$(RANLIB) $@
test: $(TEST_TARGET)
$(RUN_TEST_TARGET) | tee $(TEST_OUTPUT)
vtest: $(TEST_TARGET)
$(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT)
$(CPPUTEST_OBJS_DIR)/%.o: %.cc
@echo compiling $(notdir $<)
$(SILENCE)mkdir -p $(dir $@)
$(SILENCE)$(COMPILE.cpp) $(DEP_FLAGS) $(OUTPUT_OPTION) $<
$(CPPUTEST_OBJS_DIR)/%.o: %.cpp
@echo compiling $(notdir $<)
$(SILENCE)mkdir -p $(dir $@)
$(SILENCE)$(COMPILE.cpp) $(DEP_FLAGS) $(OUTPUT_OPTION) $<
$(CPPUTEST_OBJS_DIR)/%.o: %.c
@echo compiling $(notdir $<)
$(SILENCE)mkdir -p $(dir $@)
$(SILENCE)$(COMPILE.c) $(DEP_FLAGS) $(OUTPUT_OPTION) $<
ifneq "$(MAKECMDGOALS)" "clean"
-include $(DEP_FILES)
endif
.PHONY: clean
clean:
@echo Making clean
$(SILENCE)$(RM) $(STUFF_TO_CLEAN)
$(SILENCE)rm -rf gcov $(CPPUTEST_OBJS_DIR) $(CPPUTEST_LIB_DIR)
$(SILENCE)find . -name "*.gcno" | xargs rm -f
$(SILENCE)find . -name "*.gcda" | xargs rm -f
#realclean gets rid of all gcov, o and d files in the directory tree
#not just the ones made by this makefile
.PHONY: realclean
realclean: clean
$(SILENCE)rm -rf gcov
$(SILENCE)find . -name "*.gdcno" | xargs rm -f
$(SILENCE)find . -name "*.[do]" | xargs rm -f
gcov: test
ifeq ($(CPPUTEST_USE_VPATH), Y)
$(SILENCE)gcov $(GCOV_ARGS) --object-directory $(CPPUTEST_OBJS_DIR) $(SRC) >> $(GCOV_OUTPUT) 2>> $(GCOV_ERROR)
else
$(SILENCE)for d in $(SRC_DIRS) ; do \
FILES=`ls $$d/*.c $$d/*.cc $$d/*.cpp 2> /dev/null` ; \
gcov $(GCOV_ARGS) --object-directory $(CPPUTEST_OBJS_DIR)/$$d $$FILES >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \
done
$(SILENCE)for f in $(SRC_FILES) ; do \
gcov $(GCOV_ARGS) --object-directory $(CPPUTEST_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \
done
endif
$(CPPUTEST_HOME)/scripts/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT)
$(SILENCE)cat $(GCOV_REPORT)
$(SILENCE)mkdir -p gcov
$(SILENCE)mv *.gcov gcov
$(SILENCE)mv gcov_* gcov
@echo "See gcov directory for details"
.PHONY: format
format:
$(CPPUTEST_HOME)/scripts/reformat.sh $(PROJECT_HOME_DIR)
.PHONY: debug
debug:
@echo
@echo "Target Source files:"
@$(call debug_print_list,$(SRC))
@echo "Target Object files:"
@$(call debug_print_list,$(OBJ))
@echo "Test Source files:"
@$(call debug_print_list,$(TEST_SRC))
@echo "Test Object files:"
@$(call debug_print_list,$(TEST_OBJS))
@echo "Mock Source files:"
@$(call debug_print_list,$(MOCKS_SRC))
@echo "Mock Object files:"
@$(call debug_print_list,$(MOCKS_OBJS))
@echo "All Input Dependency files:"
@$(call debug_print_list,$(DEP_FILES))
@echo Stuff to clean:
@$(call debug_print_list,$(STUFF_TO_CLEAN))
@echo Includes:
@$(call debug_print_list,$(INCLUDES))
-include $(OTHER_MAKEFILE_TO_INCLUDE)

View file

@ -1,10 +0,0 @@
$(CPPUTEST_TARGET) : $(OBJS)
ar -rc $@ $(OBJS)
$(RANLIB) $@
if [ "$(LIBDIR)" != "." ]; then\
mv $@ $(LIBDIR) ; \
fi
all: $(CPPUTEST_TARGET)

View file

@ -1,51 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning, Bas Vodde and Timo Puronen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
TARGET cpputest.exe
TARGETTYPE exe
UID 0x00000000 0x03A6305A
USERINCLUDE ..\include ..\include\CppUTest ..\include\Platforms\Symbian ..\tests
SYSTEMINCLUDE \epoc32\include \epoc32\include\stdapis
STATICLIBRARY libcrt0.lib
STATICLIBRARY cpputest.lib
LIBRARY euser.lib libc.lib libm.lib libpthread.lib
SOURCEPATH ..\tests
SOURCE FailureTest.cpp MemoryLeakWarningTest.cpp NullTestTest.cpp
SOURCE SimpleStringTest.cpp TestInstallerTest.cpp
SOURCE TestOutputTest.cpp TestRegistryTest.cpp UtestTest.cpp CommandLineTestRunnerTest.cpp JUnitOutputTest.cpp TeamCityOutputTest.cpp
SOURCE TestHarness_cTest.cpp
SOURCEPATH ..\tests
SOURCE AllTests.cpp TestResultTest.cpp PluginTest.cpp SetPluginTest.cpp
MACRO UT_NEW_MACROS_DISABLED
MACRO UT_NEW_OVERRIDES_DISABLED

View file

@ -1,50 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning, Bas Vodde and Timo Puronen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
PRJ_PLATFORMS
DEFAULT
PRJ_EXPORTS
..\include\CppUTest\TestHarness.h \epoc32\include\CppUTest\TestHarness.h
..\include\CppUTest\Utest.h \epoc32\include\CppUTest\Utest.h
..\include\CppUTest\UtestMacros.h \epoc32\include\CppUTest\UtestMacros.h
..\include\CppUTest\TestResult.h \epoc32\include\CppUTest\TestResult.h
..\include\CppUTest\Failure.h \epoc32\include\CppUTest\Failure.h
..\include\CppUTest\TestRegistry.h \epoc32\include\CppUTest\TestRegistry.h
..\include\CppUTest\SimpleString.h \epoc32\include\CppUTest\SimpleString.h
..\include\CppUTest\SimpleStringInternalCache.h \epoc32\include\CppUTest\SimpleStringInternalCache.h
..\include\CppUTest\MemoryLeakWarning.h \epoc32\include\CppUTest\MemoryLeakWarning.h
..\include\CppUTest\CommandLineTestRunner.h \epoc32\include\CppuTest\CommandLineTestRunner.h
..\include\CppUTest\TestOutput.h \epoc32\include\CppuTest\TestOutput.h
..\include\CppUTest\TestPlugin.h \epoc32\include\CppUTest\TestPlugin.h
..\include\CppUTest\PlatformSpecificFunctions.h \epoc32\include\CppUTest\PlatformSpecificFunctions.h
PRJ_MMPFILES
cpputest.mmp
PRJ_TESTMMPFILES
alltests.mmp

View file

@ -1,32 +0,0 @@
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was CppUTestConfig.cmake.install.in ########
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
macro(set_and_check _var _file)
set(${_var} "${_file}")
if(NOT EXISTS "${_file}")
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
endif()
endmacro()
macro(check_required_components _NAME)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(NOT ${_NAME}_${comp}_FOUND)
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()
endmacro()
####################################################################################
set_and_check(CppUTest_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/include")
include("${CMAKE_CURRENT_LIST_DIR}/CppUTestTargets.cmake")
set(CppUTest_LIBRARIES CppUTest CppUTestExt)
include("${CMAKE_CURRENT_LIST_DIR}/Modules/CppUTestBuildTimeDiscoverTests.cmake")
check_required_components(CppUTest)

View file

@ -1,37 +0,0 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
# but only if the requested major version is the same as the current one.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "4.0")
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
if("4.0" MATCHES "^([0-9]+)\\.")
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_MAJOR "4.0")
endif()
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
math(EXPR installedBits "8 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View file

@ -1,29 +0,0 @@
#----------------------------------------------------------------
# Generated CMake target import file for configuration "RelWithDebInfo".
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "CppUTest" for configuration "RelWithDebInfo"
set_property(TARGET CppUTest APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
set_target_properties(CppUTest PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELWITHDEBINFO "CXX"
IMPORTED_LOCATION_RELWITHDEBINFO "${_IMPORT_PREFIX}/lib/libCppUTest.a"
)
list(APPEND _IMPORT_CHECK_TARGETS CppUTest )
list(APPEND _IMPORT_CHECK_FILES_FOR_CppUTest "${_IMPORT_PREFIX}/lib/libCppUTest.a" )
# Import target "CppUTestExt" for configuration "RelWithDebInfo"
set_property(TARGET CppUTestExt APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
set_target_properties(CppUTestExt PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELWITHDEBINFO "CXX"
IMPORTED_LOCATION_RELWITHDEBINFO "${_IMPORT_PREFIX}/lib/libCppUTestExt.a"
)
list(APPEND _IMPORT_CHECK_TARGETS CppUTestExt )
list(APPEND _IMPORT_CHECK_FILES_FOR_CppUTestExt "${_IMPORT_PREFIX}/lib/libCppUTestExt.a" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

View file

@ -1,101 +0,0 @@
# Generated by CMake
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.6)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget CppUTest CppUTestExt)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
endif()
if(TARGET ${_expectedTarget})
list(APPEND _targetsDefined ${_expectedTarget})
endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
# Create imported target CppUTest
add_library(CppUTest STATIC IMPORTED)
set_target_properties(CppUTest PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/CppUTest"
)
# Create imported target CppUTestExt
add_library(CppUTestExt STATIC IMPORTED)
set_target_properties(CppUTestExt PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/CppUTestExt"
)
# Load information for each installed configuration.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/CppUTestTargets-*.cmake")
foreach(f ${CONFIG_FILES})
include(${f})
endforeach()
# Cleanup temporary variables.
set(_IMPORT_PREFIX)
# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
if(NOT EXISTS "${file}" )
message(FATAL_ERROR "The imported target \"${target}\" references the file
\"${file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS)
# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)

View file

@ -1,45 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning, Bas Vodde and Timo Puronen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
TARGET cpputest.lib
TARGETTYPE LIB
UID 0x00000000 0x03A6305A
USERINCLUDE ..\include ..\include\CppUTest ..\include\Platforms\Symbian
SYSTEMINCLUDE \epoc32\include \epoc32\include\stdapis
SOURCEPATH ..\src\CppUTest
SOURCE CommandLineTestRunner.cpp Failure.cpp MemoryLeakWarningPlugin.cpp SimpleString.cpp TestOutput.cpp TestPlugin.cpp TestRegistry.cpp TestResult.cpp Utest.cpp JUnitTestOutput.cpp TestHarness_c.cpp
SOURCEPATH ..\src\Platforms\Symbian
SOURCE SymbianMemoryLeakWarning.cpp UtestPlatform.cpp
MACRO UT_NEW_MACROS_DISABLED
MACRO UT_NEW_OVERRIDES_DISABLED
SOURCEPATH ..\src\CppUTest
SOURCE MemoryLeakDetector.cpp CommandLineArguments.cpp

View file

@ -1,56 +0,0 @@
#!/bin/bash
# run from the builds directory
listGccMacVersions()
{
port select --list gcc
}
if [ -z "$1" ]; then
echo "usage: $0 gcc-version\navailable versions:" 1>&2
listGccMacVersions
exit 1
fi
gcc_v=$1
setGccMac()
{
sudo port select --set gcc $1
}
setGccLinux()
{
echo "Not implemented for Linux"
exit 1
# if [ ! -f "/usr/bin/gcc-$1" ] || [ ! -f "/usr/bin/g++-$1" ]; then
# echo "no such version gcc/g++ installed" 1>&2
# exit 1
# fi
# update-alternatives --set gcc "/usr/bin/gcc-$1"
# update-alternatives --set g++ "/usr/bin/g++-$1"
}
if [ "$(uname)" == "Darwin" ]; then
setGccMac $gcc_v
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
setGccLinux $gcc_v
else
echo "can't determine OS"
exit 1
fi
pushd ..
cpputest_home=$(pwd)
popd
mkdir -p $gcc_v
cd $gcc_v
../../configure
make
make check
#these links keep compatibility with makefile worker
ln -s $cpputest_home/include include
ln -s $cpputest_home/build build
ln -s $cpputest_home/scripts scripts

View file

@ -1,19 +0,0 @@
# Create target to discover tests
function (cpputest_buildtime_discover_tests EXECUTABLE)
# The path to the discover script depends on execution mode:
# - internal (building CppUTest it self).
# - imported (installed, imported, and executed by a client of the CppUTest lib)
if (PROJECT_NAME STREQUAL "CppUTest") # internal - (path is relative to source dir)
SET(DISCOVER_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/Scripts/CppUTestBuildTimeDiscoverTests.cmake)
else (PROJECT_NAME STREQUAL "CppUTest") # Installed (path is relative to install directory)
SET(DISCOVER_SCRIPT ${CppUTest_DIR}/Scripts/CppUTestBuildTimeDiscoverTests.cmake)
endif (PROJECT_NAME STREQUAL "CppUTest")
add_custom_command (TARGET ${EXECUTABLE}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -DTESTS_DETAILED:BOOL=${TESTS_DETAILED} -DEXECUTABLE=$<TARGET_FILE:${EXECUTABLE}> -P ${DISCOVER_SCRIPT}
VERBATIM
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Discovering Tests in ${EXECUTABLE}"
VERBATIM)
endfunction ()

View file

@ -1,110 +0,0 @@
if (MSVC)
set(CPP_PLATFORM VisualCpp)
include_directories(${CppUTestRootDirectory}/include/Platforms/${CPP_PLATFORM})
option(STDC_WANT_SECURE_LIB "Use MSVC safe functions" ON)
if(STDC_WANT_SECURE_LIB)
ADD_DEFINITIONS(-DSTDC_WANT_SECURE_LIB)
endif(STDC_WANT_SECURE_LIB)
elseif (IAR)
set(CPP_PLATFORM Iar)
unset(CMAKE_CXX_EXTENSION_COMPILE_OPTION)
set(TESTS_BUILD_DISCOVER OFF)
# Set up the CMake variables for the linker
set(LINKER_SCRIPT "${CppUTestRootDirectory}/platforms/iar/CppUTestTest.icf")
set(CMAKE_C_LINK_FLAGS "--semihosting --config ${LINKER_SCRIPT} --map mapfile.map")
set(CMAKE_CXX_LINK_FLAGS "--semihosting --config ${LINKER_SCRIPT} --map mapfile.map")
elseif (STD_C)
if(NOT CPP_PLATFORM)
set(CPP_PLATFORM Gcc)
endif(NOT CPP_PLATFORM)
else (MSVC)
set(STD_CPP False)
set(MEMORY_LEAK_DETECTION False)
set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -nostdinc")
set(CPPUTEST_LD_FLAGS "${CPPUTEST_LD_FLAGS} -nostdinc")
set(CPPUTEST_STD_C_LIB_DISABLED 1)
set(CPP_PLATFORM GccNoStdC)
endif (MSVC)
include("${CppUTestRootDirectory}/cmake/Modules/CppUTestWarningFlags.cmake")
if (NOT STD_CPP)
set(CPPUTEST_STD_CPP_LIB_DISABLED 1)
if (STD_C AND NOT MSVC)
set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -nostdinc++")
endif (STD_C AND NOT MSVC)
endif (NOT STD_CPP)
if (MEMORY_LEAK_DETECTION)
if (MSVC)
set(CPPUTEST_C_FLAGS "${CPPUTEST_C_FLAGS} /FI \"${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h\"")
set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} /FI \"${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h\"")
elseif (IAR)
set(CPPUTEST_C_FLAGS "${CPPUTEST_C_FLAGS} --preinclude \"${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h\"")
set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} --preinclude \"${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorNewMacros.h\"")
set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} --preinclude \"${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h\"")
else (MSVC)
set(CPPUTEST_C_FLAGS "${CPPUTEST_C_FLAGS} -include \"${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h\"")
set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -include \"${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorNewMacros.h\"")
set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -include \"${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h\"")
endif (MSVC)
else (MEMORY_LEAK_DETECTION)
set(CPPUTEST_MEM_LEAK_DETECTION_DISABLED 1)
endif (MEMORY_LEAK_DETECTION)
if (LONGLONG)
set(CPPUTEST_USE_LONG_LONG 1)
endif (LONGLONG)
if (MAP_FILE AND NOT MSVC)
set(CPPUTEST_LD_FLAGS "${CPPUTEST_LD_FLAGS} -Wl,-Map,$<.map.txt")
endif (MAP_FILE AND NOT MSVC)
if (COVERAGE AND NOT MSVC)
set(CPPUTEST_C_FLAGS "${CPPUTEST_C_FLAGS} --coverage")
set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} --coverage")
set(CMAKE_BUILD_TYPE "Debug")
find_program(GCOVR gcovr DOC "gcovr executable")
if (NOT GCOVR)
message(SEND_ERROR "gcovr not found")
endif()
add_custom_target(coverage ${GCOVR}
--root ${PROJECT_SOURCE_DIR}
--output "${CMAKE_BINARY_DIR}/coverage/coverage.html"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generate coverage data"
VERBATIM
)
endif()
if (CMAKE_CXX_STANDARD)
set(CMAKE_CXX_EXTENSIONS OFF)
elseif (C++11)
find_package(CXX11 REQUIRED)
set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} ${CXX11_FLAGS}")
else()
# No standard specified
endif ()
set(GMOCK_HOME $ENV{GMOCK_HOME})
if (DEFINED ENV{GMOCK_HOME})
# GMock pulls in gtest.
set(CPPUTEST_INCLUDE_GTEST_TESTS 1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1")
include_directories(${GMOCK_HOME}/include ${GMOCK_HOME}/gtest ${GMOCK_HOME}/gtest/include)
add_subdirectory(${GMOCK_HOME} "${CMAKE_CURRENT_BINARY_DIR}/gmock")
set(CPPUTEST_C_WARNING_FLAGS "")
set(CPPUTEST_CXX_WARNING_FLAGS "")
endif (DEFINED ENV{GMOCK_HOME})
set(CPPUTEST_C_FLAGS "${CPPUTEST_C_FLAGS} ${CPPUTEST_C_WARNING_FLAGS}")
set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} ${CPPUTEST_CXX_WARNING_FLAGS}")
if (CPPUTEST_FLAGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CPPUTEST_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPPUTEST_CXX_FLAGS}")
set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} ${CPPUTEST_LD_FLAGS}")
endif (CPPUTEST_FLAGS)

View file

@ -1,10 +0,0 @@
# Override output properties to put test executable at specificied location
function (cpputest_normalize_test_output_location TEST_TARGET)
set_target_properties(${TEST_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
foreach(OUTPUT_CONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUT_CONFIG} OUTPUT_CONFIG)
set_target_properties(${TEST_TARGET} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_${OUTPUT_CONFIG} ${CMAKE_CURRENT_BINARY_DIR})
endforeach(OUTPUT_CONFIG)
endfunction ()

View file

@ -1,80 +0,0 @@
if (MSVC)
set(CPPUTEST_C_WARNING_FLAGS "/WX")
set(CPPUTEST_CXX_WARNING_FLAGS "/WX /wd4290")
else (MSVC)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
macro(check_and_append_c_warning_flags)
foreach (flag ${ARGN})
check_c_compiler_flag("-${flag}" WARNING_C_FLAG_${flag})
if (WARNING_C_FLAG_${flag})
set(CPPUTEST_C_WARNING_FLAGS "${CPPUTEST_C_WARNING_FLAGS} -${flag}")
endif (WARNING_C_FLAG_${flag})
endforeach (flag)
endmacro(check_and_append_c_warning_flags)
macro(check_and_append_cxx_warning_flags)
foreach (flag ${ARGN})
string(REPLACE "++" "xx" WARNING_CXX_FLAG_VAR "WARNING_CXX_FLAG_${flag}")
check_cxx_compiler_flag("-${flag}" ${WARNING_CXX_FLAG_VAR})
if (${WARNING_CXX_FLAG_VAR})
set(CPPUTEST_CXX_WARNING_FLAGS "${CPPUTEST_CXX_WARNING_FLAGS} -${flag}")
endif (${WARNING_CXX_FLAG_VAR})
endforeach (flag)
endmacro(check_and_append_cxx_warning_flags)
if (NOT GMOCK AND NOT REAL_GTEST)
list(APPEND WARNING_C_FLAGS Werror pedantic-errors)
endif (NOT GMOCK AND NOT REAL_GTEST)
set(WARNING_C_FLAGS
Weverything
Wall
Wextra
pedantic
Wshadow
Wswitch-default
Wswitch-enum
Wconversion
Wsign-conversion
Wno-padded
Wno-disabled-macro-expansion
Wno-reserved-id-macro
Wno-keyword-macro
Wno-long-long
)
if (WERROR)
list(APPEND WARNING_C_FLAGS Werror)
endif (WERROR)
set(WARNING_C_ONLY_FLAGS
Wstrict-prototypes
)
set(WARNING_CXX_FLAGS
${WARNING_C_FLAGS}
Woverloaded-virtual
Wno-global-constructors
Wno-exit-time-destructors
Wno-weak-vtables
Wno-old-style-cast
)
if (C++11 OR (DEFINED CMAKE_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD EQUAL 98))
set(WARNING_CXX_FLAGS
${WARNING_CXX_FLAGS}
Wno-c++98-compat
Wno-c++98-compat-pedantic
Wno-c++14-compat
Wno-inconsistent-missing-destructor-override
)
endif ()
check_and_append_c_warning_flags(${WARNING_C_FLAGS})
check_and_append_c_warning_flags(${WARNING_C_ONLY_FLAGS})
check_and_append_cxx_warning_flags(${WARNING_CXX_FLAGS})
endif (MSVC)

View file

@ -1,54 +0,0 @@
# - Finds if the compiler has C++11 support
# This module can be used to detect compiler flags for using C++11, and checks
# a small subset of the language.
#
# The following variables are set:
# CXX11_FLAGS - flags to add to the CXX compiler for C++11 support
# CXX11_FOUND - true if the compiler supports C++11
#
# TODO: When compilers starts implementing the whole C++11, check the full set
include(CheckCXXSourceCompiles)
include(FindPackageHandleStandardArgs)
set(CXX11_FLAG_CANDIDATES
# Eveerything that automatically accepts C++11
" "
# gcc, clang and Intel Linux
"-std=c++11"
# Intel windows
"/Qstd=c++0x"
"/Qstd=c++11"
)
set(CXX11_TEST_SOURCE
"
#if defined(_MSC_VER)
#if _MSC_VER < 1800
#error \"Can not compile with C++11\"
#endif
#elif __cplusplus < 201103L
#error \"Can not compile with C++11\"
#endif
int main()
{}
")
foreach(FLAG ${CXX11_FLAG_CANDIDATES})
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
unset(CXX11_FLAG_DETECTED CACHE)
message(STATUS "Try C++11 flag = [${FLAG}]")
check_cxx_source_compiles("${CXX11_TEST_SOURCE}" CXX11_FLAG_DETECTED)
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
if(CXX11_FLAG_DETECTED)
set(CXX11_FLAGS_INTERNAL "${FLAG}")
break()
endif(CXX11_FLAG_DETECTED)
endforeach(FLAG ${CXX11_FLAG_CANDIDATES})
set(CXX11_FLAGS "${CXX11_FLAGS_INTERNAL}")
find_package_handle_standard_args(CXX11 DEFAULT_MSG CXX11_FLAGS)
mark_as_advanced(CXX11_FLAGS)

View file

@ -1,94 +0,0 @@
# Create CTest entries for EXECUTABLE in CTestTestfile.cmake
# Overwrite CTestTestfile.cmake with update version.
# Usage:
#
# This script is to be called from ../Modules/CppUTestBuildTimeDiscoverTests.cmake
#
# Notes on invocation and used variables:
# ${CMAKE_COMMAND} -DTESTS_DETAILED:BOOL=<ON|OFF> -DEXECUTABLE=<FULLPATH-TO-EXECUTABLE> -P <PATH-TO-THIS-SCRIPT>
#
# TESTS_DETAILED c.f. top-level CMakeLists.txt
# FULLPATH-TO-EXECUTABLE - use $<TARGET_FILE:${EXECUTABLE}> or explicit
# The overwritten CTestTestfile.cmake is located in ${CMAKE_CURRENT_BINARY_DIR}
#
# Steps to generate ADD_TEST() commands build time
# - Read CTestTestfile.cmake
# - Create update entries
# - Remove duplicate entries
# - Write new CTestTestfile.cmake
######################################################################
# helpers
######################################################################
function (buildtime_add_test)
# Create ADD_TEST() command string
# - Extract and remove testname from ARGV
# - Add inner quotes to test arguments
# - Add "ADD_TEST()", and first and last quote
# Append result to CTESTTESTS
list(GET ARGV 0 testname)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" "\" \"" TEST_ARGS "${ARGV}")
set(test_to_add "ADD_TEST(${testname} \"${TEST_ARGS}\")")
list(APPEND CTESTTESTS ${test_to_add})
SET(CTESTTESTS ${CTESTTESTS} PARENT_SCOPE)
endfunction()
function (JOIN VALUES GLUE OUTPUT)
string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
endfunction()
function (buildtime_discover_tests EXECUTABLE DISCOVER_ARG OUTPUT)
execute_process(COMMAND ${EXECUTABLE} ${DISCOVER_ARG}
OUTPUT_VARIABLE _TMP_OUTPUT
ERROR_VARIABLE DISCOVER_ERR
RESULT_VARIABLE DISCOVER_ERR)
if(NOT ${DISCOVER_ERR} EQUAL 0)
message(SEND_ERROR "Executable \"${EXECUTABLE} ${DISCOVER_ARG}\" failed with output:\n"
"${DISCOVER_ERR}\n"
"Please check that the excutable was added.")
endif(NOT ${DISCOVER_ERR} EQUAL 0)
separate_arguments(_TMP_OUTPUT)
set(${OUTPUT} "${_TMP_OUTPUT}" PARENT_SCOPE)
endfunction()
######################################################################
# Implementation
######################################################################
set(CTESTFNAME "${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile.cmake")
file(STRINGS ${CTESTFNAME} CTESTTESTS)
get_filename_component(EXECUTABLE_SHORT_NAME ${EXECUTABLE} NAME_WE)
if (TESTS_DETAILED)
set(DISCOVER_ARG "-ln")
buildtime_discover_tests("${EXECUTABLE}" "${DISCOVER_ARG}" TestList_GroupsAndNames)
set(lastgroup "")
foreach(testfullname ${TestList_GroupsAndNames})
string(REGEX MATCH "^([^/.]+)" groupname ${testfullname})
string(REGEX MATCH "([^/.]+)$" testname ${testfullname})
if (NOT ("${groupname}" STREQUAL "${lastgroup}"))
message("TestGroup: ${groupname}:")
set(lastgroup "${groupname}")
endif (NOT ("${groupname}" STREQUAL "${lastgroup}"))
message("... ${testname}")
buildtime_add_test(${EXECUTABLE_SHORT_NAME}.${testfullname} ${EXECUTABLE} -sg ${groupname} -sn ${testname})
endforeach()
else (TESTS_DETAILED)
set(DISCOVER_ARG "-lg")
buildtime_discover_tests("${EXECUTABLE}" "${DISCOVER_ARG}" TestList_Groups)
foreach(group ${TestList_Groups})
message("TestGroup: ${group}")
buildtime_add_test(${EXECUTABLE_SHORT_NAME}.${group} "${EXECUTABLE}" -sg ${group})
endforeach()
endif (TESTS_DETAILED)
# create separate CTest test for each CppUTestTests test
list(REMOVE_DUPLICATES CTESTTESTS)
JOIN("${CTESTTESTS}" "\n" CTESTTESTS)
file(WRITE ${CTESTFNAME} "${CTESTTESTS}\n")

View file

@ -1,6 +0,0 @@
# Toolchain to use Clang compiler with MinGW binutils (e.g. linker) in Windows to generate 32-bits executables
set(CMAKE_C_COMPILER clang)
set(CMAKE_C_FLAGS "-target i686-w64-mingw32 -m32" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_FLAGS "-target i686-w64-mingw32 -m32" CACHE STRING "" FORCE)

View file

@ -1,6 +0,0 @@
# Toolchain to use Clang compiler with MinGW binutils (e.g. linker) in Windows to generate 64-bits executables
set(CMAKE_C_COMPILER clang)
set(CMAKE_C_FLAGS "-target x86_64-w64-mingw32" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_FLAGS "-target x86_64-w64-mingw32" CACHE STRING "" FORCE)

View file

@ -1,24 +0,0 @@
### BEGIN CMAKE_TOOLCHAIN_FILE
# "Generic" is used when cross compiling
set(CMAKE_SYSTEM_NAME Generic)
# Set the EW installation root directory
#(Avoid spaces in the path or you need to escape them)
set(EW_ROOT_DIR "/opt/iarsystems/bxarm/arm/")
# Compiler flags needed to compile for this CPU
set(CPU_FLAGS "--cpu Cortex-M4F")
# Set up the CMake variables for compiler and assembler
# (The reason for both C and CXX variables is that CMake
# treats C and C++ tools individually)
set(CMAKE_C_COMPILER "${EW_ROOT_DIR}/bin/iccarm" "${CPU_FLAGS} --dlib_config normal")
set(CMAKE_CXX_COMPILER "${EW_ROOT_DIR}/bin/iccarm" "${CPU_FLAGS} --dlib_config normal")
set(CMAKE_ASM_COMPILER "${EW_ROOT_DIR}/bin/iasmarm" "${CPU_FLAGS}")
# For CppUTest, set the IAR variable
set(IAR True)
# Build with cmake -H. -Bbuild -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=cmake/ewarm-linux.toolchain.cmake
### END CMAKE_TOOLCHAIN_FILE

View file

@ -1,24 +0,0 @@
### BEGIN CMAKE_TOOLCHAIN_FILE
# "Generic" is used when cross compiling
set(CMAKE_SYSTEM_NAME Generic)
# Set the EW installation root directory
#(Avoid spaces in the path or you need to escape them)
set(EW_ROOT_DIR "E:/Program Files\ (x86)/IAR\ Systems/Embedded\ Workbench\ Arm 8.50.6/arm")
# Compiler flags needed to compile for this CPU
set(CPU_FLAGS "--cpu Cortex-M4F")
# Set up the CMake variables for compiler and assembler
# (The reason for both C and CXX variables is that CMake
# treats C and C++ tools individually)
set(CMAKE_C_COMPILER "${EW_ROOT_DIR}/bin/iccarm.exe" "${CPU_FLAGS} --dlib_config normal")
set(CMAKE_CXX_COMPILER "${EW_ROOT_DIR}/bin/iccarm.exe" "${CPU_FLAGS} --dlib_config normal")
set(CMAKE_ASM_COMPILER "${EW_ROOT_DIR}/bin/iasmarm.exe" "${CPU_FLAGS}")
# For CppUTest, set the IAR variable
set(IAR True)
# Build with cmake -H. -Bbuild -G "NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=cmake/ewarm-win.toolchain.cmake
### END CMAKE_TOOLCHAIN_FILE

View file

@ -1,12 +0,0 @@
#ifndef CONFIG_H_
#define CONFIG_H_
#cmakedefine CPPUTEST_MEM_LEAK_DETECTION_DISABLED
#cmakedefine CPPUTEST_USE_LONG_LONG
#cmakedefine CPPUTEST_STD_C_LIB_DISABLED
#cmakedefine CPPUTEST_STD_CPP_LIB_DISABLED
#cmakedefine INCLUDE_GTEST_TESTS
#endif

View file

@ -1,636 +0,0 @@
AC_PREREQ([2.68])
AC_INIT([CppUTest], [4.0], [https://github.com/cpputest/cpputest])
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_SRCDIR([src/CppUTest/Utest.cpp])
AC_CONFIG_HEADERS([config.h])
AX_PREFIX_CONFIG_H(generated/CppUTestGeneratedConfig.h)
AC_CONFIG_FILES([cpputest.pc])
AC_CONFIG_MACRO_DIR([m4])
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AC_CANONICAL_HOST
default_use_std_cpp=yes
case "x$build_os" in
*darwin*)
AC_SUBST([CPPUTEST_ON_MACOSX], [yes])
;;
*mingw*)
default_use_std_cpp=no
;;
esac
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_CC_C_O
AM_SILENT_RULES
ACX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS"])
AX_COMPILER_VERSION
# This additional -lpthread was added due to a bug on gcc for MacOSX: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42159
# According to the bug report, a workaround is to link -lpthread. Even the ACX_PTHREAD doesn't do that, so we add an
# additional check if that it possible, and if it is, then we link pthread
saved_libs="$LIBS"
LIBS=-lpthread
AC_MSG_CHECKING([if we can link -lpthread to work around a gcc bug (on MacOSX)])
AC_LINK_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); HACK_TO_USE_PTHREAD_LIBS=" -lpthread"], [AC_MSG_RESULT([no])])
LIBS="$saved_libs $HACK_TO_USE_PTHREAD_LIBS"
AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_TYPE_LONG_LONG_INT
# Checks for library functions.
AC_FUNC_FORK
AC_CHECK_FUNCS([gettimeofday memset strstr strdup pthread_mutex_lock])
AC_CHECK_PROG([CPPUTEST_HAS_GCC], [gcc], [yes], [no])
AC_CHECK_PROG([CPPUTEST_HAS_CLANG], [clang], [yes], [no])
AC_CHECK_PROG([CPPUTEST_HAS_LCOV], [lcov], [yes], [no])
AC_CHECK_PROG([CPPUTEST_HAS_VALGRIND], [valgrind], [yes], [no])
AC_CHECK_PROG([CPPUTEST_HAS_DASH], [dash], [yes], [no])
# Checking for warning flags on the compiler
saved_cflags="$CFLAGS"
saved_cxxflags="$CXXFLAGS"
saved_ldflags="$LDFLAGS"
if test "x$USE_MAINTAINER_MODE" = "xyes"; then
# FLag -Werror.
CFLAGS=-Werror
AC_MSG_CHECKING([whether CC and CXX supports -Werror])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS_STRICT="${CPPUTEST_CWARNINGFLAGS} -Werror"; CPPUTEST_CXXWARNINGFLAGS_STRICT="${CPPUTEST_CXXWARNINGFLAGS} -Werror" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
fi
AC_LANG_PUSH([C++])
#####################################################################################
##### C++ checks
# FLag -std=c++1y
CXXFLAGS="-Werror -std=c++1y"
AC_MSG_CHECKING([whether CXX supports -std=c++1y])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP14FLAG="-std=c++1y" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# FLag std=c++14
CXXFLAGS="-Werror -std=c++14"
AC_MSG_CHECKING([whether CXX supports -std=c++14])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP14FLAG="-std=c++14" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# FLag std=c++17
CXXFLAGS="-Werror -std=c++17"
AC_MSG_CHECKING([whether CXX supports -std=c++17])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP17FLAG="-std=c++17" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# FLag std=c++20
CXXFLAGS="-Werror -std=c++2a"
AC_MSG_CHECKING([whether CXX supports -std=c++2a])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP20FLAG="-std=c++2a" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# FLag std=c++20
CXXFLAGS="-Werror -std=c++20"
AC_MSG_CHECKING([whether CXX supports -std=c++20])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP20FLAG="-std=c++20" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
#####################################################################################
##### C++ version checks
### Checking for C++ version compiler flags
# FLag -std=c++98
CXXFLAGS="-Werror -std=c++98"
AC_MSG_CHECKING([whether CXX supports -std=c++98])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP98FLAG="-std=c++98" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# FLag -std=c++0x
CXXFLAGS="-Werror -std=c++0x"
AC_MSG_CHECKING([whether CXX supports -std=c++0x])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP11FLAG="-std=c++0x" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
CXXFLAGS="-Werror -std=c++11"
AC_MSG_CHECKING([whether CXX supports -std=c++11])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP11FLAG="-std=c++11" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
CXXFLAGS="-Werror -stdlib=libc++"
AC_MSG_CHECKING([whether CXX supports -stdlib=libc++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <cstdio>]])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP11FLAG="${CPPUTEST_CPP11FLAG} -stdlib=libc++" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# Flag -Wno-c++98-compat
CXXFLAGS="-Werror -Wno-c++98-compat"
AC_MSG_CHECKING([whether CXX supports -Wno-c++98-compat])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-c++98-compat" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# Flag -Wno-c++98-compat-pedantic
CXXFLAGS="-Werror -Wno-c++98-compat-pedantic"
AC_MSG_CHECKING([whether CXX supports -Wno-c++98-compat-pedantic])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-c++98-compat-pedantic" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# Flag -Wno-c++14-compat
CXXFLAGS="-Werror -Wno-c++14-compat"
AC_MSG_CHECKING([whether CXX supports -Wno-c++14-compat])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-c++14-compat" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
AC_LANG_POP
# FLag -Wno-c++11-long-long. This must be on if it is available as otherwise long long is supported but causes a warning.
CFLAGS="-Werror -Wno-c++11-long-long"
AC_MSG_CHECKING([whether CC and CXX supports -Wno-c++11-long-long])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wno-c++11-long-long" CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-c++11-long-long" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -Wno-long-long must be on for C.
CFLAGS="-Werror -Wno-long-long"
AC_MSG_CHECKING([whether CC and CXX supports -Wno-long-long])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wno-long-long" CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-long-long"], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
#####################################################################################
##### More of these warnings
# FLag -Weverything.
CFLAGS="-Werror -Weverything -Wno-unused-macros"
AC_MSG_CHECKING([whether CC and CXX supports -Weverything])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Weverything"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Weverything" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -Wall.
CFLAGS="-Werror -Wall"
AC_MSG_CHECKING([whether CC and CXX supports -Wall])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wall"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wall" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -Wextra.
CFLAGS="-Werror -Wextra"
AC_MSG_CHECKING([whether CC and CXX supports -Wextra])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wextra"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wextra" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -Wshadow.
CFLAGS="-Werror -Wshadow"
AC_MSG_CHECKING([whether CC and CXX supports -Wshadow])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wshadow"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wshadow" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -Wswitch-default
CFLAGS="-Werror -Wswitch-default"
AC_MSG_CHECKING([whether CC and CXX supports -Wswitch-default])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wswitch-default"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wswitch-default" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -Wswitch-enum
CFLAGS="-Werror -Wswitch-enum"
AC_MSG_CHECKING([whether CC and CXX supports -Wswitch-enum])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wswitch-enum"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wswitch-enum" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -Wconversion
CFLAGS="-Werror -Wconversion"
AC_MSG_CHECKING([whether CC and CXX supports -Wconversion])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wconversion"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wconversion" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -pedantic
CFLAGS="-Werror -pedantic"
AC_MSG_CHECKING([whether CC and CXX supports -pedantic])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -pedantic"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -pedantic" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -Wsign-conversion
CFLAGS="-Werror -Wsign-conversion"
AC_MSG_CHECKING([whether CC supports -Wsign-conversion])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wsign-conversion"], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
##### C++ Warnings
# FLag -Wsign-conversion (for CXX)
AC_LANG_PUSH([C++])
CXXFLAGS="-Werror -Wsign-conversion"
AC_MSG_CHECKING([whether CXX supports -Wsign-conversion])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wsign-conversion"], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# FLag -Woverloaded-virtual
CXXFLAGS="-Werror -Woverloaded-virtual"
AC_MSG_CHECKING([whether CXX supports -Woverloaded-virtual])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Woverloaded-virtual" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
AC_LANG_POP
# FLag -Wstrict-prototypes
CFLAGS="-Werror -Wstrict-prototypes"
AC_MSG_CHECKING([whether CC supports -Wstrict-prototypes])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wstrict-prototypes" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
#####################################################################################
##### Less of these warnings
#
# Disable some warnings as CppUTest has this and can't be prevented at the moment.
# FLag -Wno-disabled-macro-expansion.
CFLAGS="-Werror -Wno-disabled-macro-expansion"
AC_MSG_CHECKING([whether CC and CXX supports -Wno-disabled-macro-expansion])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wno-disabled-macro-expansion"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-disabled-macro-expansion" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -Wno-padded.
CFLAGS="-Werror -Wno-padded"
AC_MSG_CHECKING([whether CC and CXX supports -Wno-padded])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wno-padded"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-padded" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -Wno-reserved-id-macro.
CFLAGS="-Werror -Wno-reserved-id-macro"
AC_MSG_CHECKING([whether CC and CXX supports -Wno-reserved-id-macro])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wno-reserved-id-macro"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-reserved-id-macro" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
# FLag -Wno-keyword-macro.
CFLAGS="-Werror -Wno-keyword-macro"
AC_MSG_CHECKING([whether CC and CXX supports -Wno-keyword-macro])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wno-keyword-macro"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-keyword-macro" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
AC_LANG_PUSH([C++])
# FLag -Wno-global-constructors.
CXXFLAGS="-Werror -Wno-global-constructors"
AC_MSG_CHECKING([whether CXX supports -Wno-global-constructors])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-global-constructors" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# FLag -Wno-exit-time-destructors.
CXXFLAGS="-Werror -Wno-exit-time-destructors"
AC_MSG_CHECKING([whether CXX supports -Wno-exit-time-destructors])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-exit-time-destructors" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# FLag -Wno-weak-vtables.
CXXFLAGS="-Werror -Wno-weak-vtables"
AC_MSG_CHECKING([whether CXX supports -Wno-weak-vtables])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-weak-vtables" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
# FLag -Wno-old-style-cast.
CXXFLAGS="-Werror -Wno-old-style-cast"
AC_MSG_CHECKING([whether CXX supports -Wno-old-style-cast])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-old-style-cast" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
AC_LANG_POP
#####################################################
######## End warning section
# FLag --coverage
AC_LANG_PUSH([C++])
CXXFLAGS="-Werror --coverage"
AC_MSG_CHECKING([whether CXX and the linker supports --coverage (broken in clang 3.3)])
AC_LINK_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); coverage_flag_supported="yes" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
AC_LANG_POP
######################################################
# Exception Handling
#
# Checking for strange exception handling behavior, related to bugs in compilers...
AC_LANG_PUSH([C++])
# Can we use operator delete without exception handling specifier? (clang warns on this!)
CXXFLAGS="-Werror"
AC_MSG_CHECKING([whether CXX supports operator delete without exception handling specifier])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <new>\nvoid operator delete(void* mem);])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); UT_DELETE_MUST_HAVE_EXCEPTION_SPECIFIER="yes"])
CXXFLAGS="$saved_cxxflags"
# Can we use operator new with exception specifier (g++4.7 on MacOSX is broken here)
CXXFLAGS="-Werror"
AC_MSG_CHECKING([whether CXX supports operator new with exception handling specifier])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <new>\nvoid* operator new(size_t size) throw(std::bad_alloc);;])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); UT_NEW_CANT_HAVE_EXCEPTION_SPECIFIER="yes"])
CXXFLAGS="$saved_cxxflags"
# FLag -Wno-missing-exception-spec
CXXFLAGS="-Werror -Wno-missing-exception-spec"
AC_MSG_CHECKING([whether CXX supports -Wno-missing-exception-spec])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXX_NO_INC_WARNINGFLAGS="${CPPUTEST_CXX_NO_INC_WARNINGFLAGS} -Wno-missing-exception-spec" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
AC_LANG_POP
##### Linker checking.
#
# TBD!
# Things that need to be fixed!
#
# The below code is checking for the -Qunused-arguments which is a linker flag. However, it says gcc supports it, while in fact, it doesn't.
# As a workaround, we'll just check whether it is clang hardcoded, this is not in the automake spirit and will need to be fixed.
#
# LDFLAGS=
# AC_MSG_CHECKING([whether LD supports -Qunused-arguments])
# AC_LINK_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_NO_UNUSED_ARGUMENT_WARNING=" -Qunused-arguments" ], [AC_MSG_RESULT([no])])
# LDFLAGS="$saved_ldflags"
AC_MSG_CHECKING([whether CXXLD supports -Qunused-arguments linker option])
OUTPUT_WHEN_CLANG_COMPILER=`${CXX} --version | grep clang`
AM_CONDITIONAL([TEST_COMPILER_IS_CLANG], [ ! test -z "$OUTPUT_WHEN_CLANG_COMPILER]")
AM_COND_IF([TEST_COMPILER_IS_CLANG],
[AC_MSG_RESULT([yes]); CPPUTEST_NO_UNUSED_ARGUMENT_WARNING=" ${CPPUTEST_NO_UNUSED_ARGUMENT_WARNING} -Qunused-arguments"],
[AC_MSG_RESULT([no])]; CPPUTEST_NO_UNUSED_ARGUMENT_WARNING="${CPPUTEST_NO_UNUSED_ARGUMENT_WARNING} ")
# Checking for options for creating map files
LDFLAGS=" -Wl,-map,filename.map.txt"
AC_MSG_CHECKING([whether LD supports -Wl,-map])
AC_LINK_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_LD_MAP_GENERATION=" -Wl,-map,filename.map.txt" ], [AC_MSG_RESULT([no])])
LDFLAGS="$saved_ldflags"
# Different features
AC_ARG_ENABLE([std-c], [AC_HELP_STRING([--disable-std-c], [disable the use of Standard C Library (warning: requires implementing Platforms/GccNoStdC) ])],
[use_std_c=${enableval}], [use_std_c=yes])
AC_ARG_ENABLE([std-cpp], [AC_HELP_STRING([--disable-std-cpp], [disable the use of Standard C++ Library])],
[use_std_cpp=${enableval}], [use_std_cpp=${default_use_std_cpp}])
AC_ARG_ENABLE([std-cpp98], [AC_HELP_STRING([--enable-std-cpp98], [enable the use of Standard C++ 98 (if the compiler supports that)])],
[use_std_cpp98=${enableval}], [use_std_cpp98=no])
AC_ARG_ENABLE([std-cpp11], [AC_HELP_STRING([--enable-std-cpp11], [enable the use of Standard C++ 11 (if the compiler supports that)])],
[use_std_cpp11=${enableval}], [use_std_cpp11=no])
AC_ARG_ENABLE([std-cpp14], [AC_HELP_STRING([--enable-std-cpp14], [enable the use of Standard C++ 14 (if the compiler supports that)])],
[use_std_cpp14=${enableval}], [use_std_cpp14=no])
AC_ARG_ENABLE([std-cpp17], [AC_HELP_STRING([--enable-std-cpp17], [enable the use of Standard C++ 17 (if the compiler supports that)])],
[use_std_cpp17=${enableval}], [use_std_cpp17=no])
AC_ARG_ENABLE([std-cpp20], [AC_HELP_STRING([--enable-std-cpp20], [enable the use of Standard C++ 20 (if the compiler supports that)])],
[use_std_cpp20=${enableval}], [use_std_cpp20=no])
AC_ARG_ENABLE([cpputest-flags], [AC_HELP_STRING([--disable-cpputest-flags], [disable CFLAGS/CPPFLAGS/CXXFLAGS set by CppUTest])],
[cpputest_flags=${enableval}], [cpputest_flags=yes])
AC_ARG_ENABLE([memory-leak-detection], [AC_HELP_STRING([--disable-memory-leak-detection], [disable memory leak detection])],
[memory_leak_detection=${enableval}], [memory_leak_detection=yes])
AC_ARG_ENABLE([extensions], [AC_HELP_STRING([--disable-extensions], [disable CppUTest extension library])],
[cpputest_ext=${enableval}], [cpputest_ext=yes])
AC_ARG_ENABLE([longlong], [AC_HELP_STRING([--disable-longlong], [disable support for long long type])],
[use_longlong=${enableval}], [use_longlong=yes])
AC_ARG_ENABLE([generate-map-file], [AC_HELP_STRING([--enable-generate-map-file], [enable the creation of a map file])],
[generate_map_file=${enableval}], [generate_map_file=no])
AC_ARG_ENABLE([coverage], [AC_HELP_STRING([--enable-coverage], [enable running with coverage])],
[coverage=${enableval}], [coverage=no])
AC_ARG_ENABLE([sanitize-address], [AC_HELP_STRING([--enable-sanitize-address], [enable running with address sanitizer])],
[sanitize_address=${enableval}], [sanitize_address=no])
############################## Setting options ###############################
AM_CONDITIONAL([INCLUDE_CPPUTEST_EXT], [test "x${cpputest_ext}" = xyes])
# Dealing with not having a Standard C library... (usually for Kernel development)
if test "x${use_std_c}" = xno; then
use_std_cpp=no
memory_leak_detection=no
CPPUTEST_CPPFLAGS="${CPPUTEST_CPPFLAGS} -nostdinc"
CPPUTEST_LDFLAGS="${CPPUTEST_LDFLAGS} -nostdlib"
AC_DEFINE([STD_C_LIB_DISABLED], [1], [Standard C library disabled])
CPP_PLATFORM="GccNoStdC"
else
CPP_PLATFORM="Gcc"
fi
# Using standard C++
if test "x${use_std_cpp}" = xno; then
AC_DEFINE([STD_CPP_LIB_DISABLED], 1, [Standard C++ library disabled])
if test "x${use_std_c}" = xyes; then
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} -nostdinc++ ${CPPUTEST_CXX_NO_INC_WARNINGFLAGS}"
# Since automake passes the CXXFLAGS to the linker, this will cause warnings with clang 3.2 (which become errors)
CPPUTEST_LDFLAGS="${CPPUTEST_LDFLAGS} ${CPPUTEST_NO_UNUSED_ARGUMENT_WARNING}"
fi
fi
cpp_standard_used="default"
# Using the C++98 standard?
if test "x${use_std_cpp98}" = xyes; then
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP98FLAG}"
cpp_standard_used="C++98"
fi
# Using the C++11 standard?
if test "x${use_std_cpp11}" = xyes; then
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP11FLAG}"
cpp_standard_used="C++11"
fi
# Using the C++14 standard?
if test "x${use_std_cpp14}" = xyes; then
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP14FLAG}"
cpp_standard_used="C++14"
fi
# Using the C++17 standard?
if test "x${use_std_cpp17}" = xyes; then
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP17FLAG}"
cpp_standard_used="C++17"
fi
# Using the C++20 standard?
if test "x${use_std_cpp20}" = xyes; then
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP20FLAG}"
cpp_standard_used="C++20"
fi
# Dealing with memory leak detection
if test "x${memory_leak_detection}" = xno; then
AC_DEFINE([MEM_LEAK_DETECTION_DISABLED], 1, [memory leak detection disabled])
else
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} -include ${srcdir}/include/CppUTest/MemoryLeakDetectorNewMacros.h"
CPPUTEST_CPPFLAGS="${CPPUTEST_CPPFLAGS} -include ${srcdir}/include/CppUTest/MemoryLeakDetectorMallocMacros.h"
fi
# Disabling long long support
if test "x${use_longlong}" = xno; then
AC_DEFINE([LONG_LONG_DISABLED], 1, [disable long long])
fi
# Dealing with address sanitizer
if test "x${sanitize_address}" = xyes; then
CPPUTEST_CFLAGS="${CPPUTEST_CFLAGS} -fsanitize=address -fno-omit-frame-pointer"
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} -fsanitize=address -fno-omit-frame-pointer"
CPPUTEST_LDFLAGS="${CPPUTEST_CXXFLAGS} -fsanitize=address -fno-omit-frame-pointer"
fi
# Generating map files.
if test "x${generate_map_file}" = xyes; then
CPPUTEST_LDFLAGS="${CPPUTEST_LDFLAGS} ${CPPUTEST_LD_MAP_GENERATION}"
MOSTLYCLEANFILES="${MOSTLYCLEANFILES} *.map.txt"
fi
if test "x${coverage_flag_supported}" = xyes; then
if test "x${coverage}" = xyes; then
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} --coverage"
CPPUTEST_CFLAGS="${CPPUTEST_CFLAGS} --coverage"
MOSTLYCLEANFILES="${MOSTLYCLEANFILES} *.gcda *.gcno"
fi
fi
# GMock, check whether we can compile the GMock tests.
AC_ARG_VAR([GMOCK_HOME], Directory where gmock is installed so the gmock tests can run)
AC_MSG_CHECKING([for the availability of gmock via the GMOCK_HOME variable])
AM_CONDITIONAL([INCLUDE_GMOCKTESTS], [test -n "${GMOCK_HOME}"])
if test -n "${GMOCK_HOME}"; then
AC_DEFINE([INCLUDE_GTEST_TESTS], 1, [Include the GTest-related tests in the build])
AC_ARG_VAR([GMOCK_HOME], [Location of the GMock])
if test -z "${GTEST_HOME}"; then
GTEST_HOME=${GMOCK_HOME}/gtest
fi
CPPUTEST_CPPFLAGS="${CPPUTEST_CPPFLAGS} -I${GMOCK_HOME}/include -I${GTEST_HOME}/include -I${GTEST_HOME}"
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1 -DGMOCK_RENAME_MAIN=1"
if test -e ${GMOCK_HOME}/lib/libgmock.la && test -e ${GTEST_HOME}/lib/libgtest.la; then \
CPPUTEST_LDADD="${CPPUTEST_LDADD} ${GMOCK_HOME}/lib/libgmock.la ${GTEST_HOME}/lib/libgtest.la"; \
elif test -e ${GMOCK_HOME}/libgmock.a && test -e ${GTEST_HOME}/libgtest.a; then \
CPPUTEST_LDADD="${CPPUTEST_LDADD} ${GMOCK_HOME}/libgmock.a ${GTEST_HOME}/libgtest.a"; \
elif test -e ${GMOCK_HOME}/libgmock.a && test -e ${GMOCK_HOME}/gtest/libgtest.a; then \
CPPUTEST_LDADD="${CPPUTEST_LDADD} ${GMOCK_HOME}/libgmock.a ${GMOCK_HOME}/gtest/libgtest.a"; \
else \
AC_MSG_ERROR([
-------------------------------------
GMOCK_HOME was set, but couldn't find the compiled library.
Did you compile it?
-------------------------------------]);
fi
# In Travis, do not show warnings. The GTest warnings cause a log overflow that errors the build. Nice :)
if test -n "${TRAVIS_BRANCH}"; then
CPPUTEST_CWARNINGFLAGS=""
CPPUTEST_CXXWARNINGFLAGS=""
fi
else
# When we don't compile with GMock, we can be a bit stricter on warnings.
CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} ${CPPUTEST_CWARNINGFLAGS_STRICT}"
CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} ${CPPUTEST_CXXWARNINGFLAGS_STRICT}"
fi
CPPUTEST_CFLAGS="${CPPUTEST_CFLAGS} ${CPPUTEST_CWARNINGFLAGS}"
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CXXWARNINGFLAGS}"
CPPUTEST_CPPFLAGS="${CPPUTEST_CPPFLAGS} -I ${srcdir}/include ${CPPUTEST_CPPWARNINGFLAGS}"
if test "x${cpputest_flags}" = xno; then
CPPUTEST_CFLAGS=""
CPPUTEST_CXXFLAGS=""
CPPUTEST_CPPFLAGS=""
fi
############################## Values ########################################
### All files in git
if test -e "${srcdir}/.git"; then
ALL_FILES_IN_GIT="`git --git-dir=${srcdir}/.git ls-files | tr '[ \n]' ' '`"
fi
# Variables to substitute
AC_SUBST([CPP_PLATFORM])
AC_SUBST([INCLUDE_CPPUTEST_EXT])
# Replacement of tool flags
AC_SUBST([CPPUTEST_CFLAGS])
AC_SUBST([CPPUTEST_ADDITIONAL_CFLAGS])
AC_SUBST([CPPUTEST_CXXFLAGS])
AC_SUBST([CPPUTEST_ADDITIONAL_CXXFLAGS])
AC_SUBST([CPPUTEST_CPPFLAGS])
AC_SUBST([CPPUTEST_ADDITIONAL_CPPFLAGS])
AC_SUBST([CPPUTEST_LDADD])
AC_SUBST([CPPUTEST_LDFLAGS])
AC_SUBST([MOSTLYCLEANFILES])
AC_SUBST([CPPUTEST_HAS_GCC])
AC_SUBST([CPPUTEST_HAS_CLANG])
AC_SUBST([ALL_FILES_IN_GIT])
LT_INIT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
echo \
"----------------------------------------------------------------
${PACKAGE_NAME} Version ${PACKAGE_VERSION}
Current compiler options:
CC: ${CC}
CXX: ${CXX}
CC version: ${ax_cv_c_compiler_version}
CXX version: ${ax_cv_cxx_compiler_version}
LD: ${LD}
Default CFLAGS: ${CFLAGS}
Default CXXFLAGS: ${CXXFLAGS}
CppUTest CFLAGS: ${CPPUTEST_CFLAGS}
CppUTest CXXFLAGS: ${CPPUTEST_CXXFLAGS}
CppUTest CPPFLAGS: ${CPPUTEST_CPPFLAGS}
CppUTest LDFLAGS: ${CPPUTEST_LDFLAGS}
CppUTest LIB: ${LIBS}
Features configured in ${PACKAGE_NAME}:
C++ standard used: ${cpp_standard_used}
Memory Leak Detection: ${memory_leak_detection}
Compiling extensions: ${cpputest_ext}
Use Long Long (if available): ${use_longlong}
Disable CppUTest compile/link flags: ${cpputest_flags}
Address sanitizer: ${sanitize_address}
Using Standard C++ Library: ${use_std_cpp}
Using Standard C Library: ${use_std_c}
Generating map file: ${generate_map_file}
Compiling w coverage info: ${coverage}
----------------------------------------------------------------"

View file

@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: CppUtest
URL: https://github.com/cpputest/cpputest
Description: Easy to use unit test framework for C/C++
Version: @PACKAGE_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lstdc++ -lCppUTest -lCppUTestExt

View file

@ -1,2 +0,0 @@
*
!.gitignore

File diff suppressed because it is too large Load diff

View file

@ -1,7 +0,0 @@
FROM ubuntu
RUN apt-get -qq update && apt-get -qq install -y --no-install-recommends dosbox make openssl ca-certificates git
WORKDIR /cpputest_build
CMD BUILD=make_dos /cpputest/scripts/travis_ci_build.sh

View file

@ -1,8 +0,0 @@
FROM ubuntu
RUN apt-get update && \
apt-get install -y -q --no-install-recommends file git gcc g++ make automake autoconf libtool
WORKDIR /cpputest_build
CMD autoreconf -i ../cpputest && ../cpputest/configure && make tdd

View file

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse-cdt version="2.0"?>
<cdtproject id="org.eclipse.cdt.make.core.make">
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<data>
<item id="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
</item>
<item id="org.eclipse.cdt.core.pathentry">
<pathentry kind="src" path=""/>
<pathentry kind="out" path=""/>
<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/>
</item>
</data>
</cdtproject>

View file

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="converted.config.1470469097">
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.pathentry">
<pathentry kind="src" path=""/>
<pathentry kind="out" path=""/>
<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/>
</storageModule>
<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="converted.config.1470469097" moduleId="org.eclipse.cdt.core.settings" name="convertedConfig">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
</cconfiguration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>

View file

@ -1,85 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CppUTestExample</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.make.core.makeBuilder</name>
<arguments>
<dictionary>
<key>org.eclipse.cdt.make.core.build.arguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.core.errorOutputParser</key>
<value>org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.environment</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.inc</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.location</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.command</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.clean</key>
<value>clean depend</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.auto</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>false</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.make.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.make.core.makeNature</nature>
<nature>org.eclipse.cdt.make.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
</natures>
</projectDescription>

View file

@ -1,3 +0,0 @@
#Thu Apr 19 15:52:43 CDT 2007
eclipse.preferences.version=1
indexerId=org.eclipse.cdt.core.fastIndexer

View file

@ -1,60 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTestExt/IEEE754ExceptionsPlugin.h"
#include "CppUTestExt/MockSupportPlugin.h"
class MyDummyComparator : public MockNamedValueComparator
{
public:
virtual bool isEqual(const void* object1, const void* object2)
{
return object1 == object2;
}
virtual SimpleString valueToString(const void* object)
{
return StringFrom(object);
}
};
int main(int ac, char** av)
{
MyDummyComparator dummyComparator;
MockSupportPlugin mockPlugin;
IEEE754ExceptionsPlugin ieee754Plugin;
mockPlugin.installComparator("MyDummyType", dummyComparator);
TestRegistry::getCurrentRegistry()->installPlugin(&mockPlugin);
TestRegistry::getCurrentRegistry()->installPlugin(&ieee754Plugin);
return CommandLineTestRunner::RunAllTests(ac, av);
}
#include "AllTests.h"

View file

@ -1,32 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
IMPORT_TEST_GROUP( Printer);
IMPORT_TEST_GROUP( CircularBuffer);
IMPORT_TEST_GROUP( HelloWorld);
IMPORT_TEST_GROUP( EventDispatcher);
IMPORT_TEST_GROUP( MockDocumentation);

View file

@ -1,252 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="AllTests"
ProjectGUID="{95A5F8D0-12C0-4AC1-B46B-292DD3886108}"
TargetFrameworkVersion="0"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="./$(ConfigurationName)/"
IntermediateDirectory="./$(ConfigurationName)/"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
BuildLogFile="$(IntDir)/BuildLog.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/AllTests.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="../../include,../../include/Platforms/VisualCpp,../ApplicationLib"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
PrecompiledHeaderFile="./$(ConfigurationName)/AllTests.pch"
AssemblerListingLocation="./$(ConfigurationName)/"
ObjectFile="./$(ConfigurationName)/"
ProgramDataBaseFileName="./$(ConfigurationName)/"
XMLDocumentationFileName="./$(ConfigurationName)/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/NODEFAULTLIB:LIBCMT"
AdditionalDependencies="../../lib/CppUTest.lib ../ApplicationLib/$(ConfigurationName)/ApplicationLib.lib odbc32.lib odbccp32.lib winmm.lib"
OutputFile="./$(ConfigurationName)/AllTests.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
ManifestFile="./$(ConfigurationName)/$(TargetFileName).intermediate.manifest"
IgnoreAllDefaultLibraries="false"
GenerateDebugInformation="false"
ProgramDatabaseFile=""
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\$(ConfigurationName)/AllTests.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="&quot;$(TargetPath)&quot;"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/AllTests.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include,../../include/Platforms/VisualCpp,../ApplicationLib"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile="./$(ConfigurationName)/AllTests.pch"
AssemblerListingLocation="./$(ConfigurationName)/"
ObjectFile="./$(ConfigurationName)/"
ProgramDataBaseFileName="./$(ConfigurationName)/"
XMLDocumentationFileName="$(ConfigurationName)/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../../lib/CppUTest.lib ../ApplicationLib/$(ConfigurationName)/ApplicationLib.lib odbc32.lib odbccp32.lib winmm.lib"
OutputFile="./$(ConfigurationName)/AllTests.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
ManifestFile="./$(ConfigurationName)/$(TargetFileName).intermediate.manifest"
GenerateDebugInformation="true"
ProgramDatabaseFile="./$(ConfigurationName)/AllTests.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/AllTests.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="&quot;$(TargetPath)&quot;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\AllTests.cpp"
>
</File>
<File
RelativePath=".\CircularBufferTest.cpp"
>
</File>
<File
RelativePath=".\EventDispatcherTest.cpp"
>
</File>
<File
RelativePath=".\HelloTest.cpp"
>
</File>
<File
RelativePath=".\MockDocumentationTest.cpp"
>
</File>
<File
RelativePath=".\PrinterTest.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,168 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{95A5F8D0-12C0-4AC1-B46B-292DD3886108}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<BuildLog>
<Path>$(IntDir)BuildLog.htm</Path>
</BuildLog>
<Midl>
<TypeLibraryName>.\Debug/AllTests.tlb</TypeLibraryName>
<HeaderFileName>
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>../../include;../ApplicationLib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeaderOutputFile>./$(Configuration)/AllTests.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>./$(Configuration)/</AssemblerListingLocation>
<ObjectFileName>./$(Configuration)/</ObjectFileName>
<ProgramDataBaseFileName>./$(Configuration)/</ProgramDataBaseFileName>
<XMLDocumentationFileName>./$(Configuration)/</XMLDocumentationFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalOptions>/NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>../../lib/CppUTest.lib;../ApplicationLib/$(Configuration)/ApplicationLib.lib;odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>./$(Configuration)/AllTests.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<ManifestFile>./$(Configuration)/$(TargetFileName).intermediate.manifest</ManifestFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>
</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\$(Configuration)/AllTests.bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"$(TargetPath)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<TypeLibraryName>.\Debug/AllTests.tlb</TypeLibraryName>
<HeaderFileName>
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include;../ApplicationLib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeaderOutputFile>./$(Configuration)/AllTests.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>./$(Configuration)/</AssemblerListingLocation>
<ObjectFileName>./$(Configuration)/</ObjectFileName>
<ProgramDataBaseFileName>./$(Configuration)/</ProgramDataBaseFileName>
<XMLDocumentationFileName>$(Configuration)/</XMLDocumentationFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>../../lib/CppUTestd.lib;../ApplicationLib/$(Configuration)/ApplicationLib.lib;odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>./$(Configuration)/AllTests.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<ManifestFile>./$(Configuration)/$(TargetFileName).intermediate.manifest</ManifestFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>./$(Configuration)/AllTests.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug/AllTests.bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"$(TargetPath)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="AllTests.cpp" />
<ClCompile Include="CircularBufferTest.cpp" />
<ClCompile Include="EventDispatcherTest.cpp" />
<ClCompile Include="HelloTest.cpp" />
<ClCompile Include="MockDocumentationTest.cpp" />
<ClCompile Include="PrinterTest.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ApplicationLib\ApplicationLib.vcxproj">
<Project>{348076b9-303c-4fe0-9380-17cdf11134a9}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClInclude Include="AllTests.h" />
<ClInclude Include="MockPrinter.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,15 +0,0 @@
include_directories(../ApplicationLib)
add_executable(ExampleTests
AllTests.cpp
CircularBufferTest.cpp
EventDispatcherTest.cpp
FEDemoTest.cpp
HelloTest.cpp
MockDocumentationTest.cpp
PrinterTest.cpp
)
cpputest_normalize_test_output_location(ExampleTests)
target_link_libraries(ExampleTests ApplicationLib CppUTest CppUTestExt)
cpputest_buildtime_discover_tests(ExampleTests)

View file

@ -1,260 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "CppUTest/TestHarness.h"
#include "MockPrinter.h"
#include "CircularBuffer.h"
TEST_GROUP(CircularBuffer)
{ CircularBuffer* buffer;
void setup()
{
buffer = new CircularBuffer();
}
void teardown()
{
delete buffer;
}
void fillTheQueue(int seed, int howMany)
{
for (int i = 0; i < howMany; i++)
buffer->Put(seed + i);
}
void removeFromQueue(int howMany)
{
for (int i = 0; i < howMany; i++)
buffer->Get();
}
};
TEST(CircularBuffer, EmptyAfterCreation)
{
CHECK(buffer->IsEmpty());
}
TEST(CircularBuffer, NotEmpty)
{
buffer->Put(10046);
CHECK(!buffer->IsEmpty());
}
TEST(CircularBuffer, NotEmptyThenEmpty)
{
buffer->Put(4567);
CHECK(!buffer->IsEmpty());
buffer->Get();
CHECK(buffer->IsEmpty());
}
TEST(CircularBuffer, GetPutOneValue)
{
buffer->Put(4567);
LONGS_EQUAL(4567, buffer->Get());
}
TEST(CircularBuffer, GetPutAFew)
{
buffer->Put(1);
buffer->Put(2);
buffer->Put(3);
LONGS_EQUAL(1, buffer->Get());
LONGS_EQUAL(2, buffer->Get());
LONGS_EQUAL(3, buffer->Get());
}
TEST(CircularBuffer, Capacity)
{
CircularBuffer b(2);
LONGS_EQUAL(2, b.Capacity());
}
TEST(CircularBuffer, IsFull)
{
fillTheQueue(0, buffer->Capacity());
CHECK(buffer->IsFull());
}
TEST(CircularBuffer, EmptyToFullToEmpty)
{
fillTheQueue(100, buffer->Capacity());
CHECK(buffer->IsFull());
removeFromQueue(buffer->Capacity());
CHECK(buffer->IsEmpty());
}
TEST(CircularBuffer, WrapAround)
{
fillTheQueue(100, buffer->Capacity());
CHECK(buffer->IsFull());
LONGS_EQUAL(100, buffer->Get());
CHECK(!buffer->IsFull());
buffer->Put(1000);
CHECK(buffer->IsFull());
removeFromQueue(buffer->Capacity() - 1);
LONGS_EQUAL(1000, buffer->Get());
CHECK(buffer->IsEmpty());
}
TEST(CircularBuffer, PutToFull)
{
int capacity = buffer->Capacity();
fillTheQueue(900, capacity);
buffer->Put(9999);
for (int i = 0; i < buffer->Capacity() - 1; i++)
LONGS_EQUAL(i+900+1, buffer->Get());
LONGS_EQUAL(9999, buffer->Get());
CHECK(buffer->IsEmpty());
}
//Sometime people ask what tests the tests.
//Do you know the answer
TEST(CircularBuffer, GetFromEmpty)
{
LONGS_EQUAL(-1, buffer->Get());
CHECK(buffer->IsEmpty());
}
/*
* the next tests demonstrate using a mock object for
* capturing output
*
*/
TEST(CircularBuffer, PrintEmpty)
{
MockPrinter mock;
Printer* p = &mock;
buffer->Print(p);
STRCMP_EQUAL("Circular buffer content:\n<>\n",
mock.getOutput().c_str());
}
TEST(CircularBuffer, PrintAfterOnePut)
{
MockPrinter mock;
buffer->Put(1);
buffer->Print(&mock);
STRCMP_EQUAL("Circular buffer content:\n<1>\n",
mock.getOutput().c_str());
}
TEST(CircularBuffer, PrintNotYetWrappedOrFull)
{
MockPrinter mock;
buffer->Put(1);
buffer->Put(2);
buffer->Put(3);
buffer->Print(&mock);
STRCMP_EQUAL("Circular buffer content:\n<1, 2, 3>\n",
mock.getOutput().c_str());
}
TEST(CircularBuffer, PrintNotYetWrappedAndIsFull)
{
MockPrinter mock;
fillTheQueue(200, buffer->Capacity());
buffer->Print(&mock);
const char* expected = "Circular buffer content:\n"
"<200, 201, 202, 203, 204>\n";
STRCMP_EQUAL(expected, mock.getOutput().c_str());
}
TEST(CircularBuffer, PrintWrappedAndIsFullOldestToNewest)
{
MockPrinter mock;
fillTheQueue(200, buffer->Capacity());
buffer->Get();
buffer->Put(999);
buffer->Print(&mock);
const char* expected = "Circular buffer content:\n"
"<201, 202, 203, 204, 999>\n";
STRCMP_EQUAL(expected, mock.getOutput().c_str());
}
TEST(CircularBuffer, PrintWrappedAndFullOverwriteOldest)
{
MockPrinter mock;
fillTheQueue(200, buffer->Capacity());
buffer->Put(9999);
buffer->Print(&mock);
const char* expected = "Circular buffer content:\n"
"<201, 202, 203, 204, 9999>\n";
STRCMP_EQUAL(expected, mock.getOutput().c_str());
}
TEST(CircularBuffer, PrintBoundary)
{
MockPrinter mock;
fillTheQueue(200, buffer->Capacity());
removeFromQueue(buffer->Capacity() - 2);
buffer->Put(888);
fillTheQueue(300, buffer->Capacity() - 1);
buffer->Print(&mock);
const char* expected = "Circular buffer content:\n"
"<888, 300, 301, 302, 303>\n";
STRCMP_EQUAL(expected, mock.getOutput().c_str());
}
TEST(CircularBuffer, FillEmptyThenPrint)
{
MockPrinter mock;
fillTheQueue(200, buffer->Capacity());
removeFromQueue(buffer->Capacity());
buffer->Print(&mock);
const char* expected = "Circular buffer content:\n"
"<>\n";
STRCMP_EQUAL(expected, mock.getOutput().c_str());
}

View file

@ -1,111 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "CppUTest/TestHarness.h"
#include "CppUTestExt/MockSupport.h"
#include "EventDispatcher.h"
class ObserverMock : public EventObserver
{
public:
virtual void notify(const Event& event, int timeOutInSeconds)
{
mock().actualCall("notify").onObject(this).withParameterOfType("Event", "event", (void*) &event).withParameter("timeOutInSeconds", timeOutInSeconds);
}
virtual void notifyRegistration(EventObserver* newObserver)
{
mock().actualCall("notifyRegistration").onObject(this).withParameter("newObserver", newObserver);
}
};
class EventComparator : public MockNamedValueComparator
{
public:
virtual bool isEqual(const void* object1, const void* object2)
{
return ((const Event*)object1)->type == ((const Event*)object2)->type;
}
virtual SimpleString valueToString(const void* object)
{
return StringFrom(((const Event*)object)->type);
}
};
TEST_GROUP(EventDispatcher)
{
Event event;
EventDispatcher* dispatcher;
ObserverMock observer;
ObserverMock observer2;
EventComparator eventComparator;
void setup()
{
dispatcher = new EventDispatcher;
mock().installComparator("Event", eventComparator);
}
void teardown()
{
delete dispatcher;
mock().removeAllComparatorsAndCopiers();
}
};
TEST(EventDispatcher, EventWithoutRegistrationsResultsIntoNoCalls)
{
dispatcher->dispatchEvent(event, 10);
}
TEST(EventDispatcher, EventWithRegistrationForEventResultsIntoCallback)
{
mock().expectOneCall("notify").onObject(&observer).withParameterOfType("Event", "event", &event).withParameter("timeOutInSeconds", 10);
event.type = IMPORTANT_EVENT;
dispatcher->registerObserver(IMPORTANT_EVENT, &observer);
dispatcher->dispatchEvent(event, 10);
}
TEST(EventDispatcher, DifferentEventWithRegistrationDoesNotResultIntoCallback)
{
event.type = LESS_IMPORTANT_EVENT;
dispatcher->registerObserver(IMPORTANT_EVENT, &observer);
dispatcher->dispatchEvent(event, 10);
}
TEST(EventDispatcher, RegisterTwoObserversResultIntoTwoCallsAndARegistrationNotification)
{
mock().expectOneCall("notify").onObject(&observer).withParameterOfType("Event", "event", &event).withParameter("timeOutInSeconds", 10);
mock().expectOneCall("notify").onObject(&observer2).withParameterOfType("Event", "event", &event).withParameter("timeOutInSeconds", 10);
mock().expectOneCall("notifyRegistration").onObject(&observer).withParameter("newObserver", &observer2);
event.type = IMPORTANT_EVENT;
dispatcher->registerObserver(IMPORTANT_EVENT, &observer);
dispatcher->registerObserver(IMPORTANT_EVENT, &observer2);
dispatcher->dispatchEvent(event, 10);
}

View file

@ -1,89 +0,0 @@
/*
* Copyright (c) 2016, Michael Feathers, James Grenning, Bas Vodde
* and Arnd Strube. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTest/TestHarness.h"
#include "CppUTest/TestRegistry.h"
#ifdef CPPUTEST_HAVE_FENV
#include "CppUTestExt/IEEE754ExceptionsPlugin.h"
/*
* To see a demonstration of tests failing as a result of IEEE754ExceptionsPlugin
* picking up floating point errors, run the test executable with the -ri option.
*
*/
extern "C" {
#include <fenv.h>
}
#include <limits>
static volatile float f;
TEST_GROUP(FE_Demo)
{
void setup()
{
IEEE754ExceptionsPlugin::disableInexact();
}
};
IGNORE_TEST(FE_Demo, should_fail_when__FE_DIVBYZERO__is_set)
{
f = 1.0f;
CHECK((f /= 0.0f) >= std::numeric_limits<float>::infinity());
}
IGNORE_TEST(FE_Demo, should_fail_when__FE_UNDERFLOW__is_set)
{
f = 0.01f;
while (f > 0.0f) f *= f;
CHECK(f == 0.0f);
}
IGNORE_TEST(FE_Demo, should_fail_when__FE_OVERFLOW__is_set)
{
f = 1000.0f;
while (f < std::numeric_limits<float>::infinity()) f *= f;
CHECK(f >= std::numeric_limits<float>::infinity());
}
IGNORE_TEST(FE_Demo, should_fail_when__FE_INEXACT____is_set)
{
IEEE754ExceptionsPlugin::enableInexact();
f = 10.0f;
DOUBLES_EQUAL((double) (f / 3.0f), (double) 3.333f, (double) 0.001f);
}
TEST(FE_Demo, should_succeed_when_no_flags_are_set)
{
CHECK(5.0f == 15.0f / 3.0f);
}
#endif

View file

@ -1,60 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "hello.h"
#include <stdio.h>
#include <stdarg.h>
#include "CppUTest/TestHarness.h"
static SimpleString* buffer;
TEST_GROUP(HelloWorld)
{ static int output_method(const char* output, ...)
{
va_list arguments;
va_start(arguments, output);
*buffer = VStringFromFormat(output, arguments);
va_end(arguments);
return 1;
}
void setup()
{
buffer = new SimpleString();
UT_PTR_SET(PrintFormated, &output_method);
}
void teardown()
{
delete buffer;
}
};
TEST(HelloWorld, PrintOk)
{
printHelloWorld();
STRCMP_EQUAL("Hello World!\n", buffer->asCharString());
}

View file

@ -1,240 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "CppUTest/TestHarness.h"
#include "CppUTestExt/MockSupport.h"
#include "CppUTestExt/MockSupport_c.h"
TEST_GROUP(FirstTestGroup)
{
};
TEST(FirstTestGroup, FirsTest)
{
// FAIL("Fail me!");
}
TEST(FirstTestGroup, SecondTest)
{
// STRCMP_EQUAL("hello", "world");
}
TEST_GROUP(MockDocumentation)
{
};
static void productionCode()
{
mock().actualCall("productionCode");
}
TEST(MockDocumentation, SimpleScenario)
{
mock().expectOneCall("productionCode");
productionCode();
mock().checkExpectations();
}
class ClassFromProductionCode
{
public:
virtual void importantFunction(){}
virtual ~ClassFromProductionCode() {}
};
class ClassFromProductionCodeMock : public ClassFromProductionCode
{
public:
virtual void importantFunction()
{
mock().actualCall("importantFunction").onObject(this);
}
};
TEST(MockDocumentation, SimpleScenarioObject)
{
ClassFromProductionCode* object = new ClassFromProductionCodeMock; /* create mock instead of real thing */
mock().expectOneCall("importantFunction").onObject(object);
object->importantFunction();
mock().checkExpectations();
delete object;
}
static void parameters_function(int p1, const char* p2)
{
void* object = (void*) 1;
mock().actualCall("function").onObject(object).withParameter("p1", p1).withParameter("p2", p2);
}
TEST(MockDocumentation, parameters)
{
void* object = (void*) 1;
mock().expectOneCall("function").onObject(object).withParameter("p1", 2).withParameter("p2", "hah");
parameters_function(2, "hah");
}
class MyTypeComparator : public MockNamedValueComparator
{
public:
virtual bool isEqual(const void* object1, const void* object2)
{
return object1 == object2;
}
virtual SimpleString valueToString(const void* object)
{
return StringFrom(object);
}
};
TEST(MockDocumentation, ObjectParameters)
{
void* object = (void*) 1;
MyTypeComparator comparator;
mock().installComparator("myType", comparator);
mock().expectOneCall("function").withParameterOfType("myType", "parameterName", object);
mock().clear();
mock().removeAllComparatorsAndCopiers();
}
TEST(MockDocumentation, returnValue)
{
mock().expectOneCall("function").andReturnValue(10);
int value = mock().actualCall("function").returnValue().getIntValue();
value = mock().returnValue().getIntValue();
LONGS_EQUAL(10, value);
}
TEST(MockDocumentation, setData)
{
ClassFromProductionCode object;
mock().setData("importantValue", 10);
mock().setDataObject("importantObject", "ClassFromProductionCode", &object);
ClassFromProductionCode * pobject;
int value = mock().getData("importantValue").getIntValue();
pobject = (ClassFromProductionCode*) mock().getData("importantObject").getObjectPointer();
LONGS_EQUAL(10, value);
POINTERS_EQUAL(pobject, &object);
}
static void doSomethingThatWouldOtherwiseBlowUpTheMockingFramework()
{
}
TEST(MockDocumentation, otherMockSupport)
{
mock().crashOnFailure();
// mock().actualCall("unex");
mock().expectOneCall("foo");
mock().ignoreOtherCalls();
mock().disable();
doSomethingThatWouldOtherwiseBlowUpTheMockingFramework();
mock().enable();
mock().clear();
}
TEST(MockDocumentation, scope)
{
mock("xmlparser").expectOneCall("open");
mock("filesystem").ignoreOtherCalls();
mock("xmlparser").actualCall("open");
}
static int equalMethod(const void* object1, const void* object2)
{
return object1 == object2;
}
static const char* toStringMethod(const void*)
{
return "string";
}
TEST(MockDocumentation, CInterface)
{
void* object = (void*) 0x1;
mock_c()->expectOneCall("foo")->withIntParameters("integer", 10)->andReturnDoubleValue(1.11);
double d = mock_c()->actualCall("foo")->withIntParameters("integer", 10)->returnValue().value.doubleValue;
DOUBLES_EQUAL(1.11, d, 0.00001);
mock_c()->installComparator("type", equalMethod, toStringMethod);
mock_scope_c("scope")->expectOneCall("bar")->withParameterOfType("type", "name", object);
mock_scope_c("scope")->actualCall("bar")->withParameterOfType("type", "name", object);
mock_c()->removeAllComparatorsAndCopiers();
mock_c()->setIntData("important", 10);
mock_c()->checkExpectations();
mock_c()->clear();
}
TEST_GROUP(FooTestGroup)
{
void setup()
{
// Init stuff
}
void teardown()
{
// Uninit stuff
}
};
TEST(FooTestGroup, Foo)
{
// Test FOO
}
TEST(FooTestGroup, MoreFoo)
{
// Test more FOO
}
TEST_GROUP(BarTestGroup)
{
void setup()
{
// Init Bar
}
};
TEST(BarTestGroup, Bar)
{
// Test Bar
}

View file

@ -1,79 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef D_MockPrinter_H
#define D_MockPrinter_H
///////////////////////////////////////////////////////////////////////////////
//
// MockPrinter.h
//
// MockPrinter is responsible for providing a test stub for Printer
//
///////////////////////////////////////////////////////////////////////////////
#include "Printer.h"
#include "CppUTest/SimpleString.h"
#include <stdlib.h>
#include <string>
class MockPrinter: public Printer
{
public:
explicit MockPrinter()
{
}
virtual ~MockPrinter()
{
}
virtual void Print(const char* s)
{
savedOutput.append(s);
}
virtual void Print(long int value)
{
SimpleString buffer;
buffer = StringFromFormat("%ld", value);
savedOutput.append(buffer.asCharString());
}
std::string getOutput() const
{
return savedOutput;
}
private:
std::string savedOutput;
MockPrinter(const MockPrinter&);
MockPrinter& operator=(const MockPrinter&);
};
#endif // D_MockPrinter_H

View file

@ -1,68 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "CppUTest/TestHarness.h"
#include "Printer.h"
#include "MockPrinter.h"
TEST_GROUP(Printer)
{ Printer* printer;
MockPrinter* mockPrinter;
void setup()
{
mockPrinter = new MockPrinter();
printer = mockPrinter;
}
void teardown()
{
delete printer;
}
};
TEST(Printer, PrintConstCharStar)
{
printer->Print("hello");
printer->Print("hello\n");
const char* expected = "hellohello\n";
CHECK_EQUAL(expected, mockPrinter->getOutput());
}
TEST(Printer, PrintLong)
{
printer->Print(1234);
const char* expected = "1234";
CHECK_EQUAL(expected, mockPrinter->getOutput());
}
TEST(Printer, StreamOperators)
{
*printer << "n=" << 1234;
const char* expected = "n=1234";
CHECK_EQUAL(expected, mockPrinter->getOutput());
}

View file

@ -1,4 +0,0 @@
#!/bin/bash
#put any pre-test execution commands here.
echo Running all tests
./AllTests $1

View file

@ -1,276 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="ApplicationLib"
ProjectGUID="{348076B9-303C-4FE0-9380-17CDF11134A9}"
TargetFrameworkVersion="0"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include,../../include/Platforms/VisualCpp"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/ApplicationLib.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Debug\ApplicationLib.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="./$(ConfigurationName)/ApplicationLib.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="../../include,../../include/Platforms/VisualCpp"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
PrecompiledHeaderFile="./$(ConfigurationName)/ApplicationLib.pch"
AssemblerListingLocation="./$(ConfigurationName)/"
ObjectFile="./$(ConfigurationName)/"
ProgramDataBaseFileName="./$(ConfigurationName)/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="./$(ConfigurationName)/ApplicationLib.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="./$(ConfigurationName)/ApplicationLib.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="CircularBuffer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath=".\EventDispatcher.cpp"
>
</File>
<File
RelativePath="hello.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="Printer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="AllTests.h"
>
</File>
<File
RelativePath="CircularBuffer.h"
>
</File>
<File
RelativePath=".\EventDispatcher.h"
>
</File>
<File
RelativePath="hello.h"
>
</File>
<File
RelativePath="MockPrinter.h"
>
</File>
<File
RelativePath="Printer.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,133 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{348076B9-303C-4FE0-9380-17CDF11134A9}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeaderOutputFile>.\Debug/ApplicationLib.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
<ObjectFileName>.\Debug/</ObjectFileName>
<ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<OutputFile>.\Debug\ApplicationLib.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>./$(Configuration)/ApplicationLib.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeaderOutputFile>./$(Configuration)/ApplicationLib.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>./$(Configuration)/</AssemblerListingLocation>
<ObjectFileName>./$(Configuration)/</ObjectFileName>
<ProgramDataBaseFileName>./$(Configuration)/</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<OutputFile>./$(Configuration)/ApplicationLib.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>./$(Configuration)/ApplicationLib.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="CircularBuffer.cpp">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="EventDispatcher.cpp" />
<ClCompile Include="hello.c">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="Printer.cpp">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="CircularBuffer.h" />
<ClInclude Include="EventDispatcher.h" />
<ClInclude Include="hello.h" />
<ClInclude Include="Printer.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,6 +0,0 @@
add_library(ApplicationLib
CircularBuffer.cpp
EventDispatcher.cpp
hello.c
Printer.cpp
)

View file

@ -1,101 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "CircularBuffer.h"
#include "Printer.h"
#include <stddef.h>
CircularBuffer::CircularBuffer(int _capacity) :
index(0), outdex(0), capacity(_capacity), empty(true), full(false)
{
buffer = new int[(size_t) this->capacity];
}
CircularBuffer::~CircularBuffer()
{
delete[] buffer;
}
bool CircularBuffer::IsEmpty()
{
return empty;
}
bool CircularBuffer::IsFull()
{
return full;
}
void CircularBuffer::Put(int i)
{
empty = false;
buffer[index] = i;
index = Next(index);
if (full) outdex = Next(outdex);
else if (index == outdex) full = true;
}
int CircularBuffer::Get()
{
int result = -1;
full = false;
if (!empty) {
result = buffer[outdex];
outdex = Next(outdex);
if (outdex == index) empty = true;
}
return result;
}
int CircularBuffer::Capacity()
{
return capacity;
}
int CircularBuffer::Next(int i)
{
if (++i >= capacity) i = 0;
return i;
}
void CircularBuffer::Print(Printer* p)
{
p->Print("Circular buffer content:\n<");
int printIndex = outdex;
int count = index - outdex;
if (!empty && (index <= outdex)) count = capacity - (outdex - index);
for (int i = 0; i < count; i++) {
p->Print(buffer[printIndex]);
printIndex = Next(printIndex);
if (i + 1 != count) p->Print(", ");
}
p->Print(">\n");
}

View file

@ -1,72 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef D_CircularBuffer_H
#define D_CircularBuffer_H
///////////////////////////////////////////////////////////////////////////////
//
// CircularBuffer.h
//
// CircularBuffer is responsible for ...
//
///////////////////////////////////////////////////////////////////////////////
class Printer;
class CircularBuffer
{
public:
explicit CircularBuffer(int capacity = CAPACITY);
virtual ~CircularBuffer();
void Put(int);
int Get();
bool IsEmpty();
bool IsFull();
int Capacity();
int Next(int i);
void Print(Printer*);
private:
int index;
int outdex;
int* buffer;
int capacity;
enum
{
CAPACITY = 5
};
bool empty;
bool full;
CircularBuffer(const CircularBuffer&);
CircularBuffer& operator=(const CircularBuffer&);
};
#endif // D_CircularBuffer_H

View file

@ -1,50 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "EventDispatcher.h"
using namespace std;
EventDispatcher::EventDispatcher()
{
}
void EventDispatcher::registerObserver(EventType type, EventObserver* observer)
{
for (list<pair<EventType, EventObserver*> >::iterator i = observerList_.begin(); i != observerList_.end(); i++)
i->second->notifyRegistration(observer);
observerList_.push_back(make_pair(type, observer));
}
void EventDispatcher::dispatchEvent(const Event& event, int timeoutSeconds)
{
for (list<pair<EventType, EventObserver*> >::iterator i = observerList_.begin(); i != observerList_.end(); i++)
{
if (i->first == event.type)
i->second->notify(event, timeoutSeconds);
}
}

View file

@ -1,63 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EVENTDISPATCHER__H
#define EVENTDISPATCHER__H
#include <list>
enum EventType
{
IMPORTANT_EVENT,
LESS_IMPORTANT_EVENT
};
class Event
{
public:
EventType type;
};
class EventObserver
{
public:
virtual void notify(const Event& event, int timeOutInSeconds)=0;
virtual void notifyRegistration(EventObserver* newObserver)=0;
virtual ~EventObserver() {}
};
class EventDispatcher
{
std::list<std::pair<EventType, EventObserver*> > observerList_;
public:
EventDispatcher();
void registerObserver(EventType type, EventObserver* observer);
void dispatchEvent(const Event& event, int timeoutSeconds);
};
#endif

View file

@ -1,29 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <list>
#include "CppUTest/MemoryLeakDetectorNewMacros.h"

View file

@ -1,60 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "Printer.h"
#include <stdio.h>
Printer::Printer()
{
}
Printer::~Printer()
{
}
void Printer::Print(const char* s)
{
for (const char* p = s; *p; p++)
putchar(*p);
}
void Printer::Print(long int n)
{
printf("%ld", n);
}
Printer& operator<<(Printer& p, const char* s)
{
p.Print(s);
return p;
}
Printer& operator<<(Printer& p, long int i)
{
p.Print(i);
return p;
}

View file

@ -1,56 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef D_Printer_H
#define D_Printer_H
///////////////////////////////////////////////////////////////////////////////
//
// Printer is responsible for ...
//
///////////////////////////////////////////////////////////////////////////////
class Printer
{
public:
explicit Printer();
virtual ~Printer();
virtual void Print(const char*);
virtual void Print(long int);
private:
Printer(const Printer&);
Printer& operator=(const Printer&);
};
Printer& operator<<(Printer&, const char*);
Printer& operator<<(Printer&, long int);
#endif // D_Printer_H

View file

@ -1,36 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include "hello.h"
void printHelloWorld()
{
PrintFormated("Hello World!\n");
}
int (*PrintFormated)(const char*, ...) = printf;

View file

@ -1,43 +0,0 @@
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef HELLO_H_
#define HELLO_H_
#ifdef __cplusplus
extern "C" {
#endif
extern void printHelloWorld(void);
extern int (*PrintFormated)(const char*, ...);
#ifdef __cplusplus
}
#endif
#endif /*HELLO_H_*/

View file

@ -1,2 +0,0 @@
add_subdirectory(AllTests)
add_subdirectory(ApplicationLib)

View file

@ -1,29 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AllTests", "AllTests\AllTests.vcproj", "{95A5F8D0-12C0-4AC1-B46B-292DD3886108}"
ProjectSection(ProjectDependencies) = postProject
{348076B9-303C-4FE0-9380-17CDF11134A9} = {348076B9-303C-4FE0-9380-17CDF11134A9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ApplicationLib", "ApplicationLib\ApplicationLib.vcproj", "{348076B9-303C-4FE0-9380-17CDF11134A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Debug|Win32.ActiveCfg = Debug|Win32
{95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Debug|Win32.Build.0 = Debug|Win32
{95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Release|Win32.ActiveCfg = Release|Win32
{95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Release|Win32.Build.0 = Release|Win32
{348076B9-303C-4FE0-9380-17CDF11134A9}.Debug|Win32.ActiveCfg = Debug|Win32
{348076B9-303C-4FE0-9380-17CDF11134A9}.Debug|Win32.Build.0 = Debug|Win32
{348076B9-303C-4FE0-9380-17CDF11134A9}.Release|Win32.ActiveCfg = Release|Win32
{348076B9-303C-4FE0-9380-17CDF11134A9}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -1,26 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AllTests", "AllTests\AllTests.vcxproj", "{95A5F8D0-12C0-4AC1-B46B-292DD3886108}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ApplicationLib", "ApplicationLib\ApplicationLib.vcxproj", "{348076B9-303C-4FE0-9380-17CDF11134A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Debug|Win32.ActiveCfg = Debug|Win32
{95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Debug|Win32.Build.0 = Debug|Win32
{95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Release|Win32.ActiveCfg = Release|Win32
{95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Release|Win32.Build.0 = Release|Win32
{348076B9-303C-4FE0-9380-17CDF11134A9}.Debug|Win32.ActiveCfg = Debug|Win32
{348076B9-303C-4FE0-9380-17CDF11134A9}.Debug|Win32.Build.0 = Debug|Win32
{348076B9-303C-4FE0-9380-17CDF11134A9}.Release|Win32.ActiveCfg = Release|Win32
{348076B9-303C-4FE0-9380-17CDF11134A9}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Some files were not shown because too many files have changed in this diff Show more