
Hi,
I'm having a bit of trouble getting user-defined objects working with
Boost.Test. I skimmed through the docs and I didn't see anything on this
subject, but the boost documentation isn't the most intuitive documentation,
so it is a bit easy to miss obvious stuff like this.
Anyway, I have a class named "Foo", and I've given it an overloaded boolean
== operator. When I do the following, it fails to compile under MSVC9:
Foo a, b;
BOOST_TEST_EQUAL( a, b );
The class is defined as follows:
class Foo
{
private:
std::string data;
public:
Foo()
: data( "Testing 123" )
{}
Foo( Foo const& other )
{
data = other.data;
}
bool operator== ( Foo const& operand )
{
return data == operand.data;
}
};
Below is the error I'm getting. How can I make this work? I've truncated it
a little bit since it's insanely long:
1>c:\it\tfs\crusades\sdks\boost\boost\test\test_tools.hpp(342) : error
C2679: binary '<<' : no operator found which takes a right-hand operand of
type 'const Foo' (or there is no acceptable conversion)
1> c:\program files\microsoft visual studio
9.0\vc\include\ostream(653): could be 'std::basic_ostream<_Elem,_Traits>
&std::operator
<<