diff options
author | Benjamin Kosnik <bkoz@redhat.com> | 2009-06-18 01:40:44 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2009-06-18 01:40:44 +0000 |
commit | a9a51750b98cbff008e5388946ad65bd221fe079 (patch) | |
tree | 95f1e99a7847a263518a24056b488079730a1618 /libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc | |
parent | 6bec4135eb709bc8288f23d6e423dd99f7a12d59 (diff) | |
download | gcc-a9a51750b98cbff008e5388946ad65bd221fe079.tar.gz |
check_construct_destroy.h: New.
2009-06-17 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/list/check_construct_destroy.h: New.
Move test logic here.
* testsuite/23_containers/list/moveable.h: Same.
* testsuite/23_containers/list/modifiers/insert/25288.h: Same.
* testsuite/23_containers/list/modifiers/1.h: Same.
* testsuite/23_containers/list/modifiers/2.h: Same.
* testsuite/23_containers/list/modifiers/3.h: Same.
* testsuite/23_containers/list/modifiers/swap/1.h: Same.
* testsuite/23_containers/list/modifiers/swap/2.h: Same.
* testsuite/23_containers/list/modifiers/swap/3.h: Same.
* testsuite/23_containers/list/operations/1.h: Same.
* testsuite/23_containers/list/operations/2.h: Same.
* testsuite/23_containers/list/operations/3.h: Same.
* testsuite/23_containers/list/operations/4.h: Same.
* testsuite/23_containers/list/operations/5.h: Same.
* testsuite/23_containers/list/capacity/1.h: Same.
* testsuite/23_containers/list/init-list.h: Same.
* testsuite/23_containers/list/cons/1.h: Same.
* testsuite/23_containers/list/cons/2.h: Same.
* testsuite/23_containers/list/cons/3.h: Same.
* testsuite/23_containers/list/cons/4.h: Same.
* testsuite/23_containers/list/cons/5.h: Same.
* testsuite/23_containers/list/cons/6.h: Same.
* testsuite/23_containers/list/cons/7.h: Same.
* testsuite/23_containers/list/cons/8.h: Same.
* testsuite/23_containers/list/cons/9.h: Same.
* testsuite/23_containers/list/cons/clear_allocator.h: Same.
* testsuite/23_containers/list/modifiers/insert/25288.cc: Include test
header.
* testsuite/23_containers/list/modifiers/1.cc: Same.
* testsuite/23_containers/list/modifiers/2.cc: Same.
* testsuite/23_containers/list/modifiers/3.cc: Same.
* testsuite/23_containers/list/modifiers/swap/1.cc: Same.
* testsuite/23_containers/list/modifiers/swap/2.cc: Same.
* testsuite/23_containers/list/modifiers/swap/3.cc: Same.
* testsuite/23_containers/list/operations/1.cc: Same.
* testsuite/23_containers/list/operations/2.cc: Same.
* testsuite/23_containers/list/operations/3.cc: Same.
* testsuite/23_containers/list/operations/4.cc: Same.
* testsuite/23_containers/list/operations/5.cc: Same.
* testsuite/23_containers/list/capacity/1.cc: Same.
* testsuite/23_containers/list/init-list.cc: Same.
* testsuite/23_containers/list/cons/1.cc: Same.
* testsuite/23_containers/list/cons/2.cc: Same.
* testsuite/23_containers/list/cons/3.cc: Same.
* testsuite/23_containers/list/cons/4.cc: Same.
* testsuite/23_containers/list/cons/5.cc: Same.
* testsuite/23_containers/list/cons/6.cc: Same.
* testsuite/23_containers/list/cons/7.cc: Same.
* testsuite/23_containers/list/cons/8.cc: Same.
* testsuite/23_containers/list/cons/9.cc: Same.
* testsuite/23_containers/list/cons/clear_allocator.cc: Same.
* testsuite/23_containers/list/check_construct_destroy.cc: Same.
* testsuite/23_containers/list/moveable.cc: Same.
From-SVN: r148644
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc')
-rw-r--r-- | libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc | 138 |
1 files changed, 1 insertions, 137 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc index c0e0f65bf64..f994e9b4ae1 100644 --- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc +++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc @@ -17,144 +17,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// 23.2.2.3 list::swap - +#include "3.h" #include <list> -#include <testsuite_hooks.h> -#include <testsuite_allocator.h> - -// uneq_allocator, two different personalities. -template<typename _Tp> -void -swap3() -{ - bool test __attribute__((unused)) = true; - using namespace std; - - typedef _Tp list_type; - typedef typename list_type::allocator_type allocator_type; - typedef typename list_type::size_type size_type; - - const char title01[] = "Rivers of sand"; - const char title02[] = "Concret PH"; - const char title03[] = "Sonatas and Interludes for Prepared Piano"; - const char title04[] = "never as tired as when i'm waking up"; - - const size_t N1 = sizeof(title01); - const size_t N2 = sizeof(title02); - const size_t N3 = sizeof(title03); - const size_t N4 = sizeof(title04); - - size_type size01, size02; - - allocator_type alloc01(1), alloc02(2); - int personality01, personality02; - - list_type lis01(alloc01); - size01 = lis01.size(); - personality01 = lis01.get_allocator().get_personality(); - list_type lis02(alloc02); - size02 = lis02.size(); - personality02 = lis02.get_allocator().get_personality(); - - lis01.swap(lis02); - VERIFY( lis01.size() == size02 ); - VERIFY( lis01.empty() ); - VERIFY( lis02.size() == size01 ); - VERIFY( lis02.empty() ); - VERIFY( lis01.get_allocator().get_personality() == personality02 ); - VERIFY( lis02.get_allocator().get_personality() == personality01 ); - - list_type lis03(alloc02); - size01 = lis03.size(); - personality01 = lis03.get_allocator().get_personality(); - list_type lis04(title02, title02 + N2, alloc01); - size02 = lis04.size(); - personality02 = lis04.get_allocator().get_personality(); - - lis03.swap(lis04); - VERIFY( lis03.size() == size02 ); - VERIFY( equal(lis03.begin(), lis03.end(), title02) ); - VERIFY( lis04.size() == size01 ); - VERIFY( lis04.empty() ); - VERIFY( lis03.get_allocator().get_personality() == personality02 ); - VERIFY( lis04.get_allocator().get_personality() == personality01 ); - - list_type lis05(title01, title01 + N1, alloc01); - size01 = lis05.size(); - personality01 = lis05.get_allocator().get_personality(); - list_type lis06(title02, title02 + N2, alloc02); - size02 = lis06.size(); - personality02 = lis06.get_allocator().get_personality(); - - lis05.swap(lis06); - VERIFY( lis05.size() == size02 ); - VERIFY( equal(lis05.begin(), lis05.end(), title02) ); - VERIFY( lis06.size() == size01 ); - VERIFY( equal(lis06.begin(), lis06.end(), title01) ); - VERIFY( lis05.get_allocator().get_personality() == personality02 ); - VERIFY( lis06.get_allocator().get_personality() == personality01 ); - - list_type lis07(title01, title01 + N1, alloc02); - size01 = lis07.size(); - personality01 = lis07.get_allocator().get_personality(); - list_type lis08(title03, title03 + N3, alloc01); - size02 = lis08.size(); - personality02 = lis08.get_allocator().get_personality(); - - lis07.swap(lis08); - VERIFY( lis07.size() == size02 ); - VERIFY( equal(lis07.begin(), lis07.end(), title03) ); - VERIFY( lis08.size() == size01 ); - VERIFY( equal(lis08.begin(), lis08.end(), title01) ); - VERIFY( lis07.get_allocator().get_personality() == personality02 ); - VERIFY( lis08.get_allocator().get_personality() == personality01 ); - - list_type lis09(title03, title03 + N3, alloc01); - size01 = lis09.size(); - personality01 = lis09.get_allocator().get_personality(); - list_type lis10(title04, title04 + N4, alloc02); - size02 = lis10.size(); - personality02 = lis10.get_allocator().get_personality(); - - lis09.swap(lis10); - VERIFY( lis09.size() == size02 ); - VERIFY( equal(lis09.begin(), lis09.end(), title04) ); - VERIFY( lis10.size() == size01 ); - VERIFY( equal(lis10.begin(), lis10.end(), title03) ); - VERIFY( lis09.get_allocator().get_personality() == personality02 ); - VERIFY( lis10.get_allocator().get_personality() == personality01 ); - - list_type lis11(title04, title04 + N4, alloc02); - size01 = lis11.size(); - personality01 = lis11.get_allocator().get_personality(); - list_type lis12(title01, title01 + N1, alloc01); - size02 = lis12.size(); - personality02 = lis12.get_allocator().get_personality(); - - lis11.swap(lis12); - VERIFY( lis11.size() == size02 ); - VERIFY( equal(lis11.begin(), lis11.end(), title01) ); - VERIFY( lis12.size() == size01 ); - VERIFY( equal(lis12.begin(), lis12.end(), title04) ); - VERIFY( lis11.get_allocator().get_personality() == personality02 ); - VERIFY( lis12.get_allocator().get_personality() == personality01 ); - - list_type lis13(title03, title03 + N3, alloc01); - size01 = lis13.size(); - personality01 = lis13.get_allocator().get_personality(); - list_type lis14(title03, title03 + N3, alloc02); - size02 = lis14.size(); - personality02 = lis14.get_allocator().get_personality(); - - lis13.swap(lis14); - VERIFY( lis13.size() == size02 ); - VERIFY( equal(lis13.begin(), lis13.end(), title03) ); - VERIFY( lis14.size() == size01 ); - VERIFY( equal(lis14.begin(), lis14.end(), title03) ); - VERIFY( lis13.get_allocator().get_personality() == personality02 ); - VERIFY( lis14.get_allocator().get_personality() == personality01 ); -} int main() { |