C++ Complementary Library
The test_module class template represents a test module.
A test module is an object containing functions that exercise, or test some piece of code, most commonly a class.
The general approach to testing adopted in CCL is to subclass test_module and implement one member function per unit test, construct this test_module subclass with an initializer list of function pointers referencing each member function containing a unit test, and then call the run_tests function to run all the tests. The return value of run_tests is then returned by the main function of the test program. If the return value is zero, all tests succeeded, otherwise the return value is the number of unit tests that failed.
The inner test module type, that is, the test_module subclass.
Gives a name to the signature of a test function so that corresponding function pointers can be written more clearly.
Constructs a test module aware of the provided test functions.
The pointers to the test functions that this test_module will run when run_tests is called.
Runs all registered tests in this test module and returns the number of tests that failed.
Announces the test that is just starting
The name of the test that is just starting.
Prints a message to standard output stating that the current stage succeeded.
Pushes a message onto the message queue.
The message to push onto the message queue.
Pops a message from the message queue and returns it. If the message queue was empty, an empty message is returned.
Removes all messages in the message queue.
Returns an output stream that can be used to log informational messages.
Returns an output stream that can be used to log error messages.
Returns the number of messages in the message queue.
Copyright © 2022-2025 Daniel T. McGinnis