[Cppunit-devel] Allow comparison between different types
Brought to you by:
blep
|
From: <joh...@es...> - 2002-03-11 11:00:26
|
Hi,
just found the need to compare two different data types, e.g.:
CPPUNIT_ASSERT_EQUAL(std::complex(5.0, 0.0), 5.0);
Would it be possible to parameterize the assertion_traits (and accompanying
templates) on both the left and right types, e.g. (from TestAssert.h):
template <class T, class U = T>
struct assertion_traits
{
static bool equal( const T& x, const U& y )
{
return x == y;
}
template<typename X>
std::string toString(const X& x) const
{ ... }
}
... etc ...
Requires modifications to other template declarations in the file as well
(assertEquals), but I've tried making the changes and it compiles, builds
and executes the test suite without failures afterwards (VC++ 7.0).
And, while I'm at it: is there anyone updating the add-in for VC++.NET?
Regards // Johan
|