aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue')
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc47
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/moveable.cc47
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1.cc25
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1_c++0x.cc25
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/typedefs.cc25
5 files changed, 169 insertions, 0 deletions
diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc
new file mode 100644
index 000000000..3c7fda825
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc
@@ -0,0 +1,47 @@
+// 2002-06-28 pme
+
+// Copyright (C) 2002-2014 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/>.
+
+// 23.2.3 container adaptros
+
+#include <queue>
+#include <testsuite_hooks.h>
+
+// libstdc++/7161
+void
+test03()
+{
+ int data[] = {1, 2, 3};
+ std::priority_queue<int> pq;
+
+ for (int i = 0; i < 3; ++i)
+ pq.push(data[i]);
+
+ pq.top();
+ for (int i = 0; i < 2; ++i)
+ pq.pop();
+
+ while (!pq.empty())
+ pq.pop();
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/moveable.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/moveable.cc
new file mode 100644
index 000000000..a892ddeb0
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/moveable.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007-2014 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/>.
+
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on vector (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <queue>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::priority_queue<int> a,b;
+ a.push(1);
+ b = std::move(a);
+ VERIFY( b.size() == 1 && b.top() == 1 && a.size() == 0 );
+
+ std::priority_queue<int> c(std::move(b));
+ VERIFY( c.size() == 1 && c.top() == 1 );
+ VERIFY( b.size() == 0 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1.cc
new file mode 100644
index 000000000..b43ebf505
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1.cc
@@ -0,0 +1,25 @@
+// { dg-do compile }
+
+// Copyright (C) 2007-2014 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/>.
+
+
+// This file tests explicit instantiation of library containers.
+
+#include <queue>
+
+template class std::priority_queue<int>;
diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1_c++0x.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1_c++0x.cc
new file mode 100644
index 000000000..692b0540d
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1_c++0x.cc
@@ -0,0 +1,25 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2009-2014 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/>.
+
+// This file tests explicit instantiation of library containers.
+
+#include <queue>
+
+template class std::priority_queue<int>;
diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/typedefs.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/typedefs.cc
new file mode 100644
index 000000000..5b7275fc3
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/typedefs.cc
@@ -0,0 +1,25 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2009-2014 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 <testsuite_containers.h>
+#include <queue>
+
+// Check container for required typedefs.
+__gnu_test::types<std::priority_queue<int> > t;