CppUnit project page FAQ CppUnit home page

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CppUnit::assertion_traits Struct Template Reference

Traits used by CPPUNIT_ASSERT_EQUAL(). More...

#include <TestAssert.h>

List of all members.

Static Public Methods

bool equal (const T &x, const T &y)
std::string toString (const T &x)


Detailed Description

template<class T>
struct CppUnit::assertion_traits< T >

Traits used by CPPUNIT_ASSERT_EQUAL().

Here is an example of specialization of that traits:

 template<>
 struct assertion_traits<std::string>   // specialization for the std::string type
 {
   static bool equal( const std::string& x, const std::string& y )
   {
     return x == y;
   }
 
   static std::string toString( const std::string& x )
   {
     std::string text = '"' + x + '"';    // adds quote around the string to see whitespace
     OStringStream ost;
     ost << text;
     return ost.str();
   }
 };


Member Function Documentation

template<class T>
bool CppUnit::assertion_traits< T >::equal const T &    x,
const T &    y
[inline, static]
 

template<class T>
std::string CppUnit::assertion_traits< T >::toString const T &    x [inline, static]
 


The documentation for this struct was generated from the following file:
SourceForge Logo hosts this site. Send comments to:
CppUnit Developers