Unit test framework for embedded/IOT applications and C programs and libraries. Originally based on libcheck framework
Clone or download
Pull request Compare This branch is 3 commits ahead, 18 commits behind libcheck:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
checkmk
cmake
contrib
doc
lib
m4
mock
src
tests
web
xml
.editorconfig
.gitignore
.travis.yml
AUTHORS
CMakeLists.txt
COPYING.LESSER
ChangeLog
HACKING
Makefile.am
NEWS
README.md
THANKS
TODO
appveyor.yml
check.m4
check.pc.in
configure.ac
index.html

README.md

C Unit Tests

Travis Build Status Appveyor Build Status

C Unit Tests 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 within source code editors and IDEs.

See https://libcheck.github.io/check for more information, including a tutorial. The tutorial is also available as info check.

Installation

C Unit Tests has the following dependencies:

  • automake-1.9.6 (1.11.3 on OS X if you are using /usr/bin/ar)
  • autoconf-2.59
  • libtool-1.5.22
  • pkg-config-0.20
  • texinfo-4.7 (for documentation)
  • tetex-bin (or any texinfo-compatible TeX installation, for documentation)
  • POSIX sed

The versions specified may be higher than those actually needed.

autoconf

$ autoreconf --install
$ ./configure
$ make
$ make c-unit-tests
$ make install

in this directory to set everything up. autoreconf calls all of the necessary tools for you, like autoconf, automake, autoheader, etc. If you ever change something during development, run autoreconf again (without --install), and it will perform the minimum set of actions necessary.

cmake

$ mkdir build
$ cd build
$ cmake ../
$ make
$ CTEST_OUTPUT_ON_FAILURE=1 make test

Linking against C Unit Tests

C Unit Tests uses variadic macros in check.h, and the strict C90 options for gcc will complain about this. In gcc 4.0 and above you can turn this off explicitly with -Wno-variadic-macros. In a future API it would be nice to eliminate these macros.