]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/core/test/swap/std_string.cpp
1 // Copyright (c) 2008 Joseph Gauterin, Niels Dekker
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)
7 // Tests swapping std::string objects by means of boost::swap.
8 // std::string has its own std::swap overload.
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
19 const std::string initial_value1
= "one";
20 const std::string initial_value2
= "two";
22 std::string object1
= initial_value1
;
23 std::string object2
= initial_value2
;
25 boost::swap(object1
,object2
);
27 BOOST_CHECK_EQUAL(object1
,initial_value2
);
28 BOOST_CHECK_EQUAL(object2
,initial_value1
);
30 return boost::report_errors();