Boost logo

Boost Users :

Subject: [Boost-users] [Test] data_access_test && common_layer::const_string && missing std::out_of_range exception
From: Dmitry V. Krivenok (krivenok_at_[hidden])
Date: 2009-09-01 09:30:50


Hello!

I'm trying to build boost-1.40.0 and have problems with Boost::Test.
Please take a look at build log:

------------------------------------------------------------------------

common.mkdir
/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test
common.mkdir
/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4
common.mkdir
/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug
gcc.compile.c++
/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug/const_string_test.o
gcc.link
/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug/const_string_test
testing.capture-output
/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug/const_string_test.run
====== BEGIN OUTPUT ======
Running 6 test cases...
../../libs/test/example/const_string_test.cpp(71): error in
"data_access_test": exception std::out_of_range is expected

*** 1 failure detected in test suite "const_string test"

EXIT STATUS: 201
====== END OUTPUT ======

 
LD_LIBRARY_PATH="/usr/local/bin:/usr/local/lib:/usr/local/lib32:/usr/local/lib64:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH

 
"/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug/const_string_test"
>
"/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug/const_string_test.output"
2>&1
     status=$?
     echo >>
"/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug/const_string_test.output"
     echo EXIT STATUS: $status >>
"/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug/const_string_test.output"
     if test $status -eq 0 ; then
         cp
"/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug/const_string_test.output"
"/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug/const_string_test.run"
     fi
     verbose=0
     if test $status -ne 0 ; then
         verbose=1
     fi
     if test $verbose -eq 1 ; then
         echo ====== BEGIN OUTPUT ======
         cat
"/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug/const_string_test.output"
         echo ====== END OUTPUT ======
     fi
     exit $status

...failed testing.capture-output
/home/krivenok/dev_builds/boost_1_40_0_build/boost/bin.v2/libs/test/example/const_string_test.test/gcc-4.4/debug/const_string_test.run...
...failed updating 1 target...
...updated 174 targets...

------------------------------------------------------------------------

The problem is:

../../libs/test/example/const_string_test.cpp(71): error in
"data_access_test": exception std::out_of_range is expected

I looked at line 71 in const_string_test.cpp:
BOOST_CHECK_THROW( cs1.at( cs1.length() ), std::out_of_range );

This code is used to ensure that std::out_of_range is thrown in case of
out of bound access to the string.

However, common_layer::const_string doesn't provide such validation.

operator[] and at() are identical in const_string:

char operator[]( size_t index ) const { return m_begin[index]; }
char at( size_t index ) const { return m_begin[index]; }

I commented BOOST_CHECK_THROW out and now Boost::Test compiles w/o any
errors.

I think implementation of const_string::at() should be fixed.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net