Boost logo

Boost :

Subject: Re: [boost] Unittest capability for meta-programs feedback request
From: Ben Robinson (icaretaker_at_[hidden])
Date: 2011-09-29 02:46:26


On Wed, Sep 28, 2011 at 7:22 AM, Steven Watanabe <watanabesj_at_[hidden]>wrote:

> AMDG
>
> Unfortunately, this changes the behavior of
> the library. is_convertible<Q1, Q2> will return
> true if the units are unrelated. It can also
> change the result of overload resolution.
>
> Well I certainly don't want to break the library! It was not a wise choice
to change the implementation of a published library, to demonstrate the use
of METATEST. I will work on other examples in published libraries over the
weekend. I did however, hopefully at least demonstrate the idea, that
should a complex library contain a METATEST, it could be successfully unit
tested to prove the assertion is true, and false, when expected to be.

As far as is_convertible goes, the following unit test is failing using a
completely unmodified boost distribution:

BOOST_AUTO_TEST_CASE(failing_convertible_units) {
    bool result = is_convertible<length, energy>::value;
    BOOST_CHECK_EQUAL(result, false);
}

Since length and energy are incompatible units, shouldn't is_convertible
fail? I could certainly learn much more about both is_convertible and
boost::units.

As far as units::quantity goes, I think that overload resolution could
possibly be managed inside the added conversion constructor, with a
meta-function testing if the rhs_type would have been implicitly convertible
to this_type, and to METATEST on that condition. I am curious of your
opinion on this, since you certainly know more about this library than I.

Thank you,

Ben Robinson, Ph.D.

In Christ,
> Steven Watanabe
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk