100 questions
0
votes
1
answer
115
views
c cpputest pointer mock segfault
I have a segfault occurring because I have a cpputest mock which returns a pointer to a struct, at the point that the mock is called, and inside the mock itself, the address of the struct is something ...
1
vote
0
answers
193
views
Cross-compiling CppUTest (unit testing harness) on STM32MP1 A7 core
I'm working on a project targeting the STM32MP1 Cortex-A7 processor and I'm trying to integrate the CppUTest framework into my build process. I am using VirtualBox Linux for cross-compiling my code. ...
1
vote
1
answer
135
views
CppUTest realloc conflict with iostream when compiling with clang++
In my CPP file I have added
#include <iostream>
But then I get the following error when I compile it:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:2827:22: ...
1
vote
1
answer
468
views
cpputest/valgrind - memory leak indicator inconsistent
I'm forced to use cpputest and I want to know if its memory leak detector is useful.
As of now, it seems to be garbage.
main.cpp:
#include <iostream>
#include "CppUTest/...
0
votes
1
answer
397
views
Debugging (breakpoints / etc) in VSCode with different makefiles for parts of the codebase
I'm working on an ESP-IDF based project that runs on ESP32 microcontrollers.
The project has a bunch of different C++ libraries (ESP-IDF calls them components) I've written. Normally I compile the ...
0
votes
0
answers
97
views
Unit test for a function in a function using CppUTeset
How a unit test can be made for this kind of structure?
How to change the call so function a() will call function mock_b() instead of function b().
// source.h
int b(int x);
bool a();
// source.cpp
...
0
votes
0
answers
17
views
MSVS cpputest: linker: unresolved symbols when trying to build a minimum running example [duplicate]
I want to build a small example project using cpputest under MSVS2019. For this I build a solution with an empty project (will contain my source files later), the included cpputest-repository and my ...
9
votes
1
answer
11k
views
How to add compile options to a CMake FetchContent-dependency?
I have a C/C++ project in which I want to use CppUTest.
So I include the dependency of CppUTest with:
include(FetchContent)
FetchContent_Declare(
CppUTest
GIT_REPOSITORY https://...
0
votes
0
answers
926
views
CppUTest - no test is running
i'm trying to setup CppUTest project with CMake.
I'm new to CMake so i started with this example: link
It works fine. Project compiles and i see tests ran.
Then i tried to create my own project based ...
1
vote
0
answers
422
views
Valgrind shows memory leaks in cpputest TEST() macro
It seems that running valgrind when using cpputest library causes memory leaks errors.
I use CLion + WSL (GCC + Valgrind). Every line containing TEST() macro is listed in leaks raport.
error: Failure ...
1
vote
0
answers
179
views
Error in failure indication with unit test plugin(C/C++ Unit) used in eclipse
Error in Red bar display and failure indication in test cases, when used C/C++Unit(Cpputest plugin) with eclipse platform for unit testing.
I have downloaded the CppuTest package from the link;"...
1
vote
0
answers
1k
views
Error: register 'sp' unsuitable for global register variables on this target
I am playing around with a project for a STM32 µC. I use the SW4STM32 workbench and CubeMX on a Mac OSX system. My project itself is fine, everything compiles accordingly and behaves on the device as ...
0
votes
1
answer
1k
views
Including cpputest in makefile for project
I want to include cpputest in my project's source tree as a git submodule, but I am not terribly familiar with autotools.
I have been looking at this page as a guide
I've created the following ...
1
vote
0
answers
73
views
setting up unit testing arduino code in eclipse
Before retiring, I successfully introduced unit testing in Eclipse for an embedded arm cross compiled target to my team, based on the book Test-Driven Development for Embedded C by James W. Grenning
...
0
votes
0
answers
562
views
Connecting CppUTest to C Interface
I'm using CppUTest to handle unit testing with my C library. However, I'm having an issue when compiling the test file.
Here's my Makefile (The CPPUTEST_HOME var is an environment variable):
...
2
votes
1
answer
515
views
Compilation error after including jsoncpp
When I try to build test sources I get an error like after this.
stl_tree.h:542:14: error: ‘__node’ does not name a type
::new(__node) _Rb_tree_node<_Val>;
Executor's content.
#include ...
1
vote
1
answer
565
views
Windows command line not executing multiple commands [closed]
I am building a visual studio project through command line for that I need to run multiple commands at once.So I am created a batch file which includes all the commands.When I run the batch file only ...
0
votes
1
answer
721
views
Is there a way to build cpputest with pthreads disabled?
I'm planning to use cpputest as a testing framework in my project which I need to cross compile as it will be used on ARM platform. The compiler I'm using for ARM development is arm-gcc which is built ...
2
votes
1
answer
2k
views
Removing files from lcov tracefile using relative paths
I am attempting to remove certain directories from my lcov tracefile, but am not having any success. I am attempting to use relative paths, and I am using cygwin. My test framework is cpputest.
My ...
1
vote
1
answer
509
views
cpputest on STM8 failed due multiple 'main'
I want to use cpputest on STM8 and installed all the required tools for it.
I am able to run cpputest on my simplified code.
on my main file which belongs to the hardware I have of course the main ...
2
votes
2
answers
719
views
Unit Test - call a function in two test cases if the function is called only once in productive code
maybe there is someone who has experience with Unit Testing with cpputest.
I have something like this:
Source code Under Test:
main_function()
{
static int8 is_functioncalled = 1;
if (...
1
vote
1
answer
386
views
How to inject dependence in Unit testing with cpputest
I'm writing an Unit Test (in cpputest) where I try to perform an "dependence injection" to a function call. This means when the Unit Test have to call the real function which is placed within the file ...
1
vote
1
answer
1k
views
How to unit test a state machine in C using mocks of timers function?
I have a function that implements a state machine, test_hw(), i e. First state is idle, and it has not calling any mocked function inside. But this machine has 6 states more. The idea is that machine ...
2
votes
1
answer
425
views
Eigen with CPPUTest?
I am having a problem when trying to use CPPUTest to test my library.
Everything was fine until i included Eigen library to handle matrix processing.
When i tried to build with g++, Eigen library ...
1
vote
1
answer
807
views
Cpputest: how to compile and use expectNoCall?
I have wrote the syntax: mock().expectNoCall("productionCode") as Cpputest.org page says. But the compiler says that mocksupport class doesn't support this type of order.
test_RFID_Drv.c:322:9: ...