CppUnit project page FAQ CppUnit home page

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

assertion_traits< T > Struct Template Reference

Traits used by CPPUNIT_ASSERT_EQUAL(). More...

#include <TestAssert.h>

List of all members.


Static Public Member Functions

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

Detailed Description

template<class T>
struct assertion_traits< T >

Traits used by CPPUNIT_ASSERT_EQUAL().

Here is an example of specialising these 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>
static bool assertion_traits< T >::equal ( const T & x,
const T & y
) [inline, static]

template<class T>
static std::string 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

AltStyle によって変換されたページ (->オリジナル) /