1 // Unit test for boost::lexical_cast.
3 // See http://www.boost.org for most recent version, including documentation.
5 // Copyright Alexander Nasonov, 2007.
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 // Test that Source can be non-copyable.
13 #include <boost/config.hpp>
15 #if defined(__INTEL_COMPILER)
16 #pragma warning(disable: 193 383 488 981 1418 1419)
17 #elif defined(BOOST_MSVC)
18 #pragma warning(disable: 4097 4100 4121 4127 4146 4244 4245 4511 4512 4701 4800)
21 #include <boost/lexical_cast.hpp>
22 #include <boost/noncopyable.hpp>
23 #include <boost/test/unit_test.hpp>
25 using namespace boost;
27 void test_noncopyable();
29 unit_test::test_suite *init_unit_test_suite(int, char *[])
31 unit_test::test_suite *suite =
32 BOOST_TEST_SUITE("lexical_cast unit test");
33 suite->add(BOOST_TEST_CASE(&test_noncopyable));
38 class Noncopyable : private boost::noncopyable
44 inline std::ostream &operator<<(std::ostream &out, const Noncopyable&)
46 return out << "Noncopyable";
49 void test_noncopyable()
52 BOOST_CHECK(boost::lexical_cast<std::string>(x) == "Noncopyable");