merge changes from the main trunk to get in sync with the header

[SVN r19669]
This commit is contained in:
Aleksey Gurtovoy
2003-08-17 21:02:53 +00:00
parent 3804825f6c
commit f0c79866ad

View File

@@ -25,8 +25,7 @@
#if defined(BOOST_NO_STRINGSTREAM) || \ #if defined(BOOST_NO_STRINGSTREAM) || \
defined(BOOST_NO_STD_WSTRING) || \ defined(BOOST_NO_STD_WSTRING) || \
defined(BOOST_NO_STD_LOCALE) || \ defined(BOOST_NO_STD_LOCALE) || \
defined(BOOST_NO_CWCHAR) || \ defined(BOOST_NO_INTRINSIC_WCHAR_T)
defined(BOOST_MSVC) && (BOOST_MSVC <= 1200)
#define DISABLE_WIDE_CHAR_SUPPORT #define DISABLE_WIDE_CHAR_SUPPORT
#endif #endif
@@ -37,6 +36,7 @@ void test_conversion_to_int();
void test_conversion_to_double(); void test_conversion_to_double();
void test_conversion_to_bool(); void test_conversion_to_bool();
void test_conversion_to_string(); void test_conversion_to_string();
void test_conversion_from_to_wchar_t_alias();
void test_conversion_to_pointer(); void test_conversion_to_pointer();
void test_conversion_from_wchar_t(); void test_conversion_from_wchar_t();
void test_conversion_to_wchar_t(); void test_conversion_to_wchar_t();
@@ -51,6 +51,7 @@ unit_test_framework::test_suite *init_unit_test_suite(int, char **)
suite->add(BOOST_TEST_CASE(test_conversion_to_int)); suite->add(BOOST_TEST_CASE(test_conversion_to_int));
suite->add(BOOST_TEST_CASE(test_conversion_to_double)); suite->add(BOOST_TEST_CASE(test_conversion_to_double));
suite->add(BOOST_TEST_CASE(test_conversion_to_bool)); suite->add(BOOST_TEST_CASE(test_conversion_to_bool));
suite->add(BOOST_TEST_CASE(test_conversion_from_to_wchar_t_alias));
suite->add(BOOST_TEST_CASE(test_conversion_to_pointer)); suite->add(BOOST_TEST_CASE(test_conversion_to_pointer));
suite->add(BOOST_TEST_CASE(test_conversion_to_string)); suite->add(BOOST_TEST_CASE(test_conversion_to_string));
#ifndef DISABLE_WIDE_CHAR_SUPPORT #ifndef DISABLE_WIDE_CHAR_SUPPORT
@@ -180,6 +181,17 @@ void test_conversion_to_string()
BOOST_CHECK_EQUAL("", lexical_cast<std::string>(std::string(""))); BOOST_CHECK_EQUAL("", lexical_cast<std::string>(std::string("")));
} }
void test_conversion_from_to_wchar_t_alias()
{
BOOST_CHECK_EQUAL(123u, lexical_cast<unsigned short>("123"));
BOOST_CHECK_EQUAL(123u, lexical_cast<unsigned int>("123"));
BOOST_CHECK_EQUAL(123u, lexical_cast<unsigned long>("123"));
BOOST_CHECK_EQUAL(std::string("123"),
lexical_cast<std::string>(static_cast<unsigned short>(123)));
BOOST_CHECK_EQUAL(std::string("123"), lexical_cast<std::string>(123u));
BOOST_CHECK_EQUAL(std::string("123"), lexical_cast<std::string>(123ul));
}
void test_conversion_to_pointer() void test_conversion_to_pointer()
{ {
BOOST_CHECK_THROW(lexical_cast<char *>("Test"), boost::bad_lexical_cast); BOOST_CHECK_THROW(lexical_cast<char *>("Test"), boost::bad_lexical_cast);