utst::TestCase Class Reference
A test case is a collection of test code which uses the UTST macros to perform self verifying checks. Subclasses of the TestClass interface should provide implementations of the getName(), theTest(), and clone() functions.
Several macros are provided to make it easier to write tests. The UTST_TEST_CASE() macro will create a new subclass of the TestCase interface and allow the user to just provide the test code. A user can also create test cases by directly subclassing the TestCase interface and adding test code to the theTest() member function. An example is below.
UTST_TEST_CASE( TestAddition ) { UTST_CHECK( 1 + 1 == 2 ); UTST_CHECK_EQUAL( 1, 1 ); }
The available test macros are listed below. These macros can only be used with the UTST_TEST_CASE macro or in theTest() member function of classes which are derrived from TestCase.
- UTST_CHECK : Check a predicate
- UTST_CHECK_EQUAL : Check if two expressions are equal
- UTST_CHECK_CONTAINERS : Check if two STL containers are equal
- UTST_CHECK_THROW : Check if an expression throws a specific exception
- UTST_FAIL : Fail with a specific error message
- UTST_NOTE : Make a note to the test log stream
Inheritance diagram for utst::TestCase:

Public Methods
Protected Methods
Related Functions
(Note that these are not member functions.)- UTST_TEST_CASE(testCaseName_)
- UTST_CHECK(predicate_)
- UTST_CHECK_EQUAL(exp1_, exp2_)
- UTST_CHECK_NOT_EQUAL(exp1_, exp2_)
- UTST_CHECK_THROW(excep, expr)
- UTST_CHECK_CONTAINERS(c1, c2)
- UTST_FAIL(msg_)
- UTST_NOTE(msg_)