Implementation of CPPUnitLite
1. Class TestRegistry is a Singleton mode.
l The outside world has been obtained by instance () method.
l It is actually a registry of all test cases.
l It contains a pointer to the test case chain table, which is a TEST pointer. And maintain the list.
l Instance Method ADD is responsible for joining a new test case to the list and puts an existing test chain table as the next node of the new test case. So the test case chain list is a LIFO queue.
l It is responsible for calling all test cases
2. Class TEST is the base class of all test cases.
l The constructor is responsible for adding itself into the Testregistry Registry and as the header.
l It provides a pure virtual function run, specific test case Override this virtual method.
l It contains a pointer to execute the next test case, so Test itself is a test case list.
3. Macro TEST contains the code of the actual test case.
l Responsible to define a subclass of Test.
l The pure virtual function RUN of the Override base class, so that the subcategory can not instantiate.
l Responsible for generating an example of the subclass. (The construction function of the base class ensures that the instance is added to the Testregistry Registry).
4. Class TestResult is responsible for collecting the execution of all test cases
l The virtual function TestStarted indicates that the test test case is started.
l The virtual function TESTENDED indicates that the test case is executed.
l The virtual function addfailure indicates that an error occurs when performing a test.
5. Auxiliary macro CHECK, check_equal calls TestResult's virtual function addFailure when the expectations and results do not match.
6. Class Failure, SimpleString belongs to the secondary class, which represents an error message when performing tests (such as file name, line number, expected results, actual results, etc.), simple string.