Questions tagged [cunit]

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

cunit
32 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
0 answers
2k views

How to use gcov with gcc without the optimization?

I have a test code like this: int diff21(int n) { if (n <= 21) { return 21 - n; } else { return (n - 21) * 2; } } and I added the compile flags: -fprofile-...
shengy's user avatar
  • 9,621
3 votes
1 answer
5k views

How to run cunit test in Eclipse?

i want to run cunit test in my project and develop it use Eclipse, how to integrate the cunit to Eclipse, write and run the case. I have no idea about it, who can help me?
David's user avatar
  • 929
2 votes
1 answer
2k views

How to configure Gitlab CI to parse test output?

I am working on Gitlab and I would like to set up a CI (it is the first time I configure something like that, please assume that I am a beginner) I wrote a code in C with a simple test in Cunit, I ...
lefel's user avatar
  • 23
1 vote
0 answers
67 views

CUnit testing void functions

Hi Im new to Cunit tests and testing in general. I cant find a way to test this void functon. Wondering how to properly do it or how to refactor it. Any tips on how to properly test void functions? ...
LIsa's user avatar
  • 163
1 vote
1 answer
258 views

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, ...
justinpc's user avatar
  • 827
1 vote
0 answers
195 views

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's user avatar
1 vote
0 answers
935 views

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....
granmirupa's user avatar
  • 2,780
1 vote
0 answers
309 views

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: '...
WorldSEnder's user avatar
  • 4,986
1 vote
0 answers
141 views

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() { ...
Met's user avatar
  • 11
1 vote
1 answer
1k views

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 ...
Bart Mensfort's user avatar
1 vote
0 answers
412 views

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" ...
herpderp's user avatar
1 vote
2 answers
9k views

Importing CUnit sources

i'm having a problem to use Unit test in C, i've tried to install CUnit in my computer and after include the lib. i've followed steeps to install the CUnit: 1 - download the sources 2 - configure it ...
guisantogui's user avatar
  • 4,076
1 vote
2 answers
749 views

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=...
user1789042's user avatar
0 votes
0 answers
14 views

NetBeans: Unable to Create CUnit Tests - Grayed Out Menu Options

I use NetBeans since version 7.4 (currently using v21) to develop several C projects (libraries and programs) in Linux distributions (mainly Ubuntu and recently Archlinux). For completeness, I use GNU ...
user1887502's user avatar
0 votes
1 answer
90 views

Implementation of element compare function in linked list

I'm trying to implement a function which is part of a linked list struct, but for some reason I keep ending up with a segmentation fault in my tests. I'm not sure if the fault is caused by my ...
fireproofiii's user avatar
0 votes
0 answers
46 views

How can I compile(gcc) on my c file at Cgreen?

I should use Cgreen to do work related verification. I get help here and I success build Cgreen from 'make' command. make make test make install but my question is how to compile as gcc compiler for ...
James yang's user avatar
0 votes
1 answer
179 views

How can I test a function with void return value when using cunit

I have a function that I need to test with cunit. The function looks like this: void server(unsigned short port) { int sock_fd = socket(AF_INET, SOCK_STREAM, 0); if (sock_fd < 0) { ...
一連の問題's user avatar
0 votes
1 answer
699 views

How to install Cunit with Mingw64

I need to install CUnit on Windows. I already had a CUnit folder with headers, but it was in Linux, and i don't have the lib for windows. So i downloaded CUnit-2.1.3 and tried to install it following ...
Ablia's user avatar
  • 305
0 votes
0 answers
461 views

Can't create precompiled header Z:\usr\include\stdio.h.gch: Permission denied

I'm using a Debian9 Linux and Cpp-Dev using Wine. I'm currently trying to run some CUnit tests which were written for a program (protocol stack written in C) developed in 2006/2007. (which I need to ...
Dave M's user avatar
  • 31
0 votes
0 answers
169 views

Netbeans 8.2/Cygwin: Broken pipe error while running CUnit tests

If I create a new C11 application in Netbeans (with auto-generated makefile), add a dummy function to its main.c file that just returns 0, add a test to the function, and run the test via Netbeans ...
Vik78's user avatar
  • 294
0 votes
2 answers
409 views

CUnit CU_register_suites(suites) error

I'm testing this code with CUnit. I get this error message: /bin/sh: line 1: 44477 Segmentation fault: 11 ./build/Debug/GNU-MacOSX/tests/TestFiles/f2 Where is fault? I can't see it. Can anybody ...
Mehmed's user avatar
  • 1
0 votes
0 answers
214 views

Installing / Compiling tarball in Windows

I have been asked to 'get' CUnit (the C testing framework) on my machine (windows 10 Pro x64). However, when i came to downloading it, I noticed that it was in a "tarball" file format (tar.bz2). ...
Lorenzo Battilocchi's user avatar
0 votes
1 answer
1k views

Unit Testing: CUnit

This one is causing grief; I'd like to get to grips with CUnit. Have installed it using the following instructions: http://macappstore.org/cunit/ I am using the following at command line: gcc myprog....
user avatar
0 votes
1 answer
3k views

Clean up after exception Google c++ test framework

I am using C++ unit tests using the google unit test framework (fixtures), clean up after the tests is very important for me. But in case of an exception the executable crashes and the clean up never ...
user1918858's user avatar
  • 1,202
0 votes
1 answer
2k views

How to install CUnit on Windows

I've downloaded the library to my desktop but when I try and install it by running the ./configure command I get an error: bash: ./configure: No such file or directory I've looked at 2 existing ...
jhj's user avatar
  • 41
0 votes
1 answer
1k views

Building CUnit with cygwin on windows

Can anyone explain me, how to build CUnit on Windows using cygwin? Only found an example using mingw Building CUnit on Windows Call of make Fails (no such command). Anyone help me?
user avatar
0 votes
1 answer
1k views

CUnit (undefined reference)

I need to write a program using C and CUnit to test some simple stack functions and using "Makefile" but when I try to compile it, I always get the same errors. The terminal on ubuntu show this when I ...
バカです's user avatar
0 votes
2 answers
249 views

C - Ignoring user inputs in CUnit?

I've been search around for an answer but I haven't found one. The thing is, I need to do some test cases for a program I've written in C. The thing is, some functions take in an user input which ...
drante's user avatar
  • 129
0 votes
0 answers
1k views

How to link main.c with CUnit library in terminal?

I am working with CUnit and learning test driven development. Please can someone help me out with the compilation part. my command in terminal is: gcc -main.c -o main this is obviously not correct ...
satej k's user avatar
  • 99
0 votes
0 answers
202 views

deferencing pointer to incomplete type C Struct CUNIT

Excuse me i'm getting this error deferencing pointer to incomplete type,i have defined buffer_t in a buffer.c file, and i'm in CUNIT i initialize the buffer before each test #include "msg.h" #include ...
user2993592's user avatar
0 votes
1 answer
193 views

How to compile CUnit for iOS

I am trying to compile cuint for iOS, before that i searched for if there is any cunit library available for iOS. can someone please help me on how to compile cunit source in iOS. I am sure someone ...
user1303133's user avatar
-1 votes
1 answer
139 views

Cunit Testing free memory twice

excuse me i know that i should not free() twice a pointer, but how can i check if is not already free ? checking if null ? i don't know beacuse somebody told me that the free() comand doesn't write ...
user2993592's user avatar