summaryrefslogtreecommitdiffstats
path: root/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2014-12-20 01:40:03 +0000
committerEric Fiselier <eric@efcs.ca>2014-12-20 01:40:03 +0000
commit5a83710e371fe68a06e6e3876c6a2c8b820a8976 (patch)
treeafde4c82ad6704681781c5cd49baa3fbd05c85db /libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers
parentf11e8eab527fba316c64112f6e05de1a79693a3e (diff)
downloadbcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.tar.gz
bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.zip
Move test into test/std subdirectory.
llvm-svn: 224658
Diffstat (limited to 'libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers')
-rw-r--r--libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp27
-rw-r--r--libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp48
-rw-r--r--libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp64
-rw-r--r--libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp56
4 files changed, 0 insertions, 195 deletions
diff --git a/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp b/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp
deleted file mode 100644
index d79a4e396ee..00000000000
--- a/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// test release
-
-#include <memory>
-#include <cassert>
-
-int main()
-{
- std::unique_ptr<int[]> p(new int[3]);
- int* i = p.get();
- int* j = p.release();
- assert(p.get() == 0);
- assert(i == j);
- delete [] j;
-}
diff --git a/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp b/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp
deleted file mode 100644
index 8233ca0e143..00000000000
--- a/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// test reset
-
-#include <memory>
-#include <cassert>
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-int main()
-{
- {
- std::unique_ptr<A[]> p(new A[3]);
- assert(A::count == 3);
- A* i = p.get();
- p.reset();
- assert(A::count == 0);
- assert(p.get() == 0);
- }
- assert(A::count == 0);
- {
- std::unique_ptr<A[]> p(new A[4]);
- assert(A::count == 4);
- A* i = p.get();
- p.reset(new A[5]);
- assert(A::count == 5);
- }
- assert(A::count == 0);
-}
diff --git a/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp b/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp
deleted file mode 100644
index bca6cb2470a..00000000000
--- a/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// test reset
-
-#include <memory>
-#include <cassert>
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-int main()
-{
- {
- std::unique_ptr<A[]> p(new A);
- assert(A::count == 1);
- assert(B::count == 0);
- A* i = p.get();
- p.reset(new B);
- assert(A::count == 1);
- assert(B::count == 1);
- }
- assert(A::count == 0);
- assert(B::count == 0);
- {
- std::unique_ptr<A[]> p(new B);
- assert(A::count == 1);
- assert(B::count == 1);
- A* i = p.get();
- p.reset(new B);
- assert(A::count == 1);
- assert(B::count == 1);
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp b/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp
deleted file mode 100644
index e9754cc0f22..00000000000
--- a/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// test swap
-
-#include <memory>
-#include <cassert>
-
-#include "../../deleter.h"
-
-struct A
-{
- int state_;
- static int count;
- A() : state_(0) {++count;}
- explicit A(int i) : state_(i) {++count;}
- A(const A& a) : state_(a.state_) {++count;}
- A& operator=(const A& a) {state_ = a.state_; return *this;}
- ~A() {--count;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.state_ == y.state_;}
-};
-
-int A::count = 0;
-
-int main()
-{
- {
- A* p1 = new A[3];
- std::unique_ptr<A[], Deleter<A[]> > s1(p1, Deleter<A[]>(1));
- A* p2 = new A[3];
- std::unique_ptr<A[], Deleter<A[]> > s2(p2, Deleter<A[]>(2));
- assert(s1.get() == p1);
- assert(s1.get_deleter().state() == 1);
- assert(s2.get() == p2);
- assert(s2.get_deleter().state() == 2);
- s1.swap(s2);
- assert(s1.get() == p2);
- assert(s1.get_deleter().state() == 2);
- assert(s2.get() == p1);
- assert(s2.get_deleter().state() == 1);
- assert(A::count == 6);
- }
- assert(A::count == 0);
-}
OpenPOWER on IntegriCloud