Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-03-18 18:12:26


>From: "Rozental, Gennadiy" <gennadiy.rozental_at_[hidden]>

> > lexical_cast_test.cpp(105): error in
> > "test_conversion_to_intr": exception
> > boost::bad_lexical_cast is expected
> > lexical_cast_test.cpp(111): error in
> > "test_conversion_to_intr": exception
> > boost::bad_lexical_cast is expected
> > lexical_cast_test.cpp(147): error in
> > "test_conversion_to_boolle": exception
> > boost::bad_lexical_cast is expected
> >
> > Notice the weird misspellings in the error messages. :)
>
> What do you mean?

"boolle" and "intr"? :)

Could this be a problem in the unit test framework?

> > Also these three tests, like MSVC 6, concerns tests where it
> > doesn't throw
> > when it's supposed to:
> >
> > BOOST_CHECK_THROW(lexical_cast<int>(" 123"), boost::bad_lexical_cast);
> > BOOST_CHECK_THROW(lexical_cast<int>(std::string(" 123")),
> > boost::bad_lexical_cast);
> > BOOST_CHECK_THROW(lexical_cast<bool>(123), boost::bad_lexical_cast);
> >
> > If these are omitted for g++ 2.95.x, all tests pass for that compiler.
> > However, as it compiles without errors on both MSVC 6 and g++
> > 2.95.x, maybe
> > one shouldn't have any BOOST_WORKAROUND's in the test code?
> >
> > That will make it show up as failing on MSVC 6 and g++
> > 2.95.x, even though
> > it passes almost all the enabled tests on both.
>
> You could use expected failures feature of Boost.Test

Aha. That could be an odd test, though: Ensuring that a bug is there. :) One
thing is to test for something that is supposed to fail, or throw an
exception, on a conforming compiler. However, using the same mechanism to
make tests pass, which are really failing, seems like a strange use of that
feature.

It isn't clear to me that this improves the situation over BOOST_WORKAROUND,
and may instead obfuscate it, as someone reading the code might not know
whether a fail-test is to test conformance, or to allow a bug.

Regards,

Terje


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