Boost logo

Boost :

Subject: Re: [boost] Boost.Test v3 is here
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-06-01 23:04:56

On 31/05/2015 22:48, Rob Stewart wrote:
> On May 31, 2015 1:08:09 AM EDT, Gennadiy Rozental <rogeeff_at_[hidden]> wrote:
>> Apparently most types are streamable.
> I wouldn't assume that.

I often define stream operators in the unit tests rather than in the
"real" code for types that I do not intend to be streamable in practice
but for which I want to have useful error messages printed on test failure.

Occasionally that leads me to move the operator into the real code later
on, when it turns out that I also want to log it or something.

(This is regardless of which unit test framework is in use -- when
printing equality failures, most use either operator<< or some custom
specializable/overridable method that usually falls back to operator<<
if not otherwise overridden.)

There are of course lots of types that it doesn't make sense to ever
stream (because they're not value-like), but those rarely implement
operator== either, so it's not an issue.

Boost list run by bdawes at, gregod at, cpdaniel at, john at