summaryrefslogtreecommitdiffstats
path: root/libcxx/test/containers/container.adaptors/priority.queue
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-09-05 01:14:30 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-09-05 01:14:30 +0000
commitcbf93f39592428fc01f0c92196c6abf35dc4ed42 (patch)
tree97d12422d41120001132cdcafc2d442ce0ab86ed /libcxx/test/containers/container.adaptors/priority.queue
parentf9e81f9acbdd07281775fcf8cfcdd2b6a218da19 (diff)
downloadbcm5719-llvm-cbf93f39592428fc01f0c92196c6abf35dc4ed42.tar.gz
bcm5719-llvm-cbf93f39592428fc01f0c92196c6abf35dc4ed42.zip
sync with N3126
llvm-svn: 113101
Diffstat (limited to 'libcxx/test/containers/container.adaptors/priority.queue')
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp48
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp48
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp62
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp61
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp58
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp68
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp35
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp42
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp27
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp33
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp40
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp34
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp27
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp25
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp26
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp27
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp32
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp41
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp32
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp27
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp34
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp28
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp32
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp27
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp30
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp28
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp32
-rw-r--r--libcxx/test/containers/container.adaptors/priority.queue/types.pass.cpp60
28 files changed, 1064 insertions, 0 deletions
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp
new file mode 100644
index 00000000000..cc54dcc1261
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+// explicit priority_queue(const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../test_allocator.h"
+
+template <class T>
+struct test
+ : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& comp, const test_allocator<int>& a)
+ : base(comp, c, a) {}
+ test(const value_compare& comp, const container_type& c,
+ const test_allocator<int>& a) : base(comp, c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test(const value_compare& comp, container_type&& c,
+ const test_allocator<int>& a) : base(comp, std::move(c), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test_allocator<int> get_allocator() {return c.get_allocator();}
+
+ using base::c;
+};
+
+int main()
+{
+ test<int> q((test_allocator<int>(3)));
+ assert(q.c.get_allocator() == test_allocator<int>(3));
+ assert(q.c.size() == 0);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp
new file mode 100644
index 00000000000..b575ca0f9f6
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+// priority_queue(const Compare& comp, const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../test_allocator.h"
+
+template <class T>
+struct test
+ : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& comp, const test_allocator<int>& a)
+ : base(comp, a) {}
+ test(const value_compare& comp, const container_type& c,
+ const test_allocator<int>& a) : base(comp, c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test(const value_compare& comp, container_type&& c,
+ const test_allocator<int>& a) : base(comp, std::move(c), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test_allocator<int> get_allocator() {return c.get_allocator();}
+
+ using base::c;
+};
+
+int main()
+{
+ test<int> q(std::less<int>(), test_allocator<int>(3));
+ assert(q.c.get_allocator() == test_allocator<int>(3));
+ assert(q.c.size() == 0);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
new file mode 100644
index 00000000000..f345af632d8
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+// priority_queue(const Compare& comp, const container_type& c,
+// const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../test_allocator.h"
+
+template <class C>
+C
+make(int n)
+{
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
+}
+
+template <class T>
+struct test
+ : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& comp, const test_allocator<int>& a)
+ : base(comp, a) {}
+ test(const value_compare& comp, const container_type& c,
+ const test_allocator<int>& a) : base(comp, c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test(const value_compare& comp, container_type&& c,
+ const test_allocator<int>& a) : base(comp, std::move(c), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test_allocator<int> get_allocator() {return c.get_allocator();}
+
+ using base::c;
+};
+
+int main()
+{
+ typedef std::vector<int, test_allocator<int> > C;
+ C v = make<C>(5);
+ test<int> q(std::less<int>(), v, test_allocator<int>(3));
+ assert(q.c.get_allocator() == test_allocator<int>(3));
+ assert(q.size() == 5);
+ assert(q.top() == 4);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
new file mode 100644
index 00000000000..a518ffc9834
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+// priority_queue(const Compare& comp, container_type&& c,
+// const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../test_allocator.h"
+
+template <class C>
+C
+make(int n)
+{
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
+}
+
+template <class T>
+struct test
+ : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& comp, const test_allocator<int>& a)
+ : base(comp, a) {}
+ test(const value_compare& comp, const container_type& c,
+ const test_allocator<int>& a) : base(comp, c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test(const value_compare& comp, container_type&& c,
+ const test_allocator<int>& a) : base(comp, std::move(c), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test_allocator<int> get_allocator() {return c.get_allocator();}
+
+ using base::c;
+};
+
+int main()
+{
+ typedef std::vector<int, test_allocator<int> > C;
+ test<int> q(std::less<int>(), make<C>(5), test_allocator<int>(3));
+ assert(q.c.get_allocator() == test_allocator<int>(3));
+ assert(q.size() == 5);
+ assert(q.top() == 4);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp
new file mode 100644
index 00000000000..5b917a3262a
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+// priority_queue(const priority_queue& q, const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
+}
+
+#include "../../../../test_allocator.h"
+
+template <class T>
+struct test
+ : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& comp, const test_allocator<int>& a)
+ : base(comp, c, a) {}
+ test(const value_compare& comp, const container_type& c,
+ const test_allocator<int>& a) : base(comp, c, a) {}
+ test(const test& q, const test_allocator<int>& a) : base(q, a) {}
+ test_allocator<int> get_allocator() {return c.get_allocator();}
+
+ using base::c;
+};
+
+int main()
+{
+ test<int> qo(std::less<int>(),
+ make<std::vector<int, test_allocator<int> > >(5),
+ test_allocator<int>(2));
+ test<int> q(qo, test_allocator<int>(6));
+ assert(q.size() == 5);
+ assert(q.c.get_allocator() == test_allocator<int>(6));
+ assert(q.top() == int(4));
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp
new file mode 100644
index 00000000000..901a18a68c4
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+// priority_queue(priority_queue&& q, const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
+}
+
+#include "../../../../test_allocator.h"
+
+template <class T>
+struct test
+ : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& comp, const test_allocator<int>& a)
+ : base(comp, c, a) {}
+ test(const value_compare& comp, const container_type& c,
+ const test_allocator<int>& a) : base(comp, c, a) {}
+ test(const value_compare& comp, container_type&& c,
+ const test_allocator<int>& a) : base(comp, std::move(c), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ test_allocator<int> get_allocator() {return c.get_allocator();}
+
+ using base::c;
+};
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test<MoveOnly> qo(std::less<MoveOnly>(),
+ make<std::vector<MoveOnly, test_allocator<MoveOnly> > >(5),
+ test_allocator<MoveOnly>(2));
+ test<MoveOnly> q(std::move(qo), test_allocator<MoveOnly>(6));
+ assert(q.size() == 5);
+ assert(q.c.get_allocator() == test_allocator<MoveOnly>(6));
+ assert(q.top() == MoveOnly(4));
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp
new file mode 100644
index 00000000000..80825f95a68
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue& operator=(const priority_queue&) = default;
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
+}
+
+int main()
+{
+ std::vector<int> v = make<std::vector<int> >(5);
+ std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
+ std::priority_queue<int, std::vector<int>, std::greater<int> > q;
+ q = qo;
+ assert(q.size() == 5);
+ assert(q.top() == 0);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp
new file mode 100644
index 00000000000..d34c8fa629a
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue& operator=(priority_queue&& q);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
+}
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
+ std::priority_queue<MoveOnly> q;
+ q = std::move(qo);
+ assert(q.size() == 5);
+ assert(q.top() == MoveOnly(4));
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
new file mode 100644
index 00000000000..fb00c08f5d3
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// explicit priority_queue(const Compare& comp);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../stack_allocator.h"
+
+int main()
+{
+ std::priority_queue<int, std::vector<int, stack_allocator<int, 10> > > q((std::less<int>()));
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ assert(q.size() == 2);
+ assert(q.top() == 2);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp
new file mode 100644
index 00000000000..43e22a70324
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// explicit priority_queue(const Compare& comp, const container_type& c);
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
+}
+
+int main()
+{
+ std::vector<int> v = make<std::vector<int> >(5);
+ std::priority_queue<int, std::vector<int>, std::greater<int> > q(std::greater<int>(), v);
+ assert(q.size() == 5);
+ assert(q.top() == 0);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp
new file mode 100644
index 00000000000..a734f7229bf
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// explicit priority_queue(const Compare& comp, container_type&& c);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
+}
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::priority_queue<MoveOnly> q(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
+ assert(q.size() == 5);
+ assert(q.top() == MoveOnly(4));
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
new file mode 100644
index 00000000000..2b9f5c2f1a9
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue(const priority_queue&) = default;
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
+}
+
+int main()
+{
+ std::vector<int> v = make<std::vector<int> >(5);
+ std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
+ std::priority_queue<int, std::vector<int>, std::greater<int> > q = qo;
+ assert(q.size() == 5);
+ assert(q.top() == 0);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
new file mode 100644
index 00000000000..ba4630605a0
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../stack_allocator.h"
+
+int main()
+{
+ std::priority_queue<int, std::vector<int, stack_allocator<int, 10> > > q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ assert(q.size() == 2);
+ assert(q.top() == 2);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
new file mode 100644
index 00000000000..f5c994bb693
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class InputIterator>
+// priority_queue(InputIterator first, InputIterator last);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ int* an = a + sizeof(a)/sizeof(a[0]);
+ std::priority_queue<int> q(a, an);
+ assert(q.size() == an - a);
+ assert(q.top() == 8);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
new file mode 100644
index 00000000000..b9785575613
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class InputIterator>
+// priority_queue(InputIterator first, InputIterator last, const Compare& comp);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ int* an = a + sizeof(a)/sizeof(a[0]);
+ std::priority_queue<int, std::vector<int>, std::greater<int> >
+ q(a, an, std::greater<int>());
+ assert(q.size() == an - a);
+ assert(q.top() == 0);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp
new file mode 100644
index 00000000000..7c0e7fcf0e5
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class InputIterator>
+// priority_queue(InputIterator first, InputIterator last,
+// const Compare& comp, const container_type& c);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ const int n = sizeof(a)/sizeof(a[0]);
+ std::vector<int> v(a, a+n/2);
+ std::priority_queue<int> q(a+n/2, a+n, std::less<int>(), v);
+ assert(q.size() == n);
+ assert(q.top() == 8);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp
new file mode 100644
index 00000000000..ac72cc38f46
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class InputIterator>
+// priority_queue(InputIterator first, InputIterator last,
+// const Compare& comp, container_type&& c);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../MoveOnly.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ const int n = sizeof(a)/sizeof(a[0]);
+ std::priority_queue<MoveOnly> q(a+n/2, a+n,
+ std::less<MoveOnly>(),
+ std::vector<MoveOnly>(a, a+n/2));
+ assert(q.size() == n);
+ assert(q.top() == MoveOnly(8));
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp
new file mode 100644
index 00000000000..2f30b36c423
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue(priority_queue&& q);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
+}
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
+ std::priority_queue<MoveOnly> q = std::move(qo);
+ assert(q.size() == 5);
+ assert(q.top() == MoveOnly(4));
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp
new file mode 100644
index 00000000000..34bbd27e885
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// template <class... Args> void emplace(Args&&... args);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../Emplaceable.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::priority_queue<Emplaceable> q;
+ q.emplace(1, 2.5);
+ assert(q.top() == Emplaceable(1, 2.5));
+ q.emplace(3, 4.5);
+ assert(q.top() == Emplaceable(3, 4.5));
+ q.emplace(2, 3.5);
+ assert(q.top() == Emplaceable(3, 4.5));
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp
new file mode 100644
index 00000000000..891e7c2eb48
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// bool empty() const;
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+ std::priority_queue<int> q;
+ assert(q.empty());
+ q.push(1);
+ assert(!q.empty());
+ q.pop();
+ assert(q.empty());
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp
new file mode 100644
index 00000000000..202e19c8916
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// void pop();
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+ std::priority_queue<int> q;
+ q.push(1);
+ assert(q.top() == 1);
+ q.push(3);
+ assert(q.top() == 3);
+ q.push(2);
+ assert(q.top() == 3);
+ q.pop();
+ assert(q.top() == 2);
+ q.pop();
+ assert(q.top() == 1);
+ q.pop();
+ assert(q.empty());
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp
new file mode 100644
index 00000000000..4aa4e56106f
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// void push(const value_type& v);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+ std::priority_queue<int> q;
+ q.push(1);
+ assert(q.top() == 1);
+ q.push(3);
+ assert(q.top() == 3);
+ q.push(2);
+ assert(q.top() == 3);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp
new file mode 100644
index 00000000000..93674b0c1a9
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// void push(value_type&& v);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../../MoveOnly.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::priority_queue<MoveOnly> q;
+ q.push(1);
+ assert(q.top() == 1);
+ q.push(3);
+ assert(q.top() == 3);
+ q.push(2);
+ assert(q.top() == 3);
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp
new file mode 100644
index 00000000000..5a9e17913b7
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// size_type size() const;
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+ std::priority_queue<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ assert(q.size() == 1);
+ q.pop();
+ assert(q.size() == 0);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp
new file mode 100644
index 00000000000..ec0cfd2ae3b
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// void swap(priority_queue& q);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+ std::priority_queue<int> q1;
+ std::priority_queue<int> q2;
+ q1.push(1);
+ q1.push(3);
+ q1.push(2);
+ q1.swap(q2);
+ assert(q1.empty());
+ assert(q2.size() == 3);
+ assert(q2.top() == 3);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp
new file mode 100644
index 00000000000..001312f42ca
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// const_reference top() const;
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+ std::priority_queue<int> q;
+ q.push(1);
+ assert(q.top() == 1);
+ q.push(3);
+ assert(q.top() == 3);
+ q.push(2);
+ assert(q.top() == 3);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
new file mode 100644
index 00000000000..9d7fb951916
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// template <class T, class Container, class Compare>
+// void swap(priority_queue<T, Container, Compare>& x,
+// priority_queue<T, Container, Compare>& y);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+ std::priority_queue<int> q1;
+ std::priority_queue<int> q2;
+ q1.push(1);
+ q1.push(3);
+ q1.push(2);
+ swap(q1, q2);
+ assert(q1.empty());
+ assert(q2.size() == 3);
+ assert(q2.top() == 3);
+}
diff --git a/libcxx/test/containers/container.adaptors/priority.queue/types.pass.cpp b/libcxx/test/containers/container.adaptors/priority.queue/types.pass.cpp
new file mode 100644
index 00000000000..d68c0563a21
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/priority.queue/types.pass.cpp
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class T, class Container = vector<T>,
+// class Compare = less<typename Container::value_type>>
+// class priority_queue
+// {
+// public:
+// typedef Container container_type;
+// typedef typename container_type::value_type value_type;
+// typedef typename container_type::reference reference;
+// typedef typename container_type::const_reference const_reference;
+// typedef typename container_type::size_type size_type;
+//
+// protected:
+// container_type c;
+// Compare comp;
+
+#include <queue>
+#include <cassert>
+#include <type_traits>
+
+struct test
+ : private std::priority_queue<int>
+{
+ test()
+ {
+ c.push_back(1);
+ assert(comp(1, 2));
+ }
+};
+
+struct C
+{
+ typedef int value_type;
+ typedef int& reference;
+ typedef const int& const_reference;
+ typedef int size_type;
+};
+
+int main()
+{
+ static_assert((std::is_same<std::priority_queue<int>::container_type, std::vector<int> >::value), "");
+ static_assert((std::is_same<std::priority_queue<double, std::deque<int> >::container_type, std::deque<int> >::value), "");
+ static_assert((std::is_same<std::priority_queue<double, std::deque<int> >::value_type, int>::value), "");
+ static_assert((std::is_same<std::priority_queue<int>::reference, std::vector<int>::reference>::value), "");
+ static_assert((std::is_same<std::priority_queue<int>::const_reference, std::vector<int>::const_reference>::value), "");
+ static_assert((std::is_same<std::priority_queue<int>::size_type, std::vector<int>::size_type>::value), "");
+ static_assert((std::uses_allocator<std::priority_queue<int>, std::allocator<int> >::value), "");
+ static_assert((!std::uses_allocator<std::priority_queue<int, C>, std::allocator<int> >::value), "");
+ test t;
+}
OpenPOWER on IntegriCloud