ASM Software Unittest Framework

(c) 2016 by Matthias Arndt marndt@asmsoftware.de

The MIT License applies to this project. Please refer to the file COPYING for details.

The software is available on GitHub at https://github.com/simonsunnyboy/UnittestFramework

Abstract

This is a small framework to implement unittests for software written in C. There are existing projects that offer much more functionality, this one focuses on simple usability and textual output of statistics.

Main reason to implement this framework was that cunit was too complicated in usage and no other small free frameworks could be found.

System requirements

  • Cmake to build the example project
  • a C99 compliant C compiler but a C90 one will do if stdint.h and stdbool.h are supplied
  • any operating system of your choice

Using the test framework

A test should be a subfunction or the main function of an appropriate test executable.

Use the macros defined in unittest.h and link your project with unittest.c

Wrap the Test with UT_BEGIN() and UT_END() macros for proper structuring. Most commands should describe themselves.

It is allowed to start another test for entirely different content with the UT_BEGIN() macro if the last test finished with the UT_END() macro.

Comments are closed.