]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/core/test/swap/specialized_in_other.cpp
1 // Copyright (c) 2007 Joseph Gauterin
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 #include <boost/utility/swap.hpp>
8 #include <boost/core/lightweight_test.hpp>
9 #define BOOST_CHECK BOOST_TEST
10 #define BOOST_CHECK_EQUAL BOOST_TEST_EQ
12 //Put test class in namespace other
15 #include "./swap_test_class.hpp"
18 //Provide swap function in namespace other
21 void swap(swap_test_class
& left
, swap_test_class
& right
)
29 const other::swap_test_class
initial_value1(1);
30 const other::swap_test_class
initial_value2(2);
32 other::swap_test_class object1
= initial_value1
;
33 other::swap_test_class object2
= initial_value2
;
35 other::swap_test_class::reset();
36 boost::swap(object1
,object2
);
38 BOOST_CHECK(object1
== initial_value2
);
39 BOOST_CHECK(object2
== initial_value1
);
41 BOOST_CHECK_EQUAL(other::swap_test_class::swap_count(),1);
42 BOOST_CHECK_EQUAL(other::swap_test_class::copy_count(),0);
44 return boost::report_errors();