assertion_traits

   
assertion_traits

Description

The template assertion_traits (see Figure C-1) is used by the CPPUNIT_ASSERT_EQUAL() macro. The template is specialized for different data types that are passed to the macro. For example, the template specialization assertion_traits<int> is used when CPPUNIT_ASSERT_EQUAL( ) takes arguments of type int .

The declaration of assertion_traits is found in TestAssert.h . It belongs to the namespace CppUnit .

Figure C-1. The template assertion_traits
figs/utf_ac01.gif

Declaration

 template<class T> struct assertion_traits<T> 

Constructors/Destructors

None.

Public Methods


static bool equal(const T& x, const T& y)

A function template to compare two arguments of type T . The default implementation compares them using == .


static string toString(const T& x)

A function template to output a string representing the input argument of type T . The default implementation creates the output string by creating a std::OStringStream and using its << operator.

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