Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76817 - trunk/libs/conversion/test
From: antoshkka_at_[hidden]
Date: 2012-01-31 23:22:22


Author: apolukhin
Date: 2012-01-31 23:22:21 EST (Tue, 31 Jan 2012)
New Revision: 76817
URL: http://svn.boost.org/trac/boost/changeset/76817

Log:
Added tests for ticket #6453
Text files modified:
   trunk/libs/conversion/test/lexical_cast_containers_test.cpp | 22 ++++++++++++++++++++++
   1 files changed, 22 insertions(+), 0 deletions(-)

Modified: trunk/libs/conversion/test/lexical_cast_containers_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_containers_test.cpp (original)
+++ trunk/libs/conversion/test/lexical_cast_containers_test.cpp 2012-01-31 23:22:21 EST (Tue, 31 Jan 2012)
@@ -13,6 +13,7 @@
 #include <boost/container/string.hpp>
 
 void testing_boost_containers_basic_string();
+void testing_boost_containers_string_std_string();
 
 using namespace boost;
 
@@ -21,6 +22,7 @@
     unit_test::test_suite *suite =
         BOOST_TEST_SUITE("Testing boost::lexical_cast with boost::container::string");
     suite->add(BOOST_TEST_CASE(testing_boost_containers_basic_string));
+ suite->add(BOOST_TEST_CASE(testing_boost_containers_string_std_string));
 
     return suite;
 }
@@ -35,4 +37,24 @@
     BOOST_CHECK(1000 == lexical_cast<int>(str));
 }
 
+#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
+#define BOOST_LCAST_NO_WCHAR_T
+#endif
 
+void testing_boost_containers_string_std_string()
+{
+ std::string std_str("std_str");
+ boost::container::string boost_str("boost_str");
+ BOOST_CHECK(boost::lexical_cast<std::string>(boost_str) == "boost_str");
+ BOOST_CHECK(boost::lexical_cast<boost::container::string>(std_str) == "std_str");
+
+#ifndef BOOST_LCAST_NO_WCHAR_T
+ std::wstring std_wstr(L"std_wstr");
+ boost::container::wstring boost_wstr(L"boost_wstr");
+
+ BOOST_CHECK(boost::lexical_cast<std::wstring>(boost_wstr) == L"boost_wstr");
+ BOOST_CHECK(boost::lexical_cast<boost::container::wstring>(std_wstr) == L"std_wstr");
+
+#endif
+
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk