[Test] data_access_test && common_layer::const_string && missing std::out_of_range exception

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.

Dmitry V. Krivenok
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.
You are right. But this is just an example. example class and example test. This class is not used inside Boost.Test. It may even be good that it fails. It shows that we are in a middle of testing and some failure is still to be fixed. ;o) I'll see. Maybe I fix it. Gennadiy
participants (2)
-
Dmitry V. Krivenok
-
Gennadiy Rozental