aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/23_containers/deque/invalidation
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2003-11-11 20:09:16 +0000
committerBenjamin Kosnik <bkoz@redhat.com>2003-11-11 20:09:16 +0000
commit83309beacc4019ee98bfdc309e54bcdd363daab9 (patch)
tree48d847b6238daa37c4ad869a73f671de6a44761f /libstdc++-v3/testsuite/23_containers/deque/invalidation
parentf65c458b05d7b13a811d5babd3a954455767893d (diff)
2003-11-11 Doug Gregor <gregod@cs.rpi.edu>
* docs/html/debug.html: Document libstdc++ debug mode. * docs/html/debug_mode.html: Document libstdc++ debug mode design. * docs/html/test.html: Document how to test under debug mode. * docs/html/17_intro/howto.html: Document debug-mode macros. * include/Makefile.am: Install debug-mode headers. * src/Makefile.am: Include debug.cc. * include/bits/basic_string.tcc: (basic_string::_S_construct): Fix NULL pointer check. (__is_null_pointer): New. Add precondition annotations. * include/bits/stream_iterator.h (istream_iterator, ostream_iterator): Added precondition annotations. * include/bits/streambuf_iterator.h (istreambuf_iterator): Ditto. * include/bits/stl_queue.h (queue, priority_queue): Ditto. * include/bits/stl_stack.h (stack): Ditto. * include/bits/basic_string.h (basic_string): Ditto. * include/bits/basic_string.tcc (basic_string): Ditto. * include/std/std_memory.h (auto_ptr): Ditto. * include/std/std_valarray.h (valarray): Ditto. * include/bits/stl_algo.h: Added algorithm precondition annotations. * include/bits/stl_algobase.h: Added algorithm precondition annotations. * include/bits/stl_numeric.h: Ditto. * include/ext/algorithm: Added algorithm precondition annotations. (__is_heap): Moved away from here. * include/bits/stl_heap.h: Added algorithm precondition annotations. (__is_heap): Moved to the top of this file. (__is_heap): Added iterator range overloads. * testsuite/20_util/auto_ptr_neg.cc: Fix line numbers to match up with changes in std_memory.h. * testsuite/23_containers/list/operators/4.cc: Don't verify performance guarantees when in debug mode. * testsuite/23_containers/bitset/invalidation/1.cc: New. * testsuite/23_containers/deque/invalidation/1.cc: New. * testsuite/23_containers/deque/invalidation/2.cc: New. * testsuite/23_containers/deque/invalidation/3.cc: New. * testsuite/23_containers/deque/invalidation/4.cc: New. * testsuite/23_containers/list/invalidation/1.cc: New. * testsuite/23_containers/list/invalidation/2.cc: New. * testsuite/23_containers/list/invalidation/3.cc: New. * testsuite/23_containers/list/invalidation/4.cc: New. * testsuite/23_containers/map/invalidation/1.cc: New. * testsuite/23_containers/map/invalidation/2.cc: New. * testsuite/23_containers/multimap/invalidation/1.cc: New. * testsuite/23_containers/multimap/invalidation/2.cc: New. * testsuite/23_containers/multiset/invalidation/1.cc: New. * testsuite/23_containers/multiset/invalidation/2.cc: New. * testsuite/23_containers/set/invalidation/1.cc: New. * testsuite/23_containers/set/invalidation/2.cc: New. * testsuite/23_containers/vector/invalidation/1.cc: New. * testsuite/23_containers/vector/invalidation/2.cc: New. * testsuite/23_containers/vector/invalidation/3.cc: New. * testsuite/23_containers/vector/invalidation/4.cc: New. * testsuite/25_algorithms/heap.cc: Don't verify performance guarantees when in debug mode. * include/debug/bitset: New. * include/debug/debug.h: New. * include/debug/deque: New. * include/debug/formatter.h: New. * include/debug/hash_map: New. * include/debug/hash_map.h: New. * include/debug/hash_multimap.h: New. * include/debug/hash_set: New. * include/debug/hash_set.h: New. * include/debug/hash_multiset.h: New. * include/debug/list: New. * include/debug/map: New. * include/debug/map.h: New. * include/debug/multimap.h: New. * include/debug/multiset.h: New. * include/debug/safe_base.h: New. * include/debug/safe_iterator.h: New. * include/debug/safe_iterator.tcc: New. * include/debug/safe_sequence.h: New. * include/debug/set: New. * include/debug/set.h: New. * include/debug/string: New. * include/debug/vector: New. * src/debug.cc: New. * config/linker-map.gnu: Add debug mode symbols. 2003-11-11 Benjamin Kosnik <bkoz@redhat.com> * src/string-inst.cc: Tweak namespaces. * src/misc-inst.cc: Same. * docs/html/debug.html: Edits. * config/link-map.gnu: Remove cruft. * include/bits/c++config: Add in namespace associations. * include/std/std_bitset.h: Adjust namespace to __gnu_norm, comment tweaks. * include/bits/deque.tcc: Same. * include/bits/list.tcc: Same. * include/bits/stl_bvector.h: Same. * include/bits/stl_deque.h: Same. * include/bits/stl_list.h: Same. * include/bits/stl_map.h: Same. * include/bits/stl_multimap.h: Same. * include/bits/stl_multiset.h: Same. * include/bits/stl_set.h: Same. * include/bits/stl_vector.h: Same. * include/bits/vector.tcc: Same. * include/std/std_algorithm.h: Remove markup comments. * include/std/std_functional.h: Same. * include/std/std_iterator.h: Same. * include/std/std_numeric.h: Same. * include/std/std_utility.h: Same. * include/bits/stl_queue.h: Formatting tweaks. * include/bits/stl_stack.h: Same. * include/std/std_deque.h: Include debugging version in debug mode. * include/std/std_list.h: Same. * include/std/std_map.h: Same. * include/std/std_set.h: Same. * include/std/std_vector.h: Same. * include/std/std_queue.h: Use deque, vector. * include/std/std_stack.h: Same. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@73459 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/deque/invalidation')
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/invalidation/1.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/invalidation/2.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/invalidation/3.cc62
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/invalidation/4.cc69
4 files changed, 237 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/deque/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/deque/invalidation/1.cc
new file mode 100644
index 00000000000..4529b288ef4
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/invalidation/1.cc
@@ -0,0 +1,53 @@
+// Deque iterator invalidation tests
+
+// Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <debug/deque>
+#include <testsuite_hooks.h>
+
+using __gnu_debug::deque;
+
+bool test = true;
+
+// Assignment
+void test01()
+{
+ deque<int> v1;
+ deque<int> v2;
+
+ deque<int>::iterator i = v1.end();
+ VERIFY(!i._M_dereferenceable() && !i._M_singular());
+
+ v1 = v2;
+ VERIFY(i._M_singular());
+
+ i = v1.end();
+ v1.assign(v2.begin(), v2.end());
+ VERIFY(i._M_singular());
+
+ i = v1.end();
+ v1.assign(17, 42);
+ VERIFY(i._M_singular());
+}
+
+int main()
+{
+ test01();
+ return !test;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/deque/invalidation/2.cc
new file mode 100644
index 00000000000..106c118accc
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/invalidation/2.cc
@@ -0,0 +1,53 @@
+// Deque iterator invalidation tests
+
+// Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <debug/deque>
+#include <testsuite_hooks.h>
+
+using __gnu_debug::deque;
+
+bool test = true;
+
+// Resize
+void test02()
+{
+ deque<int> v(10, 17);
+
+ deque<int>::iterator before = v.begin() + 6;
+ deque<int>::iterator at = before + 1;
+ deque<int>::iterator after = at + 1;
+
+ // Shrink
+ v.resize(7);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_singular());
+ VERIFY(after._M_singular());
+
+ // Grow
+ before = v.begin() + 6;
+ v.resize(17);
+ VERIFY(before._M_singular());
+}
+
+int main()
+{
+ test02();
+ return !test;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/invalidation/3.cc b/libstdc++-v3/testsuite/23_containers/deque/invalidation/3.cc
new file mode 100644
index 00000000000..60103c1fd7e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/invalidation/3.cc
@@ -0,0 +1,62 @@
+// Deque iterator invalidation tests
+
+// Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <debug/deque>
+#include <testsuite_hooks.h>
+
+using __gnu_debug::deque;
+
+bool test = true;
+
+// Insert
+void test03()
+{
+ deque<int> v(10, 17);
+
+ // Insert a single element
+ deque<int>::iterator before = v.begin() + 6;
+ deque<int>::iterator at = before + 1;
+ deque<int>::iterator after = at;
+ at = v.insert(at, 42);
+ VERIFY(before._M_singular());
+ VERIFY(at._M_dereferenceable());
+ VERIFY(after._M_singular());
+
+ // Insert multiple copies
+ before = v.begin() + 6;
+ at = before + 1;
+ v.insert(at, 3, 42);
+ VERIFY(before._M_singular());
+ VERIFY(at._M_singular());
+
+ // Insert iterator range
+ static int data[] = { 2, 3, 5, 7 };
+ before = v.begin() + 6;
+ at = before + 1;
+ v.insert(at, &data[0], &data[0] + 4);
+ VERIFY(before._M_singular());
+ VERIFY(at._M_singular());
+}
+
+int main()
+{
+ test03();
+ return !test;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/invalidation/4.cc b/libstdc++-v3/testsuite/23_containers/deque/invalidation/4.cc
new file mode 100644
index 00000000000..1918737cf93
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/invalidation/4.cc
@@ -0,0 +1,69 @@
+// Deque iterator invalidation tests
+
+// Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <debug/deque>
+#include <testsuite_hooks.h>
+
+using __gnu_debug::deque;
+
+bool test = true;
+
+// Erase
+void test04()
+{
+ deque<int> v(20, 42);
+
+ // Single element erase (middle)
+ deque<int>::iterator before = v.begin();
+ deque<int>::iterator at = before + 3;
+ deque<int>::iterator after = at;
+ at = v.erase(at);
+ VERIFY(before._M_singular());
+ VERIFY(at._M_dereferenceable());
+ VERIFY(after._M_singular());
+
+ // Single element erase (end)
+ before = v.begin();
+ at = before;
+ after = at + 1;
+ at = v.erase(at);
+ VERIFY(before._M_singular());
+ VERIFY(at._M_dereferenceable());
+ VERIFY(after._M_dereferenceable());
+
+ // Multiple element erase
+ before = v.begin();
+ at = before + 3;
+ v.erase(at, at + 3);
+ VERIFY(before._M_singular());
+ VERIFY(at._M_singular());
+
+ // clear()
+ before = v.begin();
+ VERIFY(before._M_dereferenceable());
+ v.clear();
+ VERIFY(before._M_singular());
+}
+
+int main()
+{
+ test04();
+ return !test;
+}