diff --git a/swap/test/lib_header_1.cpp b/swap/test/lib_header_1.cpp index ea7c99a..d3efc63 100644 --- a/swap/test/lib_header_1.cpp +++ b/swap/test/lib_header_1.cpp @@ -6,13 +6,4 @@ // Tests that the swap header compiles as a standalone translation unit -#include -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Tests that the swap header compiles as a standalone translation unit - -#include +#include \ No newline at end of file diff --git a/swap/test/lib_header_2.cpp b/swap/test/lib_header_2.cpp index 0c9e409..e88909d 100644 --- a/swap/test/lib_header_2.cpp +++ b/swap/test/lib_header_2.cpp @@ -8,13 +8,4 @@ #include #include -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// Tests that the swap header include guards work correctly - -#include -#include diff --git a/swap/test/mixed_headers_1.cpp b/swap/test/mixed_headers_1.cpp index 0c7571e..cdb9fe5 100644 --- a/swap/test/mixed_headers_1.cpp +++ b/swap/test/mixed_headers_1.cpp @@ -8,13 +8,4 @@ #include #include -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// Tests that the swap headers work when both are included - -#include -#include diff --git a/swap/test/mixed_headers_2.cpp b/swap/test/mixed_headers_2.cpp index 217873a..94e9d87 100644 --- a/swap/test/mixed_headers_2.cpp +++ b/swap/test/mixed_headers_2.cpp @@ -8,13 +8,5 @@ #include #include -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// Tests that the swap headers work when both are included -#include -#include diff --git a/swap/test/primitive.cpp b/swap/test/primitive.cpp index 76cd7b0..380edb3 100644 --- a/swap/test/primitive.cpp +++ b/swap/test/primitive.cpp @@ -20,25 +20,4 @@ int test_main(int, char*[]) return 0; } -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include -#define BOOST_INCLUDE_MAIN -#include - -int test_main(int, char*[]) -{ - int object1 = 1; - int object2 = 2; - - boost::swap(object1,object2); - - BOOST_CHECK_EQUAL(object1,2); - BOOST_CHECK_EQUAL(object2,1); - - return 0; -} diff --git a/swap/test/root_header_1.cpp b/swap/test/root_header_1.cpp index efa0028..575d2cb 100644 --- a/swap/test/root_header_1.cpp +++ b/swap/test/root_header_1.cpp @@ -7,12 +7,4 @@ // Tests that the swap header compiles as a standalone translation unit #include -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// Tests that the swap header compiles as a standalone translation unit - -#include diff --git a/swap/test/root_header_2.cpp b/swap/test/root_header_2.cpp index d7e00f3..d26b3a6 100644 --- a/swap/test/root_header_2.cpp +++ b/swap/test/root_header_2.cpp @@ -8,13 +8,4 @@ #include #include -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// Tests that the swap header include guards work correctly - -#include -#include diff --git a/swap/test/specialized_in_boost.cpp b/swap/test/specialized_in_boost.cpp index bc3840f..55ac390 100644 --- a/swap/test/specialized_in_boost.cpp +++ b/swap/test/specialized_in_boost.cpp @@ -34,39 +34,4 @@ int test_main(int, char*[]) return 0; } -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include -#define BOOST_INCLUDE_MAIN -#include - -//Put test class in namespace boost -namespace boost -{ - #include "./swap_test_class.hpp" -} - -//Provide swap function in namespace boost -namespace boost -{ - void swap(swap_test_class& left, swap_test_class& right) - { - left.swap(right); - } -} - -int test_main(int, char*[]) -{ - boost::swap_test_class object1; - boost::swap_test_class object2; - boost::swap(object1,object2); - - BOOST_CHECK_EQUAL(boost::swap_test_class::swap_count(),1); - BOOST_CHECK_EQUAL(boost::swap_test_class::copy_count(),0); - - return 0; -} diff --git a/swap/test/specialized_in_global.cpp b/swap/test/specialized_in_global.cpp index 7f46187..f76754f 100644 --- a/swap/test/specialized_in_global.cpp +++ b/swap/test/specialized_in_global.cpp @@ -28,33 +28,4 @@ int test_main(int, char*[]) return 0; } -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include -#define BOOST_INCLUDE_MAIN -#include - -//Put test class in the global namespace -#include "./swap_test_class.hpp" - -//Provide swap function in gloabl namespace -void swap(swap_test_class& left, swap_test_class& right) -{ - left.swap(right); -} - -int test_main(int, char*[]) -{ - swap_test_class object1; - swap_test_class object2; - boost::swap(object1,object2); - - BOOST_CHECK_EQUAL(swap_test_class::swap_count(),1); - BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0); - - return 0; -} diff --git a/swap/test/specialized_in_other.cpp b/swap/test/specialized_in_other.cpp index 7dccab4..c3071f5 100644 --- a/swap/test/specialized_in_other.cpp +++ b/swap/test/specialized_in_other.cpp @@ -34,39 +34,4 @@ int test_main(int, char*[]) return 0; } -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include -#define BOOST_INCLUDE_MAIN -#include - -//Put test class in namespace other -namespace other -{ - #include "./swap_test_class.hpp" -} - -//Provide swap function in namespace other -namespace other -{ - void swap(swap_test_class& left, swap_test_class& right) - { - left.swap(right); - } -} - -int test_main(int, char*[]) -{ - other::swap_test_class object1; - other::swap_test_class object2; - boost::swap(object1,object2); - - BOOST_CHECK_EQUAL(other::swap_test_class::swap_count(),1); - BOOST_CHECK_EQUAL(other::swap_test_class::copy_count(),0); - - return 0; -} diff --git a/swap/test/specialized_in_std.cpp b/swap/test/specialized_in_std.cpp index c6effb0..641aa82 100644 --- a/swap/test/specialized_in_std.cpp +++ b/swap/test/specialized_in_std.cpp @@ -33,38 +33,4 @@ int test_main(int, char*[]) return 0; } -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include -#define BOOST_INCLUDE_MAIN -#include - -//Put test class in the global namespace -#include "./swap_test_class.hpp" - - -//Provide swap function in namespace std -namespace std -{ - template <> - void swap(swap_test_class& left, swap_test_class& right) - { - left.swap(right); - } -} - -int test_main(int, char*[]) -{ - swap_test_class object1; - swap_test_class object2; - boost::swap(object1,object2); - - BOOST_CHECK_EQUAL(swap_test_class::swap_count(),1); - BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0); - - return 0; -} diff --git a/swap/test/swap_arrays.cpp b/swap/test/swap_arrays.cpp index f032f5b..96b7939 100644 --- a/swap/test/swap_arrays.cpp +++ b/swap/test/swap_arrays.cpp @@ -37,42 +37,4 @@ int test_main(int, char*[]) return 0; } -// Copyright (c) 2008 Joseph Gauterin, Niels Dekker -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include -#define BOOST_INCLUDE_MAIN -#include - -//Put test class in the global namespace -#include "./swap_test_class.hpp" - - -int test_main(int, char*[]) -{ - const std::size_t dimension = 7; - - swap_test_class array1[dimension]; - swap_test_class array2[dimension]; - boost::swap(array1, array2); - - BOOST_CHECK_EQUAL(swap_test_class::swap_count(), dimension); - BOOST_CHECK_EQUAL(swap_test_class::copy_count(), 0); - - swap_test_class::reset(); - - const std::size_t firstDimension = 3; - const std::size_t secondDimension = 4; - - swap_test_class two_d_array1[firstDimension][secondDimension]; - swap_test_class two_d_array2[firstDimension][secondDimension]; - boost::swap(two_d_array1, two_d_array1); - - BOOST_CHECK_EQUAL(swap_test_class::swap_count(), firstDimension*secondDimension); - BOOST_CHECK_EQUAL(swap_test_class::copy_count(), 0); - - return 0; -} diff --git a/swap/test/swap_test_class.hpp b/swap/test/swap_test_class.hpp index 2b23f20..aa68444 100644 --- a/swap/test/swap_test_class.hpp +++ b/swap/test/swap_test_class.hpp @@ -1,10 +1,10 @@ -// Copyright (c) 2007 Joseph Gauterin +// Copyright (c) 2007-2008 Joseph Gauterin // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Tests that the swap header compiles as a standalone translation unit +// Tests class used by the Boost.Swap tests #ifndef BOOST_UTILITY_SWAP_TEST_CLASS_HPP #define BOOST_UTILITY_SWAP_TEST_CLASS_HPP @@ -82,90 +82,3 @@ private: }; #endif - -// Copyright (c) 2007 Joseph Gauterin -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Tests that the swap header compiles as a standalone translation unit - -#ifndef BOOST_UTILITY_SWAP_TEST_CLASS_HPP -#define BOOST_UTILITY_SWAP_TEST_CLASS_HPP - - -class swap_test_class -{ -public: - swap_test_class() - { - ++constructCount(); - } - - ~swap_test_class() - { - ++destructCount(); - } - - swap_test_class(const swap_test_class&) - { - ++copyCount(); - ++destructCount(); - } - - swap_test_class& operator=(const swap_test_class&) - { - ++copyCount(); - return *this; - } - - void swap(swap_test_class& other) - { - ++swapCount(); - } - - - static unsigned int swap_count(){ return swapCount(); } - static unsigned int copy_count(){ return copyCount(); } - static unsigned int construct_count(){ return constructCount(); } - static unsigned int destruct_count(){ return destructCount(); } - - static void reset() - { - swapCount() = 0; - copyCount() = 0; - constructCount() = 0; - destructCount() = 0; - } - -private: - static unsigned int& swapCount() - { - static unsigned int value = 0; - return value; - } - - static unsigned int& copyCount() - { - static unsigned int value = 0; - return value; - } - - static unsigned int& constructCount() - { - static unsigned int value = 0; - return value; - } - - static unsigned int& destructCount() - { - static unsigned int value = 0; - return value; - } - -}; - -#endif - -