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

Is there a recommended way to set environment variables for CUnit tests?

We want to use CUnit to test a shared library that we have developed. The shared library is loaded via the standard Solaris LD_PRELOAD mechanism where it uses an environment variable to remap a string containing a file path to a new date and time…
Rob Wells
  • 36,220
  • 13
  • 81
  • 146
1
vote
2 answers

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 using "./configure --prefix='/lib' " 3 - make…
guisantogui
  • 4,017
  • 9
  • 49
  • 93
0
votes
1 answer

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 might have already done it. I am waiting for…
0
votes
1 answer

Getting a "ld: cannot find -lcunit" error with CUnit

I'm using NetBeans 7.1 on Windows 7. I downloaded the CUnit archive and used shell scripts supplied with the archive to install it ($make install, etc.). I'm using Cygwin as my compiler, and whenever I try to build the unit test, I get the following…
Phonon
  • 12,549
  • 13
  • 64
  • 114
0
votes
2 answers

Multiple definition of 'main' first defined here when using CUnit tests

I am new at using CUnit and writing a C program. I have this error printing when I run make and then make test : /usr/bin/ld: test_errors.o: in function 'main': test_errors.c:(.text+0x35): multiple definition of `main';…
0
votes
0 answers

Use of #define in CUNIT header file

While trying to learn CUNIT, I found the following in CUNIT header file Basic.h: #define CU_EXPORT CU_EXPORT CU_ErrorCode CU_basic_run_tests(void); What is the purpose of CU_EXPORT? Not sure what it means. Is it equivalent to "extern"?
0
votes
1 answer

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 definition of compare in the list struct or if its how I…
davdavdav2
  • 13
  • 3
0
votes
0 answers

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 the .c file I created. If anyone is familiar…
0
votes
1 answer

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) { perror("server: socket"); exit(1); } …
0
votes
1 answer

C Unit Test: stub a constant structure (gcc --wrap)

Hi All here is my specific case: service.h: typedef struct { uint8_t (*function1)(void); uint8_t (*function2)(void); } const service_struct_t; extern service_struct_t service_api ; service.c: #include "service.h" …
Zoyolin
  • 25
  • 5
0
votes
1 answer

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 the given steps, using mingw64. But it said that…
Ablia
  • 191
  • 2
  • 10
0
votes
0 answers

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 update later) There is: ...Unittest.dev file, so…
Dave M
  • 31
  • 1
  • 9
0
votes
2 answers

CUnit return 0 on test fail

I built a simple program that executes a test in CUnit. The main function is: int main() 50 { 51 CU_pSuite pSuite = NULL; 52 53 /* initialize the CUnit test registry */ 54 if (CUE_SUCCESS != CU_initialize_registry()) …
Federico Taschin
  • 2,027
  • 3
  • 15
  • 28
0
votes
0 answers

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 from the test folder, I get the following…
Vik78
  • 305
  • 1
  • 2
  • 14
0
votes
2 answers

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 tell me why I am getting this error. Thanks in…
Mehmed
  • 1