]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/core/test/swap/std_string.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / core / test / swap / std_string.cpp
1 // Copyright (c) 2008 Joseph Gauterin, Niels Dekker
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6
7 // Tests swapping std::string objects by means of boost::swap.
8 // std::string has its own std::swap overload.
9
10 #include <boost/utility/swap.hpp>
11 #include <boost/core/lightweight_test.hpp>
12 #define BOOST_CHECK BOOST_TEST
13 #define BOOST_CHECK_EQUAL BOOST_TEST_EQ
14
15 #include <string>
16
17 int main()
18 {
19 const std::string initial_value1 = "one";
20 const std::string initial_value2 = "two";
21
22 std::string object1 = initial_value1;
23 std::string object2 = initial_value2;
24
25 boost::swap(object1,object2);
26
27 BOOST_CHECK_EQUAL(object1,initial_value2);
28 BOOST_CHECK_EQUAL(object2,initial_value1);
29
30 return boost::report_errors();
31 }
32