Skip to content

Easily write CUnit based unit tests for CMake based projects

License

Notifications You must be signed in to change notification settings

thiru-mg/cmake-cunit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CUnit integration for CMake

This is a simple little project attempts to make writing unit tests in C with CUnit as easy as writing unit tests in C with Criterion. The benefit of using CUnit over Criterion is that tests can be run on embedded targets.

CMake is used to preprocess the every source file specified when defining a new test executable. It searches through the files looking for the signatures: CU_Init, CU_Clean, CU_Test and CU_Theory. When any of those signatures is found the necessary actions are taken. When all files have been scanned, a runner is generated that can be used to execute the tests.

A little demo is included. To build it, run the following commands.

cd cmake-cunit
mkdir build
cd build
cmake ..
./demo

About

Easily write CUnit based unit tests for CMake based projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CMake 66.5%
  • C 33.5%