Questions tagged [cpputest]

CppUTest is a C/C++ based unit xUnit test framework for unit testing and test-driving code.

CppUTest is a C /C++ based unit xUnit test framework for unit testing and for test-driving your code. It is written in C++ but is used in C and C++ projects and frequently used in embedded systems but it works for any C/C++ project.

CppUTest’s core design principles are:

  • Simple in design and simple in use.
  • Portable to old and new platforms.
  • Build with Test-driven Development in mind

CppUTest has support for building mocks. This document described the mocking support. A couple of design goals for the mocking support were:

  • Same design goals as CppuTest – limited C++ set to make it well suitable for embedded soft.
  • No code generation
  • No or very few magic hiding macros
  • Very simple to use
  • The developer stays in control

The main idea is to make manual mocking easier, rather than to make automated mocks. If manual mocking is easier, then it could also be automated in the future, but that isn’t a goal by itself.

Official Website: http://cpputest.github.io/

Useful Links:

98 questions
0
votes
0 answers

Embedded software test, how to test bit state and time spent in that state?

I wrote a function that sends morse code by manipulating a GPIO pin. The pin is set high for a certain amount of time to signal DOT. Then set low for certain time to signal DOT-DASH space etc. So the problem is that I send a sequence for example…
augre
  • 330
  • 3
  • 12
0
votes
1 answer

cpputest - output more information about test case

when I build and run a cpputest I get output like: TEST(MYTEST, TEST_CASE_1) - 0 ms TEST(MYTEST, TEST_CASE_2) - 0 ms TEST(MYTEST, TEST_CASE_3) - 0 ms This is by specifying the command line argument -v (verbose) Is there a way to put more…
JohnDoe
  • 825
  • 1
  • 13
  • 31
0
votes
1 answer

TDD for C. How to compile and run my first test with CppUTest?

I am getting started with Test Driven Development for embedded C, and I started to read the book: 'Test-Driven development for embedded C', in which they recommend two development system test environments: Unity and CppUTest. Thus, I decided to…
Jorge S
  • 81
  • 1
  • 9
0
votes
2 answers

Weird behaviour when compiling CppUTest tests for application using Qt and Boost

I've following problem. When I try to compile .so library everything works fine. Scanning dependencies of target logger [ 11%] Building CXX object CMakeFiles/logger.dir/src/defaultconfig.cpp.o [ 22%] Building CXX object…
PaulWebbster
  • 1,480
  • 2
  • 14
  • 27
0
votes
3 answers

Checking if two vectors are equal

I have two vectors: std::vector calculatedValues = calculateValues(); std::vector expectedValues = {1.1, 1.2}; I am using cpputest to verify if these vectors are equal: CHECK_TRUE(calculatedValues == expectedValues) This is…
Pietair
  • 396
  • 2
  • 8
  • 18
0
votes
1 answer

CPPUTEST memory deletion

I have the code as below: char* Add() { p = new char[10]; return p; } and I use CPPUTEST with the test code as below: TEST(MyTestGroup, TestAdd_1) { p = Add(); // the above function delete p; } But the error is:…
0
votes
2 answers

CppUtest shared resources between tests, undefined reference

This is a simple question I believe... I want the variable virtualLeds to be shared between all the tests in the test group LedDriverTests, this is the code: #include "CppUTest/TestHarness.h" #include extern "C" { #include…
Mite
  • 57
  • 1
  • 9
0
votes
1 answer

Codeblocks and CppUTest, undefined reference

I am trying to compile the following test application using CodeBlocks and CppUTest, however no matter what I do I always get the undefined reference error. I compiled CppUTest with cygwin, in codeblocks I use MinGW. The project directory just has…
Mite
  • 57
  • 1
  • 9
0
votes
0 answers

C unit test common practice

For example, my production code(say it builds to an executable) has file_a.c (sub_module A) int func_a() { .... } file_b.c (module B) func_b () { ... ret = func_a(); ... } For unit test, I am using CppUTest.…
wei
  • 6,629
  • 7
  • 40
  • 52
0
votes
0 answers

CppUTest and CppUTestExt libraries in cpputest

I am using cpputest library to test my application. I am using scons. when I call SConScriptUtest, I get the following error: cannot find -lCppUTest cannot find -lCppUTestExt This is while I have included the path for finding CppUTest and…
Mehdi
  • 113
  • 1
  • 11
0
votes
2 answers

CppuTest: undefined reference to pthread during final linking

I'm a newby in cppuTest and actually I'm trying to build the ./examples within the CppuTest root directory. Source and Test files are compiled without problems but I'm stucking on the final linking stage where I get this…
JohnDoe
  • 825
  • 1
  • 13
  • 31
0
votes
0 answers

Makefile//Shell command, what is it doing and how? How to see what is happening

I am trying to understand/use a pre-defined Makefile (from CppUTest, MakefileWorker.mk). Around line 515 there is a gcov command available. However, when I use make gcov gcov is (once) invoked with apparantly invalid parameters as it (once) prints…
Daan Timmer
  • 14,771
  • 6
  • 34
  • 66
0
votes
1 answer

Compiling CppUTest and typecast errors

I have never used any unit test framework with C++. Now I took CppUTest version 3.6. I am trying to compile library according to README_InstallCppUTest.txt file: ./configure => OK make => Not OK src/CppUTest/JUnitTestOutput.cpp:170:29: error: use of…
Pasi
  • 181
  • 2
  • 7
0
votes
2 answers

QMAKE, CPPUTEST - Configuring a qmake project with cpputest

for a given qmake project: CONFIG += debug CPPUTEST_HOME = /Users/vodde/workspace/cpputest TEMPLATE = app TARGET = design_patterns_qmake DEPENDPATH += . INCLUDEPATH += (CPPUTEST_HOME)/include CONFIG += qt CONFIG += x11 CONFIG +=…
peter_gent
  • 175
  • 2
  • 4
  • 17
0
votes
1 answer

What is the alternative of extern keyword in CppUTest?

I am using CppUTest in eclipse-cdt(ubuntu 14.0). For inherits of C function in CppUTest I should write, extern "C" { } Is any alternative to inherit all C project into Cpp for CppUTest ? What is the disadvantages of extern in CppUTest?
Ravi
  • 13
  • 1
  • 7