Orthodox

   
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 .

Figure C-9. The templated test class Orthodoxy
figs/utf_ac09.gif

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.



Unit Test Frameworks
Unit Test Frameworks
ISBN: 0596006896
EAN: 2147483647
Year: 2006
Pages: 146
Authors: Paul Hamill

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net