Questions tagged [check-framework]

A unit testing framework for C.

Check is a unit testing framework for C. It features a simple interface for defining unit tests, putting little in the way of the developer.

  • Tests are run in a separate address space, so Check can catch both assertion failures and code errors that cause segmentation faults or other signals.
  • The output from unit tests can be used in source code editors and IDEs.

For more information, see https://libcheck.github.io/check/.

22 questions
37
votes
2 answers

Is it overkill to run the unit test with Valgrind?

Just some days ago I started looking into a unit test framework called check, and I intend to run the test on c code under Linux. Now check and some well designed code and some test code can help me to verify that the basic functionality is…
Johan
  • 20,067
  • 28
  • 92
  • 110
28
votes
2 answers

Using C unit testing framework Check without Autotools?

I am trying to follow along with the official Check tutorial, but it requires a working knowledge of Autotools, which I don't have. I was hoping just to write a couple quick tests, and I'm finding this tutorial overwhelming. It relies on a lot of…
Mark E. Haase
  • 25,965
  • 11
  • 66
  • 72
24
votes
3 answers

Basic unit test and C, how do I get started?

After reading quite some threads here at StackOverflow, I have come to the conclusion that I should adopt to some form of test driven development/unit test (or at least explore the area). And since we are talking about c code under Linux, I…
Johan
  • 20,067
  • 28
  • 92
  • 110
12
votes
3 answers

Using unit testing framework for C Check

I am trying to use unit testing framework for C called Check. I installed the package as instructed on the file INSTALL in the package: ./configure make make check -> run self-tests that come with the package (pass successfully). make…
Hagai
  • 1,049
  • 11
  • 13
8
votes
4 answers

Debugging unit test in C using check

I'm trying to use check unit testing framework for my C application. But I can't use the debugger (gdb) with it because of two points: first, check use some complex macros (START_TEST and END_TEST) and the debugger has trouble to put a breakpoint…
Kartoch
  • 7,610
  • 9
  • 40
  • 68
6
votes
1 answer

Building the library for check test C framework

I started to use check framework for testing C application. For better understanding I went across the example in check package. It is working fine, but I don't need the automake tools - I want to compile it by my own Makefile (since I want to…
srnka
  • 1,275
  • 2
  • 12
  • 16
5
votes
1 answer

Check framework example giving me error when running './configure'

I'm building the check framework example 'check_money', but it's not building on my machine. The error is: configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.." I've tried installing it using: libtoolize…
macmania314
  • 457
  • 2
  • 18
3
votes
4 answers

How can I build Unittests with check?

I want to test my C code and decide to using check as testing Framework. But I don't understand how to compile the code? In the tutorial they have already very huge makefiles, but they do not explain how to build them or what gcc flags I need. How…
3
votes
1 answer

How to use check library with CTest for unit testing in C

I have project in which I want to use check library for unit testing. My current project is using CMake and has following structure: . ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── README ├── src │   ├── core │ │   ├── CMakeLists.txt │ │ …
Hubert Kario
  • 21,314
  • 3
  • 24
  • 44
3
votes
1 answer

xUnit testing framework for C

I'm developing a fairly simple C project for an embedded device. I'd like to employ xUnit testing. I've settled down with the Check framework (http://check.sourceforge.net/), but it seems it doesn't support function stubs. I remember using a very…
Roman Dmitrienko
  • 3,375
  • 3
  • 37
  • 48
3
votes
0 answers

Eclipse C Unit Testing with Check undefined reference error

I'm extremely new to C and I'm having the following problem: I made a very small program filecopy.c, and I want to make a unit test for it with Check, but when I make the unit test and build it I get a ton of undefined reference errors as if Eclipse…
aquasheep
  • 153
  • 1
  • 10
2
votes
1 answer

Syntax error when using check unit testing framework with C99

I'm running into a weird syntax error when I try to compile tests using the check unit testing framework with the -std=c99 flag. So, I'm trying to compile the example.c: #include START_TEST(example) { fail(); } END_TEST int main(int…
rampion
  • 87,131
  • 49
  • 199
  • 315
2
votes
1 answer

Using the check test unit framework in an embedded device?

Has anyone used check as the unit test framework in an embedded device which also requires cross-compilation? Is it even a good idea, or should I just use something else (e.g. embunit or similar)? If so, how should I write the Makefile.ams and…
Makis
  • 12,468
  • 10
  • 62
  • 71
2
votes
1 answer

C segmentation fault, invalid read of size 4

There is a nice answer here, Segfault in c++ program; Incomprehensible valgrind output, but it doesn't explain what happens in my code Error summary: ==6520== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2) ==6520== ==6520== 1…
Bato-Bair Tsyrenov
  • 1,174
  • 3
  • 17
  • 40
1
vote
1 answer

Should I unit-test combinations of (C) units as well as units themselves?

I am new to unit testing, just getting into it using Check for C. This is a question of unit testing theory. Let's say (because it is true) that I have a module of code that formats messages to and from a serial protocol. I have another module which…
blueshift
  • 6,742
  • 2
  • 39
  • 63
1
2