]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Unit test for boost::lexical_cast. |
2 | // | |
3 | // See http://www.boost.org for most recent version, including documentation. | |
4 | // | |
f67539c2 | 5 | // Copyright Antony Polukhin, 2011-2020. |
7c673cae FG |
6 | // |
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). | |
10 | ||
11 | #include <boost/config.hpp> | |
12 | ||
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) | |
17 | #endif | |
18 | ||
19 | #include <boost/lexical_cast.hpp> | |
20 | ||
21 | #include <boost/test/unit_test.hpp> | |
22 | using namespace boost; | |
23 | ||
24 | void test_typedefed_wchar_t_runtime() | |
25 | { | |
26 | #ifndef BOOST_LCAST_NO_WCHAR_T | |
27 | #ifdef BOOST_MSVC | |
28 | BOOST_STATIC_ASSERT((boost::is_same<wchar_t, unsigned short>::value)); | |
29 | ||
30 | ||
31 | BOOST_CHECK_EQUAL(boost::lexical_cast<int>(L'A'), 65); | |
32 | BOOST_CHECK_EQUAL(boost::lexical_cast<int>(L'B'), 66); | |
33 | ||
34 | BOOST_CHECK_EQUAL(boost::lexical_cast<wchar_t>(L"65"), 65); | |
35 | BOOST_CHECK_EQUAL(boost::lexical_cast<wchar_t>(L"66"), 66); | |
36 | #endif | |
37 | #endif | |
38 | BOOST_CHECK(1); | |
39 | } | |
40 | ||
41 | unit_test::test_suite *init_unit_test_suite(int, char *[]) | |
42 | { | |
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)); | |
46 | ||
47 | return suite; | |
48 | } |