1
0
forked from boostorg/core

Added extra checks, checking that boost::swap does correctly exchange the values of its arguments, as I mentioned at "Re: [boost] [swap] Renaming boost_swap_impl::swap_impl and/or its namespace?", http://lists.boost.org/Archives/boost/2008/08/141027.php

[SVN r48246]
This commit is contained in:
Niels Dekker
2008-08-20 08:28:35 +00:00
committed by Andrey Semashev
parent 3179176c59
commit e3b6996fb2
9 changed files with 83 additions and 18 deletions

View File

@@ -24,10 +24,18 @@ namespace std
int test_main(int, char*[])
{
swap_test_class object1;
swap_test_class object2;
const swap_test_class initial_value1(1);
const swap_test_class initial_value2(2);
swap_test_class object1 = initial_value1;
swap_test_class object2 = initial_value2;
swap_test_class::reset();
boost::swap(object1,object2);
BOOST_CHECK(object1 == initial_value2);
BOOST_CHECK(object2 == initial_value1);
BOOST_CHECK_EQUAL(swap_test_class::swap_count(),1);
BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0);