summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/23_containers/vector
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/vector')
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc (renamed from libstdc++-v3/testsuite/23_containers/vector/resize/1.cc)0
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc (renamed from libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc)37
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc2
8 files changed, 96 insertions, 32 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/vector/resize/1.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc
index 168df7a4a97..168df7a4a97 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/resize/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc
diff --git a/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc
index 47fdf8fcafa..5ba026dbeb5 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc
@@ -1,6 +1,7 @@
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -17,19 +18,12 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
#include <vector>
#include <testsuite_hooks.h>
#include <testsuite_rvalref.h>
using namespace __gnu_test;
-// According to n1771, there should be two resizes, with and without
-// parameter. We only have one at present, whose second parameter defaults
-// to a default-constructed object.
-// Also, the values are one higher than might be expected because internally
-// resize calls fill, which copies its input value in case it is already in
-// the vector when the vector isn't moved.
void
test01()
{
@@ -41,30 +35,17 @@ test01()
a.resize(98);
a.resize(99);
a.resize(100);
-#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
- VERIFY( copycounter::copycount == 100 + 1 );
-#else
- VERIFY( copycounter::copycount == 100 + 1 + 4 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
+
a.resize(99);
a.resize(0);
-#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
- VERIFY( copycounter::copycount == 100 + 1 );
-#else
- VERIFY( copycounter::copycount == 100 + 1 + 6 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
+
a.resize(100);
-#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
- VERIFY( copycounter::copycount == 200 + 2 );
-#else
- VERIFY( copycounter::copycount == 200 + 2 + 7 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
+
a.clear();
-#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
- VERIFY( copycounter::copycount == 200 + 2 );
-#else
- VERIFY( copycounter::copycount == 200 + 2 + 7 );
-#endif
+ VERIFY( copycounter::copycount == 0 );
}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc
new file mode 100644
index 00000000000..d181168acf7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<__gnu_test::NonCopyConstructible> v;
+ VERIFY( std::distance(v.begin(), v.end()) == 0 );
+
+ v.resize(1000);
+ VERIFY( std::distance(v.begin(), v.end()) == 1000 );
+ for(auto it = v.begin(); it != v.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc
new file mode 100644
index 00000000000..a33ba1ad69e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<__gnu_test::NonCopyConstructible> v(1000);
+ VERIFY( std::distance(v.begin(), v.end()) == 1000 );
+ for(auto it = v.begin(); it != v.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
index b96b5359963..6925c1776a4 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1063 }
+// { dg-error "no matching" "" { target *-*-* } 1148 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
index 950643857c5..662bf169b23 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1003 }
+// { dg-error "no matching" "" { target *-*-* } 1078 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
index f17b541a4e0..fe2a2b25475 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1003 }
+// { dg-error "no matching" "" { target *-*-* } 1078 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
index 19d3fd08c4b..9869af131df 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1104 }
+// { dg-error "no matching" "" { target *-*-* } 1189 }
// { dg-excess-errors "" }
#include <vector>