|
Boost Testing : |
Subject: Re: [Boost-testing] BOOST_CHECK_EQUAL on user-defined type
From: Jaros³aw Bober (jaroslaw.bober_at_[hidden])
Date: 2011-11-13 13:53:06
Thank you Gennadiy, now it works like it should :)
Regards
2011/11/13 Gennadiy Rozental <rogeeff_at_[hidden]>
> Jaros³aw Bober <jaroslaw.bober <at> gmail.com> writes:
>
> > I have a question. Is there possibility that in results
> > i'll see only those members that failed assertion?
> > like [expected.b: 1 != received.b: 2]
> > without having to manually search for failed member?Regards
>
> What you can do is to implement custom comparator which returns
> predicate_result. Something like this:
>
> bool compare(MyClass const& expected, MyClass const& received)
> {
> if(expected.a != received.a) {
> predicate_result res( false );
> res.message() << "Difference in field a: " << expected.a << ", "
> received.a;
> }
>
> if(expected.b != received.b) {
> predicate_result res( false );
> res.message() << "Difference in field b: " << expected.b << ", "
> received.b;
> }
>
> return true;
> }
>
> Gennadiy
>
> _______________________________________________
> Boost-Testing mailing list
> Boost-Testing_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-testing