]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/lexical_cast/test/lexical_cast_filesystem_test.cpp
1 // Unit test for boost::lexical_cast.
3 // See http://www.boost.org for most recent version, including documentation.
5 // Copyright Antony Polukhin, 2013.
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 lexical_cast usage with long filesystem::path. Bug 7704.
13 #include <boost/config.hpp>
15 #include <boost/test/unit_test.hpp>
16 #include <boost/lexical_cast.hpp>
17 #include <boost/filesystem/path.hpp>
19 using namespace boost
;
21 void test_filesystem();
23 unit_test::test_suite
*init_unit_test_suite(int, char *[])
25 unit_test::test_suite
*suite
=
26 BOOST_TEST_SUITE("lexical_cast unit test");
27 suite
->add(BOOST_TEST_CASE(&test_filesystem
));
32 void test_filesystem()
34 boost::filesystem::path p
;
35 std::string s1
= "aaaaaaaaaaaaaaaaaaaaaaa";
36 p
= boost::lexical_cast
<boost::filesystem::path
>(s1
);
37 BOOST_CHECK(!p
.empty());
38 BOOST_CHECK_EQUAL(p
, s1
);
41 const char ab
[] = "aaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
42 p
= boost::lexical_cast
<boost::filesystem::path
>(ab
);
43 BOOST_CHECK(!p
.empty());
44 BOOST_CHECK_EQUAL(p
, ab
);