On Wed, 3 Aug 2011 17:02:07 -0400, Sean McBride wrote:
> I guess there are other problems that make this change insufficient
> to get more tests passing. :( I spent a little time looking at some
> the other failures. Here is a patch that removes some tests that
> undefined results anyway.
Some of those can be fixed, however.
For signed integer type T (with corresponding unsigned type UT) and T
tm = vnl_numeric_traits<T>::maxval, the test could be
T tmplusone = static_cast<T>( static_cast<UT>(tm) + 1 );
TEST("vnl_numeric_traits<T>::maxval must be the largest possible",
tmplusone <= tm, true);
The conversion to UT is well defined and preserves the value, the
increment is well-defined for unsigned type UT, then
a) either UT(tm) + 1 can still be represented as a T, then tmplusone
== tm + 1
b) or UT(tm) + 1 cannot be represented as a T, then the tmplusone is
implementation defined and <= tm.