Hi, Is there a way to get the funcationality of BOOST_CHECK_EQUAL when I want to test that two parameters are not equal to each other? I like the way BOOST_CHECK_EQUAL allow me to see the mismatched runtime values. I have been creating a custom message for BOOST_CHECK_MESSAGE to achieve this functionality, but it would be nicer if there was an automated way to do it. Thanks, Ed Johnson
"Ed Johnson"
Hi,
Is there a way to get the funcationality of BOOST_CHECK_EQUAL when I want to test that two parameters are not equal to each other? I like the way BOOST_CHECK_EQUAL allow me to see the mismatched runtime values.
BOOST_CHECK_PREDICATE( std::not_equal_to<T>, (a)(b) ); Gennadiy
Gennadiy Rozental wrote:
"Ed Johnson"
wrote in message news:e5qld2$nh0$1@sea.gmane.org... Hi,
Is there a way to get the funcationality of BOOST_CHECK_EQUAL when I want to test that two parameters are not equal to each other? I like the way BOOST_CHECK_EQUAL allow me to see the mismatched runtime values.
BOOST_CHECK_PREDICATE( std::not_equal_to<T>, (a)(b) );
Gennadiy
great, Thank you! and for completeness, there needs to be an additional () in order to compile: BOOST_CHECK_PREDICATE( std::not_equal_to<T>(), (a)(b) ); BOOST_CHECK_PREDICATE( std::not_equal_to<int>(), (3)(3) );
What would you propose for floating-point comparisons?
On 6/2/06, Gennadiy Rozental
"Ed Johnson"
wrote in message news:e5qld2$nh0$1@sea.gmane.org... Hi,
Is there a way to get the funcationality of BOOST_CHECK_EQUAL when I want to test that two parameters are not equal to each other? I like the way BOOST_CHECK_EQUAL allow me to see the mismatched runtime values.
BOOST_CHECK_PREDICATE( std::not_equal_to<T>, (a)(b) );
Gennadiy
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
"Pierre-Jules Tremblay"
What would you propose for floating-point comparisons?
BOOST_CHECK_CLOSE - checks that two FP values relative difference doesn't exceed specified percent. BOOST_CHECK_CLOSE_FRACTION - checks that two FP values relative difference doesn't exceed specified value BOOST_CHECK_SMALL - checks that module of particular value doesn't exceed tolerance value Gennadiy
Right.
I meant what would you propose for checking inequality for
floating-point types? Similar to the original poster asking for
BOOST_CHECK_NOT_EQUAL(), what I'm asking about is a
BOOST_CHECK_NOT_CLOSE() or BOOST_CHECK_NOT_SMALL() which would use the
appropriate tolerance algorithm.
Is there a way of getting this kind of result with the current tools?
On 6/8/06, Gennadiy Rozental
"Pierre-Jules Tremblay"
wrote in message news:4590bfef0606080504m24a76fffi9a7b2883f56c37b0@mail.gmail.com... What would you propose for floating-point comparisons?
BOOST_CHECK_CLOSE - checks that two FP values relative difference doesn't exceed specified percent. BOOST_CHECK_CLOSE_FRACTION - checks that two FP values relative difference doesn't exceed specified value BOOST_CHECK_SMALL - checks that module of particular value doesn't exceed tolerance value
Gennadiy
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
"Pierre-Jules Tremblay"
Right.
I meant what would you propose for checking inequality for floating-point types? Similar to the original poster asking for BOOST_CHECK_NOT_EQUAL(), what I'm asking about is a BOOST_CHECK_NOT_CLOSE() or BOOST_CHECK_NOT_SMALL() which would use the appropriate tolerance algorithm.
Is there a way of getting this kind of result with the current tools?
using namespace std; using namespace boost::test_tools; BOOST_CHECK_PREDICATE( not( check_is_close ), (a)(b)(percent_tolerance(t)) ); BOOST_CHECK_PREDICATE( not( check_is_close ), (a)(b)(fraction_tolerance(t)) ); BOOST_CHECK_PREDICATE( not( check_is_small ), (a)(t) ); Gennadiy
Genadiy, Gennadiy Rozental wrote:
"Ed Johnson"
wrote in message news:e5qld2$nh0$1@sea.gmane.org... Hi,
Is there a way to get the funcationality of BOOST_CHECK_EQUAL when I want to test that two parameters are not equal to each other? I like the way BOOST_CHECK_EQUAL allow me to see the mismatched runtime values.
BOOST_CHECK_PREDICATE( std::not_equal_to<T>, (a)(b) );
I thought we agreed that you would make all these available as easy-to use macros? Also for version taking a Range. -Thorsten
"Thorsten Ottosen"
Is there a way to get the funcationality of BOOST_CHECK_EQUAL when I want to test that two parameters are not equal to each other? I like the way BOOST_CHECK_EQUAL allow me to see the mismatched runtime values.
BOOST_CHECK_PREDICATE( std::not_equal_to<T>, (a)(b) );
I thought we agreed that you would make all these available as easy-to use macros?
I didn't have record of this, but I am ready to reconsider this after release. My personal opinion is that above is not that wordy to warant huge number of extra tools for all possible simple predicates. On the other hand <functional> have predicate for each one. I would like to hear users input on this one.
Also for version taking a Range.
The same here. Gennadiy
Gennadiy Rozental wrote:
"Thorsten Ottosen"
wrote in message news:44881F97.8050803@dezide.com... Is there a way to get the funcationality of BOOST_CHECK_EQUAL when I want to test that two parameters are not equal to each other? I like the way BOOST_CHECK_EQUAL allow me to see the mismatched runtime values.
BOOST_CHECK_PREDICATE( std::not_equal_to<T>, (a)(b) );
I thought we agreed that you would make all these available as easy-to use macros?
I didn't have record of this,
I do.
but I am ready to reconsider this after release. My personal opinion is that above is not that wordy to warant huge number of extra tools for all possible simple predicates. On the other hand <functional> have predicate for each one. I would like to hear users input on this one.
Well, we were several people back then who wanted it. -Thorsten
"Thorsten Ottosen"
Gennadiy Rozental wrote:
"Thorsten Ottosen"
wrote in message news:44881F97.8050803@dezide.com... Is there a way to get the funcationality of BOOST_CHECK_EQUAL when I want to test that two parameters are not equal to each other? I like the way BOOST_CHECK_EQUAL allow me to see the mismatched runtime values.
BOOST_CHECK_PREDICATE( std::not_equal_to<T>, (a)(b) );
I thought we agreed that you would make all these available as easy-to use macros?
I didn't have record of this,
I do.
but I am ready to reconsider this after release. My personal opinion is that above is not that wordy to warant huge number of extra tools for all possible simple predicates. On the other hand <functional> have predicate for each one. I would like to hear users input on this one.
Well, we were several people back then who wanted it.
Could you please bring this issue up again on main list once 1.34 is shipped or you prefer me to do this? Gennadiy
-Thorsten
Gennadiy Rozental wrote:
but I am ready to reconsider this after release. My personal opinion is that above is not that wordy to warant huge number of extra tools for all possible simple predicates. On the other hand <functional> have predicate for each one. I would like to hear users input on this one.
Well, we were several people back then who wanted it.
Could you please bring this issue up again on main list once 1.34 is shipped or you prefer me to do this?
I can do that. -Thorsten
participants (4)
-
Ed Johnson
-
Gennadiy Rozental
-
Pierre-Jules Tremblay
-
Thorsten Ottosen