1 // Unit test for boost::lexical_cast.
3 // See http://www.boost.org for most recent version, including documentation.
5 // Copyright Antony Polukhin, 2011.
7 // Distributed under the Boost
8 // Software License, Version 1.0. (See accompanying file
9 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
11 #include <boost/config.hpp>
13 #if defined(__INTEL_COMPILER)
14 #pragma warning(disable: 193 383 488 981 1418 1419)
15 #elif defined(BOOST_MSVC)
16 #pragma warning(disable: 4097 4100 4121 4127 4146 4244 4245 4511 4512 4701 4800)
19 #include <boost/lexical_cast.hpp>
21 #include <boost/test/unit_test.hpp>
22 using namespace boost;
24 void test_typedefed_wchar_t_runtime()
26 #ifndef BOOST_LCAST_NO_WCHAR_T
28 BOOST_STATIC_ASSERT((boost::is_same<wchar_t, unsigned short>::value));
31 BOOST_CHECK_EQUAL(boost::lexical_cast<int>(L'A'), 65);
32 BOOST_CHECK_EQUAL(boost::lexical_cast<int>(L'B'), 66);
34 BOOST_CHECK_EQUAL(boost::lexical_cast<wchar_t>(L"65"), 65);
35 BOOST_CHECK_EQUAL(boost::lexical_cast<wchar_t>(L"66"), 66);
41 unit_test::test_suite *init_unit_test_suite(int, char *[])
43 unit_test::test_suite *suite =
44 BOOST_TEST_SUITE("lexical_cast typedefed wchar_t runtime test");
45 suite->add(BOOST_TEST_CASE(&test_typedefed_wchar_t_runtime));