Name
Orthodox
Description
The template Orthodox
(see Figure C-9) is a
subclass of TestCase. When specialized for a
class, it tests the class for
“orthodoxy,” represented by the
following conditions:
The class has a default (no argument) constructor
The class has equality (==) and inequality (!=) operators
The class has an assignment (=) operator
The class has a negation (!) operator
The class has a copy constructor
The test verifies not only that ClassUnderTest has
these operations, but also that the operations’
semantics are correct. For example, double negation should result in
equality.
The main purpose of Orthodox is to serve as a
working example of a templated test case.
Orthodox belongs to the namespace
CppUnit. It is declared and implemented in
extensions/Orthodox.h.
![]() |
Declaration
template<typename ClassUnderTest> class Orthodox : public TestCase
Constructors/Destructors
-
Orthodox( ) A constructor.
Public Methods
-
ClassUnderTest call(ClassUnderTest object) Returns
object.-
void runTest( ) Runs the orthodoxy tests.
Protected/Private Methods
None.
Attributes
None.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
