Skip to content

dmorse/test

Repository files navigation

This directory contains the source code for a simple unit test library.
The library contains only header files, in which all member functions
are inlined. 

Design Overview
----------------

The library contains classes UnitTest, TestRunner, and CompositeTestRunner, 
and a class template UnitTestRunner.

UnitTest is a base class for classes that implement unit test methods. 
Each subclass of a UnitTest should have one or more test methods, each
of which should contain one or more assertions. Each assertion must 
be implemented using the the TEST_ASSERT(expression) macro to test the
truth of a logical expression.  Files that define subclasses of UnitTest 
should include the files "UnitTest.h" and "UnitTestRunner.h". 

TestRunner is an abstract base class for classes that run test methods.
The run() method of a TestRunner runs a sequence of associated test 
methods. TestRunner is base class for the UnitTestRunner class template 
and for the class CompositeTestRunner.

UnitTestRunner is a class template that takes a subclass of UnitTest 
as a template argument. The run() method of a UnitTestRunner runs all 
of the test methods of the associated UnitTest subclass. For example, 
UnitTestRunner<TestA>::run() runs all the test methods of a UnitTest
subclass named TestA. The file UnitTestRunner.h contains a set of 
preprocessor macros that can be used to generate the code required
to define an instantiation of UnitTestRunner and to register all of
the test methods of the associated UnitTest. 

A CompositeTestRunner is a composite of two or more other TestRunner 
classes, each of which may be either an instantiation of UnitTestRunner 
or another CompositeTestRunner.

More information about each class is given in the class documentation 
for the UnitTest, TestRunner, UnitTestRunner, and CompositeTestRunner. 
Three programs that illustrate usage are given in the examples/ 
subdirectory.

CommandLine class
-----------------

CommandLine is a utility class to simplify programmatic construction 
of C command line arguments argc and argv. It is useful for unit
testing of functions that parse command line arguments.

About

Simple C++ unit test framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages