Gethos

CUnit

: : :
 

'C' Unit Testing Framework

This is a Unit Test framework for 'C'.

This is not intended for C++, there are other frameworks that specifically support C++.

The emphasis in this framework is to make test writing as simple as possible. As such all the developer needs to do is write test functions, define the suite layout and compile the code into a shared object with a name of the form libtest_*.so.

The unit test runner finds all libtest_*.so files under the directory it is run from, compiles a list of tests defined in the corresponding suites and runs all the tests. The output is displayed directly to the console using colours for added readability. It shows the progress, results and bottom line.

The basic structure of a test suite is:

  • suite-initialiser (optional)
  • suite-finaliser (optional)
  • test-setup (optional)
  • test-teardown (optional)
  • test-1
  • ...
  • test-n.

The test-x are simply functions that carry out the test by checking appropriate conditions. The UTEST_ASSERT() macro is used to check the condition expression and fail the test if the condition evaluates to false.

The suite initialiser and finaliser functions are called once at the start of the suite and at the end of the suite respectively.

The test setup and teardown functions are called before and after each test.

Each suite is compiled into a single libtest_*.so

Each test in the suite is given a name, and the suite is given a name. As a convention the suite name can be broken up in to "::" separated names (e.g. Example::ABC). This can be used to help with the organisation of test suites into a hierarchy that spans multiple libraries or projects.

Download

cunit-0.7.5.tar.gz

Change Log

CHANGELOG

Bug reports and Enquiries

Contact:

 
: : :