diff options
Diffstat (limited to 'test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers')
6 files changed, 6 insertions, 6 deletions
diff --git a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp index 2be9e4685..08092ec2a 100644 --- a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp +++ b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp @@ -1 +1 @@ -//===----------------------------------------------------------------------===//
//
// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op*()
#include <memory>
#include <cassert>
int main()
{
std::unique_ptr<int> p(new int(3));
assert(*p == 3);
}
\ No newline at end of file +//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op*()
#include <memory>
#include <cassert>
int main()
{
std::unique_ptr<int> p(new int(3));
assert(*p == 3);
}
\ No newline at end of file diff --git a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp index 01a1c06d5..3fbfb3826 100644 --- a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp +++ b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp @@ -1 +1 @@ -//===----------------------------------------------------------------------===//
//
// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op*()
#include <memory>
#include <cassert>
int main()
{
{
std::unique_ptr<int> p(new int(3));
if (p)
;
else
assert(false);
if (!p)
assert(false);
}
{
std::unique_ptr<int> p;
if (!p)
;
else
assert(false);
if (p)
assert(false);
}
}
\ No newline at end of file +//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op*()
#include <memory>
#include <cassert>
int main()
{
{
std::unique_ptr<int> p(new int(3));
if (p)
;
else
assert(false);
if (!p)
assert(false);
}
{
std::unique_ptr<int> p;
if (!p)
;
else
assert(false);
if (p)
assert(false);
}
}
\ No newline at end of file diff --git a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp index 3a3d0de26..d453724c0 100644 --- a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp +++ b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp @@ -1 +1 @@ -//===----------------------------------------------------------------------===//
//
// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test get
#include <memory>
#include <cassert>
int main()
{
int* p = new int;
std::unique_ptr<int> s(p);
assert(s.get() == p);
}
\ No newline at end of file +//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test get
#include <memory>
#include <cassert>
int main()
{
int* p = new int;
std::unique_ptr<int> s(p);
assert(s.get() == p);
}
\ No newline at end of file diff --git a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp index 2f231364b..8cefe172f 100644 --- a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp +++ b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp @@ -1 +1 @@ -//===----------------------------------------------------------------------===//
//
// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test get_deleter()
#include <memory>
#include <cassert>
struct Deleter
{
void operator()(void*) {}
int test() {return 5;}
int test() const {return 6;}
};
int main()
{
{
std::unique_ptr<int, Deleter> p;
assert(p.get_deleter().test() == 5);
}
{
const std::unique_ptr<int, Deleter> p;
assert(p.get_deleter().test() == 6);
}
}
\ No newline at end of file +//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test get_deleter()
#include <memory>
#include <cassert>
struct Deleter
{
void operator()(void*) {}
int test() {return 5;}
int test() const {return 6;}
};
int main()
{
{
std::unique_ptr<int, Deleter> p;
assert(p.get_deleter().test() == 5);
}
{
const std::unique_ptr<int, Deleter> p;
assert(p.get_deleter().test() == 6);
}
}
\ No newline at end of file diff --git a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp index f542bb99e..4e9657067 100644 --- a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp +++ b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp @@ -1 +1 @@ -//===----------------------------------------------------------------------===//
//
// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op[](size_t)
#include <memory>
#include <cassert>
class A
{
int state_;
static int next_;
public:
A() : state_(++next_) {}
int get() const {return state_;}
friend bool operator==(const A& x, int y)
{return x.state_ == y;}
A& operator=(int i) {state_ = i; return *this;}
};
int A::next_ = 0;
int main()
{
std::unique_ptr<A> p(new A[3]);
assert(p[0] == 1);
assert(p[1] == 2);
assert(p[2] == 3);
p[0] = 3;
p[1] = 2;
p[2] = 1;
assert(p[0] == 3);
assert(p[1] == 2);
assert(p[2] == 1);
}
\ No newline at end of file +//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op[](size_t)
#include <memory>
#include <cassert>
class A
{
int state_;
static int next_;
public:
A() : state_(++next_) {}
int get() const {return state_;}
friend bool operator==(const A& x, int y)
{return x.state_ == y;}
A& operator=(int i) {state_ = i; return *this;}
};
int A::next_ = 0;
int main()
{
std::unique_ptr<A> p(new A[3]);
assert(p[0] == 1);
assert(p[1] == 2);
assert(p[2] == 3);
p[0] = 3;
p[1] = 2;
p[2] = 1;
assert(p[0] == 3);
assert(p[1] == 2);
assert(p[2] == 1);
}
\ No newline at end of file diff --git a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp index dfae3c334..4a00ea233 100644 --- a/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp +++ b/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp @@ -1 +1 @@ -//===----------------------------------------------------------------------===//
//
// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op->()
#include <memory>
#include <cassert>
struct A
{
int i_;
A() : i_(7) {}
};
int main()
{
std::unique_ptr<A> p(new A);
assert(p->i_ == 7);
}
\ No newline at end of file +//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op->()
#include <memory>
#include <cassert>
struct A
{
int i_;
A() : i_(7) {}
};
int main()
{
std::unique_ptr<A> p(new A);
assert(p->i_ == 7);
}
\ No newline at end of file |