Skip to content

woelke/cpp-minimalist_unit_test_suite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimalist C++ Unit Test Suite

This Unit Test Suite based on the idea of the Boost Test Library but has no Boost dependencies. The Minimalist C++ Unit Test Suite provides 4 different test functions which test given expression and print the result in an clean and ordered fashion. As any other suitable unit test library, it separates the operational code from the test code and does not increase the size of the release version binary.

Unit Test Suite demo

Architecture

- ut_bootstrap
- ut_suite
    - ut_minimal 
  • ut_bootstrap collects a arbitrary number of test units (a method, which tests a particular functionality of a program) and prepare them for testing.
  • ut_minimal defines test functions, which can be composed to a test unit. If a whole test suite is not required, the test functions can be used standalone.
  • ut_suite manages and runs the test process.

Test Functions

  • UT_CHECK(expression): verifies the expression of correctness, a wrong expression will be exposed
  • UT_REQUIRE(expression): verifies the expression of correctness, a wrong expression will be exposed and leads to abortion of the test unit
  • UT_ERROR(message): prints an error message
  • UT_FAIL(message): prints an error message and aborts the test unit

How to use this test suite in your program

Run the example

Requirements: qt5-qmake or qt4-qmake

sudo apt-get install qt5-qmake
sudo apt-get install qt5-default
#or
sudo apt-get install qt4-qmake

Create makefile and compile

qmake #without test suite
#or
qmake DEFINES+=UNIT_TESTS #compile with test suite

make
./program

About

A minimalist unit test suite

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published