Questions tagged [cunit]

Anything related to CUnit, a unit testing framework for C programs.

Anything related to CUnit, a unit testing framework for C programs.

80 questions
1
vote
1 answer

CUnit: fail with dynamically generated string

Background CUnit provides the CU_FAIL function, which allows one to indicate the failure of a test with a chosen message. Calling CU_FAIL("failure message") would fail the enclosing test, printing a string which includes CU_FAIL("failure…
justinpc
  • 797
  • 6
  • 19
1
vote
1 answer

Wrapping function in c

I got task to write unit tests(using cunit and cmocka) for existing project(written in C), and a met following problem. When I wrap function that is defined in tested file, only original function is called. Additional, a can't change source of…
mmichal10
  • 322
  • 2
  • 13
1
vote
0 answers

Run CUnit in XCode

I want to learn CUnit from the beginning. As I use macOS I don't want to install other IDEs like netbeans. I want to install CUnit and start learning it using XCode. How can I install CUnit for XCode?
A. K. M. Tariqul Islam
  • 2,824
  • 6
  • 31
  • 48
1
vote
1 answer

CUnit error: implicit declaration of function 'CU_inizialize_registry'

I'm new with CUnit, I'm trying to run a sample code to test if CUnit works. I have three files. max.h #ifndef MAX_H_ #define MAX_H_ extern int maxi(int, int); #endif /* MAX_H_ */ max.c #include "max.h" int maxi (int i1,…
1
vote
0 answers

How to configure correctly CUnit on Eclipse

I'm trying to set my CUnit on Eclipse but I got two errors: If I lunch without -lcunit parameter I have: undefined reference to CU_assertImplementation If I lunch with -lcunit I have: bin/ld.exe: skipping incompatible lib/libcunit.a when…
granmirupa
  • 2,780
  • 16
  • 27
1
vote
0 answers

Gradle: Link against installed version of CUnit in unit testing

I have swapped to gradle as my new build system for C++ (althought I previously used it with java). Now, when I tried to link against CUnit for the test cases with a build file like apply plugin: 'cpp' apply plugin: 'cunit' model { platforms { …
WorldSEnder
  • 4,875
  • 2
  • 28
  • 64
1
vote
1 answer

missing version in cunit pkg-config configuration

I've installed on Ubuntu Trusty64 the libcunit1-dev package (2.1-2.dfsg-1). This comes with a pkg-config installed in /usr/lib/pkgconfig/cunit.pc. However, it seems that once installed, pkg-config itself runs into…
JayTaph
  • 2,846
  • 1
  • 22
  • 29
1
vote
0 answers

how to test a structure created from a file stream on Cunit test framwork in eclipse

I want to test in eclipse with cunit test framework one structure, but it looks like the stream is still opened, and I can't get results. Here is my code. Thanks for help. void test_is_male() { person* test_person=…
Met
  • 11
  • 1
1
vote
2 answers

Error while loading shared libraries - Using CUnit on Netbeans

I am a newbie working with Cygwin and CUnit. I have to develop some Unit Tests using CUnit and Netbeans and I have followed the next tutorial: https://netbeans.org/kb/docs/cnd/c-unit-test.html?print=yes#project At the end, when I was trying to run…
1
vote
2 answers

Display content of an ASSERTed variable

Simple question here : is it possible to show the content of a variable freshly tested by a CUnit test? Printf() is not displayed during tests, and anyway I don't want to use it. For example, I would like CUnit to output the result of…
Louisbob
  • 860
  • 3
  • 9
  • 22
1
vote
1 answer

CUnit output not compliant with Jenkins Junit

For a test framework with Jenkins, I am using CUnit. The result is never correct when running in Jenkins. When I inspect the output of CUnit, it is not Junit compliant. The XML file is not even XML compliant! I am using version 2.1.3. When I observe…
Bart Mensfort
  • 995
  • 11
  • 21
1
vote
1 answer

Symbol not found - CUnit on Snow Leopard

I just installed CUnit on Snow Leopard with MacPorts/DarwinPorts. The installation went fine, however, I get en error when trying to run the unit tests: dyld: Symbol not found: _acs_map Referenced from: /opt/local/lib/libcunit.1.dylib Expected…
Fredrik
  • 71
  • 4
1
vote
0 answers

Test one specific test suite given a cunit test file

Given a cunit test containing multiple suites (Suite1, Suite2, Suite3) which I can run all at once with "./test" How do I test one specific suite (Suite2) in that cunit file? I tried "./test Suite2" which didn't work, and the cunit website seems…
herpderp
  • 33
  • 1
  • 5
1
vote
1 answer

Run CUnit exes generated on a Jenkins build on other machines automatically

I'm currently running a a build job on Jenkins that generates a bunch of CUnit testing exes. What I'd like to do is take those binaries and run them automatically on a bunch of other machines upon successful completion of the build. For example:…
tparrott
  • 343
  • 1
  • 4
  • 16
1
vote
3 answers

how do i exit a function which causes segfault and return to calling function

Hi i am attempting to test a code to see if it is designed to handle memory issues. Unfortunately I have to do this through c-unit which doesn't handle segmentation faults very well (just crashes out) So my question is can i add a signal handler to…
Venkat
  • 161
  • 2
  • 10