Merge lexical_cast from trunk :

* force SunCC compiler to use fallback version of lexical_cast (with fallbak version SunCC can pass at least some tests)
* removed trailing whitespaces

[SVN r78565]
This commit is contained in:
Antony Polukhin
2012-05-24 04:22:04 +00:00
parent ca9c8d30bd
commit 79d6468aeb
11 changed files with 90 additions and 100 deletions
+5 -5
View File
@@ -11,20 +11,20 @@ import feature ;
project
: requirements
<library>/boost/test//boost_unit_test_framework
<link>static
<link>static
<toolset>gcc-4.8:<define>BOOST_STL_SUPPORTS_NEW_UNICODE_LOCALES
;
# Thanks to Steven Watanabe for helping with <nowchar> feature
# Thanks to Steven Watanabe for helping with <nowchar> feature
feature.feature nowchar : on :
composite optional propagated link-incompatible ;
feature.compose <nowchar>on : <cxxflags>/Zc:wchar_t- ;
test-suite conversion
: [ run implicit_cast.cpp ]
[ compile-fail implicit_cast_fail.cpp ]
[ run ../cast_test.cpp ]
[ run ../numeric_cast_test.cpp ]
[ run ../numeric_cast_test.cpp ]
[ run ../lexical_cast_test.cpp ]
[ run lexical_cast_loopback_test.cpp ]
[ run lexical_cast_abstract_test.cpp ]
@@ -39,7 +39,7 @@ test-suite conversion
[ compile lexical_cast_typedefed_wchar_test.cpp : <toolset>msvc:<nowchar>on ]
[ run lexical_cast_typedefed_wchar_test_runtime.cpp : : : <toolset>msvc:<nowchar>on <toolset>msvc,<stdlib>stlport:<build>no ]
[ run lexical_cast_no_locale_test.cpp : : : <define>BOOST_NO_STD_LOCALE <define>BOOST_LEXICAL_CAST_ASSUME_C_LOCALE ]
[ run lexical_cast_no_exceptions_test.cpp : : : <define>BOOST_NO_EXCEPTIONS
[ run lexical_cast_no_exceptions_test.cpp : : : <define>BOOST_NO_EXCEPTIONS
<toolset>gcc-4.3:<cflags>-fno-exceptions
<toolset>gcc-4.4:<cflags>-fno-exceptions
<toolset>gcc-4.5:<cflags>-fno-exceptions
+1 -1
View File
@@ -31,7 +31,7 @@ boost::unit_test::test_suite *init_unit_test_suite(int, char *[])
}
void testing_boost_containers_basic_string()
{
{
BOOST_CHECK("100" == lexical_cast<boost::container::string>("100"));
BOOST_CHECK(L"100" == lexical_cast<boost::container::wstring>(L"100"));
+1 -1
View File
@@ -237,7 +237,7 @@ void test_converion_to_float_types()
CHECK_CLOSE_ABS_DIFF(-10101.0E-011, test_t);
CHECK_CLOSE_ABS_DIFF(-10101093, test_t);
CHECK_CLOSE_ABS_DIFF(10101093, test_t);
CHECK_CLOSE_ABS_DIFF(-.34, test_t);
CHECK_CLOSE_ABS_DIFF(.34, test_t);
CHECK_CLOSE_ABS_DIFF(.34e10, test_t);
+6 -6
View File
@@ -138,7 +138,7 @@ void test_it_range_using_char(CharT* one, CharT* eleven)
#endif
}
void test_char_iterator_ranges()
void test_char_iterator_ranges()
{
typedef char test_char_type;
test_char_type data1[] = "1";
@@ -149,7 +149,7 @@ void test_char_iterator_ranges()
void test_unsigned_char_iterator_ranges()
void test_unsigned_char_iterator_ranges()
{
typedef unsigned char test_char_type;
test_char_type data1[] = "1";
@@ -158,7 +158,7 @@ void test_unsigned_char_iterator_ranges()
test_it_range_using_char(data1, data2);
}
void test_signed_char_iterator_ranges()
void test_signed_char_iterator_ranges()
{
typedef signed char test_char_type;
test_char_type data1[] = "1";
@@ -167,7 +167,7 @@ void test_signed_char_iterator_ranges()
test_it_range_using_char(data1, data2);
}
void test_wchar_iterator_ranges()
void test_wchar_iterator_ranges()
{
#ifndef BOOST_LCAST_NO_WCHAR_T
typedef wchar_t test_char_type;
@@ -179,7 +179,7 @@ void test_wchar_iterator_ranges()
BOOST_CHECK(true);
}
void test_char16_iterator_ranges()
void test_char16_iterator_ranges()
{
#if !defined(BOOST_NO_CHAR16_T) && !defined(BOOST_NO_UNICODE_LITERALS)
typedef char16_t test_char_type;
@@ -191,7 +191,7 @@ void test_char16_iterator_ranges()
BOOST_CHECK(true);
}
void test_char32_iterator_ranges()
void test_char32_iterator_ranges()
{
#if !defined(BOOST_NO_CHAR32_T) && !defined(BOOST_NO_UNICODE_LITERALS)
typedef char32_t test_char_type;
+7 -7
View File
@@ -22,7 +22,7 @@
#ifndef BOOST_NO_EXCEPTIONS
#error "This test must be compiled with -DBOOST_NO_EXCEPTIONS"
#endif
#endif
bool g_was_exception = false;
@@ -60,25 +60,25 @@ inline std::istream& operator>> (std::istream& i, Escape& rhs)
void test_exceptions_off()
{
Escape v("");
g_was_exception = false;
g_was_exception = false;
lexical_cast<char>(v);
BOOST_CHECK(g_was_exception);
g_was_exception = false;
lexical_cast<unsigned char>(v);
BOOST_CHECK(g_was_exception);
v = lexical_cast<Escape>(100);
BOOST_CHECK_EQUAL(lexical_cast<int>(v), 100);
BOOST_CHECK_EQUAL(lexical_cast<unsigned int>(v), 100u);
v = lexical_cast<Escape>(0.0);
BOOST_CHECK_EQUAL(lexical_cast<double>(v), 0.0);
BOOST_CHECK_EQUAL(lexical_cast<short>(100), 100);
BOOST_CHECK_EQUAL(lexical_cast<float>(0.0), 0.0);
g_was_exception = false;
lexical_cast<short>(700000);
BOOST_CHECK(g_was_exception);
+5 -5
View File
@@ -23,12 +23,12 @@
using namespace boost;
// Testing compilation and some basic usage with BOOST_NO_STD_LOCALE
// Tests are mainly copyied from lexical_cast_empty_input_test.cpp (something
// Tests are mainly copyied from lexical_cast_empty_input_test.cpp (something
// new added to test_empty_3)
#ifndef BOOST_NO_STD_LOCALE
#error "This test must be compiled with -DBOOST_NO_STD_LOCALE"
#endif
#endif
template <class T>
@@ -106,15 +106,15 @@ void test_empty_3()
{
Escape v("");
do_test_on_empty_input(v);
BOOST_CHECK_THROW(lexical_cast<char>(v), bad_lexical_cast);
BOOST_CHECK_THROW(lexical_cast<unsigned char>(v), bad_lexical_cast);
BOOST_CHECK_THROW(lexical_cast<signed char>(v), bad_lexical_cast);
v = lexical_cast<Escape>(100);
BOOST_CHECK_EQUAL(lexical_cast<int>(v), 100);
BOOST_CHECK_EQUAL(lexical_cast<unsigned int>(v), 100u);
v = lexical_cast<Escape>(0.0);
BOOST_CHECK_EQUAL(lexical_cast<double>(v), 0.0);
}
@@ -30,7 +30,7 @@ void test_typedefed_wchar_t_runtime()
BOOST_CHECK_EQUAL(boost::lexical_cast<int>(L'A'), 65);
BOOST_CHECK_EQUAL(boost::lexical_cast<int>(L'B'), 66);
BOOST_CHECK_EQUAL(boost::lexical_cast<wchar_t>(L"65"), 65);
BOOST_CHECK_EQUAL(boost::lexical_cast<wchar_t>(L"66"), 66);
#endif