[cfe-commits] [libcxx] r111767 [2/2] - in /libcxx/trunk/test/utilities: ./ date.time/ function.objects/ function.objects/arithmetic.operations/ function.objects/base/ function.objects/bind/ function.objects/bind/func.bind/ function.objects/bind/func.bind/func.bind.bind/ function.objects/bind/func.bind/func.bind.isbind/ function.objects/bind/func.bind/func.bind.place/ function.objects/bitwise.operations/ function.objects/comparisons/ function.objects/func.def/ function.objects/func.memfn/ function.objects/func.require/...
Howard Hinnant
hhinnant at apple.com
Sat Aug 21 17:59:48 PDT 2010
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,37 @@
-//===----------------------------------------------------------------------===//
//
// 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);
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,47 @@
-//===----------------------------------------------------------------------===//
//
// 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);
+}
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,30 @@
-//===----------------------------------------------------------------------===//
//
// 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);
+}
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/eq.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/eq.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/eq.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,86 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// template <class T1, class D1, class T2, class D2>
// bool
// operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
// template <class T1, class D1, class T2, class D2>
// bool
// operator!=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
#include <memory>
#include <cassert>
#include "../deleter.h"
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;
i
nt main()
{
{
const std::unique_ptr<A, Deleter<A> > p1(new A);
const std::unique_ptr<A, Deleter<A> > p2(new A);
assert(!(p1 == p2));
assert(p1 != p2);
}
{
const std::unique_ptr<A, Deleter<A> > p1(new A);
const std::unique_ptr<B, Deleter<B> > p2(new B);
assert(!(p1 == p2));
assert(p1 != p2);
}
{
const std::unique_ptr<A[], Deleter<A[]> > p1(new A[3]);
const std::unique_ptr<A[], Deleter<A[]> > p2(new A[3]);
assert(!(p1 == p2));
assert(p1 != p2);
}
{
const std::unique_ptr<A[], Deleter<A[]> > p1(new A[3]);
const std::unique_ptr<B[], Deleter<B[]> > p2(new B[3]);
assert(!(p1 == p2));
assert(p1 != p2);
}
{
const std::unique_ptr<A, Deleter<A> > p1;
const std::unique_ptr<A, Deleter<A> > p2;
assert(p1 == p2);
assert(!(p1 != p2));
}
{
const std::unique_ptr<A, Deleter<A> > p1;
const std::unique_ptr<B, Deleter<B> > p2;
assert(p1 == p2);
assert(!(p1 !=
p2));
}
}
\ 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
+
+// template <class T1, class D1, class T2, class D2>
+// bool
+// operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+
+// template <class T1, class D1, class T2, class D2>
+// bool
+// operator!=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+
+#include <memory>
+#include <cassert>
+
+#include "../deleter.h"
+
+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()
+{
+ {
+ const std::unique_ptr<A, Deleter<A> > p1(new A);
+ const std::unique_ptr<A, Deleter<A> > p2(new A);
+ assert(!(p1 == p2));
+ assert(p1 != p2);
+ }
+ {
+ const std::unique_ptr<A, Deleter<A> > p1(new A);
+ const std::unique_ptr<B, Deleter<B> > p2(new B);
+ assert(!(p1 == p2));
+ assert(p1 != p2);
+ }
+ {
+ const std::unique_ptr<A[], Deleter<A[]> > p1(new A[3]);
+ const std::unique_ptr<A[], Deleter<A[]> > p2(new A[3]);
+ assert(!(p1 == p2));
+ assert(p1 != p2);
+ }
+ {
+ const std::unique_ptr<A[], Deleter<A[]> > p1(new A[3]);
+ const std::unique_ptr<B[], Deleter<B[]> > p2(new B[3]);
+ assert(!(p1 == p2));
+ assert(p1 != p2);
+ }
+ {
+ const std::unique_ptr<A, Deleter<A> > p1;
+ const std::unique_ptr<A, Deleter<A> > p2;
+ assert(p1 == p2);
+ assert(!(p1 != p2));
+ }
+ {
+ const std::unique_ptr<A, Deleter<A> > p1;
+ const std::unique_ptr<B, Deleter<B> > p2;
+ assert(p1 == p2);
+ assert(!(p1 != p2));
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,100 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// template <class T1, class D1, class T2, class D2>
// bool
// operator< (const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
// template <class T1, class D1, class T2, class D2>
// bool
// operator> (const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
// template <class T1, class D1, class T2, class D2>
// bool
// operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
// template <class T1, class D1, class T2, class D2>
// bool
// operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
#include <memory>
#include <cassert>
#include "../deleter.
h"
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()
{
{
const std::unique_ptr<A, Deleter<A> > p1(new A);
const std::unique_ptr<A, Deleter<A> > p2(new A);
assert((p1 < p2) == !(p1 > p2));
assert((p1 < p2) == (p1 <= p2));
assert((p1 < p2) == !(p1 >= p2));
}
{
const std::unique_ptr<A, Deleter<A> > p1(new A);
const std::unique_ptr<B, Deleter<B> > p2(new B);
assert((p1 < p2) == !(p1 > p2));
assert((p1 < p2) == (p1 <= p2));
assert((p1 < p2) == !(p1 >= p2));
}
{
const std::unique_ptr<A[], Deleter<A[]> > p1(new A[3]);
const std::unique_ptr<A[], Deleter<A[]> > p2(new A[3]);
assert((p1 < p2) == !(p1 > p2));
assert((p1 < p2) == (p1 <= p2));
assert((p1 < p2) == !(p1 >= p2));
}
{
const std::unique_ptr<A[], Deleter<A[]> > p1(new A[3]);
const std::unique_ptr<B[], Deleter<B[]> > p2(new B[3]);
assert((p1 < p2) == !(p1 > p2));
assert((p1 < p2) == (p1 <= p2));
assert((p1 < p2) == !(p1 >= p2));
}
{
const std::unique_ptr<A, Deleter<A> > p1;
const std::unique_ptr<A, Deleter<A> > p2;
assert((p1 < p2) == (p1 > p2));
assert((p1 < p2) == !(p1 <= p2));
assert((p1 < p2) == !(p1 >= p2));
}
{
const std::unique_ptr<A, Deleter<A> > p1;
const std::unique_ptr<B, Deleter<B> > p2;
assert((p1 < p2) == (p1 > p2));
assert((p1 < p2) == !(p1 <= p2));
assert((p1 < p2) == !(p1 >= p2));
}
}
\ 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
+
+// template <class T1, class D1, class T2, class D2>
+// bool
+// operator< (const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+
+// template <class T1, class D1, class T2, class D2>
+// bool
+// operator> (const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+
+// template <class T1, class D1, class T2, class D2>
+// bool
+// operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+
+// template <class T1, class D1, class T2, class D2>
+// bool
+// operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+
+#include <memory>
+#include <cassert>
+
+#include "../deleter.h"
+
+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()
+{
+ {
+ const std::unique_ptr<A, Deleter<A> > p1(new A);
+ const std::unique_ptr<A, Deleter<A> > p2(new A);
+ assert((p1 < p2) == !(p1 > p2));
+ assert((p1 < p2) == (p1 <= p2));
+ assert((p1 < p2) == !(p1 >= p2));
+ }
+ {
+ const std::unique_ptr<A, Deleter<A> > p1(new A);
+ const std::unique_ptr<B, Deleter<B> > p2(new B);
+ assert((p1 < p2) == !(p1 > p2));
+ assert((p1 < p2) == (p1 <= p2));
+ assert((p1 < p2) == !(p1 >= p2));
+ }
+ {
+ const std::unique_ptr<A[], Deleter<A[]> > p1(new A[3]);
+ const std::unique_ptr<A[], Deleter<A[]> > p2(new A[3]);
+ assert((p1 < p2) == !(p1 > p2));
+ assert((p1 < p2) == (p1 <= p2));
+ assert((p1 < p2) == !(p1 >= p2));
+ }
+ {
+ const std::unique_ptr<A[], Deleter<A[]> > p1(new A[3]);
+ const std::unique_ptr<B[], Deleter<B[]> > p2(new B[3]);
+ assert((p1 < p2) == !(p1 > p2));
+ assert((p1 < p2) == (p1 <= p2));
+ assert((p1 < p2) == !(p1 >= p2));
+ }
+ {
+ const std::unique_ptr<A, Deleter<A> > p1;
+ const std::unique_ptr<A, Deleter<A> > p2;
+ assert((p1 < p2) == (p1 > p2));
+ assert((p1 < p2) == !(p1 <= p2));
+ assert((p1 < p2) == !(p1 >= p2));
+ }
+ {
+ const std::unique_ptr<A, Deleter<A> > p1;
+ const std::unique_ptr<B, Deleter<B> > p2;
+ assert((p1 < p2) == (p1 > p2));
+ assert((p1 < p2) == !(p1 <= p2));
+ assert((p1 < p2) == !(p1 >= p2));
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,77 @@
-//===----------------------------------------------------------------------===//
//
// 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 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(1);
std::unique_ptr<A, Deleter<A> > s1(p1, Deleter<A>(1));
A* p2 = new A(2);
std::unique_ptr<A, Deleter<A> > s2(p2, Delete
r<A>(2));
assert(s1.get() == p1);
assert(*s1 == A(1));
assert(s1.get_deleter().state() == 1);
assert(s2.get() == p2);
assert(*s2 == A(2));
assert(s2.get_deleter().state() == 2);
swap(s1, s2);
assert(s1.get() == p2);
assert(*s1 == A(2));
assert(s1.get_deleter().state() == 2);
assert(s2.get() == p1);
assert(*s2 == A(1));
assert(s2.get_deleter().state() == 1);
assert(A::count == 2);
}
assert(A::count == 0);
{
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);
swap(s1, 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);
}
\ 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 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(1);
+ std::unique_ptr<A, Deleter<A> > s1(p1, Deleter<A>(1));
+ A* p2 = new A(2);
+ std::unique_ptr<A, Deleter<A> > s2(p2, Deleter<A>(2));
+ assert(s1.get() == p1);
+ assert(*s1 == A(1));
+ assert(s1.get_deleter().state() == 1);
+ assert(s2.get() == p2);
+ assert(*s2 == A(2));
+ assert(s2.get_deleter().state() == 2);
+ swap(s1, s2);
+ assert(s1.get() == p2);
+ assert(*s1 == A(2));
+ assert(s1.get_deleter().state() == 2);
+ assert(s2.get() == p1);
+ assert(*s2 == A(1));
+ assert(s2.get_deleter().state() == 1);
+ assert(A::count == 2);
+ }
+ assert(A::count == 0);
+ {
+ 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);
+ swap(s1, 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);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,49 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// template<class T>
// class enable_shared_from_this
// {
// protected:
// enable_shared_from_this();
// enable_shared_from_this(enable_shared_from_this const&);
// enable_shared_from_this& operator=(enable_shared_from_this const&);
// ~enable_shared_from_this();
// public:
// shared_ptr<T> shared_from_this();
// shared_ptr<T const> shared_from_this() const;
// };
#include <memory>
#include <cassert>
struct T
: public std::enable_shared_from_this<T>
{
};
struct Y : T {};
struct Z : Y {};
int main()
{
{
std::shared_ptr<Y> p(new Z);
std::shared_ptr<T> q = p->shared_from_this();
ass
ert(p == q);
assert(!p.owner_before(q) && !q.owner_before(p)); // p and q share ownership
}
{
std::shared_ptr<Y> p = std::make_shared<Z>();
std::shared_ptr<T> q = p->shared_from_this();
assert(p == q);
assert(!p.owner_before(q) && !q.owner_before(p)); // p and q share ownership
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// template<class T>
+// class enable_shared_from_this
+// {
+// protected:
+// enable_shared_from_this();
+// enable_shared_from_this(enable_shared_from_this const&);
+// enable_shared_from_this& operator=(enable_shared_from_this const&);
+// ~enable_shared_from_this();
+// public:
+// shared_ptr<T> shared_from_this();
+// shared_ptr<T const> shared_from_this() const;
+// };
+
+#include <memory>
+#include <cassert>
+
+struct T
+ : public std::enable_shared_from_this<T>
+{
+};
+
+struct Y : T {};
+
+struct Z : Y {};
+
+int main()
+{
+ {
+ std::shared_ptr<Y> p(new Z);
+ std::shared_ptr<T> q = p->shared_from_this();
+ assert(p == q);
+ assert(!p.owner_before(q) && !q.owner_before(p)); // p and q share ownership
+ }
+ {
+ std::shared_ptr<Y> p = std::make_shared<Z>();
+ std::shared_ptr<T> q = p->shared_from_this();
+ assert(p == q);
+ assert(!p.owner_before(q) && !q.owner_before(p)); // p and q share ownership
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,30 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T>
// struct hash<shared_ptr<T>>
// {
// typedef shared_ptr<T> argument_type;
// typedef size_t result_type;
// size_t operator()(const shared_ptr<T>& p) const;
// };
#include <memory>
#include <cassert>
int main()
{
int* ptr = new int;
std::shared_ptr<int> p(ptr);
std::hash<std::shared_ptr<int> > f;
std::size_t h = f(p);
assert(h == std::hash<int*>()(ptr));
}
\ 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>
+
+// template <class T>
+// struct hash<shared_ptr<T>>
+// {
+// typedef shared_ptr<T> argument_type;
+// typedef size_t result_type;
+// size_t operator()(const shared_ptr<T>& p) const;
+// };
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ int* ptr = new int;
+ std::shared_ptr<int> p(ptr);
+ std::hash<std::shared_ptr<int> > f;
+ std::size_t h = f(p);
+ assert(h == std::hash<int*>()(ptr));
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,30 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T, class D>
// struct hash<unique_ptr<T, D>>
// {
// typedef unique_ptr<T, D> argument_type;
// typedef size_t result_type;
// size_t operator()(const unique_ptr<T, D>& p) const;
// };
#include <memory>
#include <cassert>
int main()
{
int* ptr = new int;
std::unique_ptr<int> p(ptr);
std::hash<std::unique_ptr<int> > f;
std::size_t h = f(p);
assert(h == std::hash<int*>()(ptr));
}
\ 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>
+
+// template <class T, class D>
+// struct hash<unique_ptr<T, D>>
+// {
+// typedef unique_ptr<T, D> argument_type;
+// typedef size_t result_type;
+// size_t operator()(const unique_ptr<T, D>& p) const;
+// };
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ int* ptr = new int;
+ std::unique_ptr<int> p(ptr);
+ std::hash<std::unique_ptr<int> > f;
+ std::size_t h = f(p);
+ assert(h == std::hash<int*>()(ptr));
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/test_allocator.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/test_allocator.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/test_allocator.h (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/test_allocator.h Sat Aug 21 19:59:46 2010
@@ -74,4 +74,4 @@
{return !(x == y);}
};
-#endif
+#endif // TEST_ALLOCATOR_H
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h Sat Aug 21 19:59:46 2010
@@ -1 +1,60 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// Example move-only deleter
#ifndef DELETER_H
#define DELETER_H
#include <type_traits>
#include <cassert>
struct test_deleter_base
{
static int count;
static int dealloc_count;
};
int test_deleter_base::count = 0;
int test_deleter_base::dealloc_count = 0;
template <class T>
class test_deleter
: public test_deleter_base
{
int state_;
public:
test_deleter() : state_(0) {++count;}
explicit test_deleter(int s) : state_(s) {++count;}
test_deleter(const test_deleter& d)
: state_(d.state_) {++count;}
~test_deleter() {assert(state_ >= 0); --count; state_ = -1;}
int st
ate() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {assert(state_ >= 0); ++dealloc_count; delete p;}
};
template <class T>
void
swap(test_deleter<T>& x, test_deleter<T>& y)
{
test_deleter<T> t(std::move(x));
x = std::move(y);
y = std::move(t);
}
#endif
\ 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>
+
+// shared_ptr
+
+// Example move-only deleter
+
+#ifndef DELETER_H
+#define DELETER_H
+
+#include <type_traits>
+#include <cassert>
+
+struct test_deleter_base
+{
+ static int count;
+ static int dealloc_count;
+};
+
+int test_deleter_base::count = 0;
+int test_deleter_base::dealloc_count = 0;
+
+template <class T>
+class test_deleter
+ : public test_deleter_base
+{
+ int state_;
+
+public:
+
+ test_deleter() : state_(0) {++count;}
+ explicit test_deleter(int s) : state_(s) {++count;}
+ test_deleter(const test_deleter& d)
+ : state_(d.state_) {++count;}
+ ~test_deleter() {assert(state_ >= 0); --count; state_ = -1;}
+
+ int state() const {return state_;}
+ void set_state(int i) {state_ = i;}
+
+ void operator()(T* p) {assert(state_ >= 0); ++dealloc_count; delete p;}
+};
+
+template <class T>
+void
+swap(test_deleter<T>& x, test_deleter<T>& y)
+{
+ test_deleter<T> t(std::move(x));
+ x = std::move(y);
+ y = std::move(t);
+}
+
+#endif // DELETER_H
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class T> class shared_ptr
// {
// public:
// typedef T element_type;
// ...
// };
#include <memory>
struct A; // purposefully incomplete
int main()
{
static_assert((std::is_same<std::shared_ptr<A>::element_type, A>::value), "");
}
\ 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>
+
+// template<class T> class shared_ptr
+// {
+// public:
+// typedef T element_type;
+// ...
+// };
+
+#include <memory>
+
+struct A; // purposefully incomplete
+
+int main()
+{
+ static_assert((std::is_same<std::shared_ptr<A>::element_type, A>::value), "");
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.getdeleter/get_deleter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.getdeleter/get_deleter.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.getdeleter/get_deleter.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.getdeleter/get_deleter.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,67 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class D, class T> D* get_deleter(const shared_ptr<T>& p);
#include <memory>
#include <cassert>
#include "../test_deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
{
A* ptr = new A;
std::shared_ptr<A> p(ptr, test_deleter<A>(3));
test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
assert(test_deleter<A>::count == 1);
assert(test_deleter<A>::dealloc_count == 0);
assert(d);
assert(d->state() == 3);
}
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
}
test_deleter<A>::dealloc_count = 0;
{
{
std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
assert(test_deleter<A>::count == 1);
assert(test_deleter<A>::dealloc_count == 0);
assert(d);
assert(d->state() == 3);
}
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
}
test_deleter<A>::dealloc_count = 0;
{
std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
std::default_delete<A>* d = std::get_deleter<std::default_delete<A> >(p);
assert(d == 0);
}
}
\ 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>
+
+// shared_ptr
+
+// template<class D, class T> D* get_deleter(const shared_ptr<T>& p);
+
+#include <memory>
+#include <cassert>
+#include "../test_deleter.h"
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ {
+ A* ptr = new A;
+ std::shared_ptr<A> p(ptr, test_deleter<A>(3));
+ test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+ assert(test_deleter<A>::count == 1);
+ assert(test_deleter<A>::dealloc_count == 0);
+ assert(d);
+ assert(d->state() == 3);
+ }
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+ }
+ test_deleter<A>::dealloc_count = 0;
+ {
+ {
+ std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
+ test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+ assert(test_deleter<A>::count == 1);
+ assert(test_deleter<A>::dealloc_count == 0);
+ assert(d);
+ assert(d->state() == 3);
+ }
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+ }
+ test_deleter<A>::dealloc_count = 0;
+ {
+ std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
+ std::default_delete<A>* d = std::get_deleter<std::default_delete<A> >(p);
+ assert(d == 0);
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,113 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y> shared_ptr& operator=(auto_ptr<Y>&& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::auto_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_ptr<B> pB(new B);
pB = pA;
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 1);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::auto_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<B> pB(new B);
pB = pA;
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 1);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::auto_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_ptr<B> pB;
pB = pA;
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 1);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::auto_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<B> pB;
pB = pA;
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 1);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class Y> shared_ptr& operator=(auto_ptr<Y>&& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::auto_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB(new B);
+ pB = pA;
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::auto_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB(new B);
+ pB = pA;
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 1);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::auto_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB;
+ pB = pA;
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::auto_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB;
+ pB = pA;
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 1);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,121 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// shared_ptr& operator=(const shared_ptr& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
const std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_ptr<A> pB(new A);
pB = pA;
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 2);
assert(pA.use_count() == 2);
assert(pA.get() == pB.get());
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
}
assert(B::count == 0);
assert(A::count == 0);
{
const std::shared_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<A> pB(new A);
pB = pA;
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
assert(pA.get() == pB.get());
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
const std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_ptr<A> p
B;
pB = pA;
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 2);
assert(pA.use_count() == 2);
assert(pA.get() == pB.get());
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
}
assert(B::count == 0);
assert(A::count == 0);
{
const std::shared_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<A> pB;
pB = pA;
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
assert(pA.get() == pB.get());
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// shared_ptr& operator=(const shared_ptr& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ const std::shared_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<A> pB(new A);
+ pB = pA;
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 2);
+ assert(pA.use_count() == 2);
+ assert(pA.get() == pB.get());
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ const std::shared_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<A> pB(new A);
+ pB = pA;
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == pB.get());
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ const std::shared_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<A> pB;
+ pB = pA;
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 2);
+ assert(pA.use_count() == 2);
+ assert(pA.get() == pB.get());
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ const std::shared_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<A> pB;
+ pB = pA;
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == pB.get());
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,121 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y> shared_ptr& operator=(const shared_ptr<Y>& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
const std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_ptr<B> pB(new B);
pB = pA;
assert(B::count == 1);
assert(A:
:count == 1);
assert(pB.use_count() == 2);
assert(pA.use_count() == 2);
assert(pA.get() == pB.get());
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
}
assert(B::count == 0);
assert(A::count == 0);
{
const std::shared_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<B> pB(new B);
pB = pA;
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
assert(pA.get() == pB.get());
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
const std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_ptr<B> pB;
pB = pA;
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 2);
assert(pA.use_count() == 2);
assert(pA.get() == pB.get());
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
}
assert(B::count == 0);
assert(A::count == 0);
{
const std::shared_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<B> pB;
pB = pA;
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
assert(pA.get() == pB.get());
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class Y> shared_ptr& operator=(const shared_ptr<Y>& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ const std::shared_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB(new B);
+ pB = pA;
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 2);
+ assert(pA.use_count() == 2);
+ assert(pA.get() == pB.get());
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ const std::shared_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB(new B);
+ pB = pA;
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == pB.get());
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ const std::shared_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB;
+ pB = pA;
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 2);
+ assert(pA.use_count() == 2);
+ assert(pA.get() == pB.get());
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ const std::shared_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB;
+ pB = pA;
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == pB.get());
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,121 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y> shared_ptr& operator=(shared_ptr<Y>&& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_ptr<B> pB(new B);
pB = std::move(pA);
assert(B::count == 1);
assert(A:
:count == 1);
assert(pB.use_count() == 1);
assert(pA.use_count() == 0);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::shared_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<B> pB(new B);
pB = std::move(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_pt
r<B> pB;
pB = std::move(pA);
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 1);
assert(pA.use_count() == 0);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::shared_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<B> pB;
pB = std::move(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class Y> shared_ptr& operator=(shared_ptr<Y>&& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB(new B);
+ pB = std::move(pA);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB(new B);
+ pB = std::move(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB;
+ pB = std::move(pA);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB;
+ pB = std::move(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,121 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// shared_ptr& operator=(shared_ptr&& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_ptr<A> pB(new A);
pB = std::move(pA);
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 1);
assert(pA.use_count() == 0);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::shared_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<A> pB(new A);
pB = std::move(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_ptr<A> pB;
pB = std::move(pA);
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 1);
assert(pA.use_count() == 0);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::shared_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<A> pB;
pB = std::move(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// shared_ptr& operator=(shared_ptr&& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<A> pB(new A);
+ pB = std::move(pA);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<A> pB(new A);
+ pB = std::move(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<A> pB;
+ pB = std::move(pA);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<A> pB;
+ pB = std::move(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,113 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template <class Y, class D> shared_ptr& operator=(unique_ptr<Y, D>&& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::unique_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_ptr<B> pB(new B);
pB = std::move(pA);
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 1);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::unique_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<B> pB(new B);
pB = std::move(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 1);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::unique_ptr<A> pA(new A);
A* ptrA = pA.get();
{
std::shared_ptr<B> pB;
pB = std::move(pA);
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count(
) == 1);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::unique_ptr<A> pA;
A* ptrA = pA.get();
{
std::shared_ptr<B> pB;
pB = std::move(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 1);
assert(pA.get() == 0);
assert(pB.get() == ptrA);
}
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template <class Y, class D> shared_ptr& operator=(unique_ptr<Y, D>&& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::unique_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB(new B);
+ pB = std::move(pA);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::unique_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB(new B);
+ pB = std::move(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 1);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::unique_ptr<A> pA(new A);
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB;
+ pB = std::move(pA);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::unique_ptr<A> pA;
+ A* ptrA = pA.get();
+ {
+ std::shared_ptr<B> pB;
+ pB = std::move(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 1);
+ assert(pA.get() == 0);
+ assert(pB.get() == ptrA);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/const_pointer_cast.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/const_pointer_cast.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/const_pointer_cast.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/const_pointer_cast.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class T, class U> shared_ptr<T> const_pointer_cast(const shared_ptr<U>& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
const std::shared_ptr<const A> pA(new A);
std::shared_ptr<A> pB = std::const_pointer_cast<A>(pA);
assert(pB.get() == pA.get());
assert(!pB.owner_befo
re(pA) && !pA.owner_before(pB));
}
{
const std::shared_ptr<const A> pA;
std::shared_ptr<A> pB = std::const_pointer_cast<A>(pA);
assert(pB.get() == pA.get());
assert(!pB.owner_before(pA) && !pA.owner_before(pB));
}
}
\ 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>
+
+// shared_ptr
+
+// template<class T, class U> shared_ptr<T> const_pointer_cast(const shared_ptr<U>& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ const std::shared_ptr<const A> pA(new A);
+ std::shared_ptr<A> pB = std::const_pointer_cast<A>(pA);
+ assert(pB.get() == pA.get());
+ assert(!pB.owner_before(pA) && !pA.owner_before(pB));
+ }
+ {
+ const std::shared_ptr<const A> pA;
+ std::shared_ptr<A> pB = std::const_pointer_cast<A>(pA);
+ assert(pB.get() == pA.get());
+ assert(!pB.owner_before(pA) && !pA.owner_before(pB));
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/dynamic_pointer_cast.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/dynamic_pointer_cast.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/dynamic_pointer_cast.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/dynamic_pointer_cast.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class T, class U> shared_ptr<T> dynamic_pointer_cast(const shared_ptr<U>& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
const std::shared_ptr<B> pB(new A);
std::shared_ptr<A> pA = std::dynamic_pointer_cast<A>(pB);
assert(pA.get() == pB.get());
assert(!pB.owner_before
(pA) && !pA.owner_before(pB));
}
{
const std::shared_ptr<B> pB(new B);
std::shared_ptr<A> pA = std::dynamic_pointer_cast<A>(pB);
assert(pA.get() == 0);
assert(pA.use_count() == 0);
}
}
\ 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>
+
+// shared_ptr
+
+// template<class T, class U> shared_ptr<T> dynamic_pointer_cast(const shared_ptr<U>& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ const std::shared_ptr<B> pB(new A);
+ std::shared_ptr<A> pA = std::dynamic_pointer_cast<A>(pB);
+ assert(pA.get() == pB.get());
+ assert(!pB.owner_before(pA) && !pA.owner_before(pB));
+ }
+ {
+ const std::shared_ptr<B> pB(new B);
+ std::shared_ptr<A> pA = std::dynamic_pointer_cast<A>(pB);
+ assert(pA.get() == 0);
+ assert(pA.use_count() == 0);
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/static_pointer_cast.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/static_pointer_cast.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/static_pointer_cast.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/static_pointer_cast.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,69 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class T, class U> shared_ptr<T> static_pointer_cast(const shared_ptr<U>& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
const std::shared_ptr<A> pA(new A);
std::shared_ptr<B> pB = std::static_pointer_cast<B>(pA);
assert(pB.get() == pA.get());
assert(!pB.owner_before(p
A) && !pA.owner_before(pB));
}
{
const std::shared_ptr<B> pA(new A);
std::shared_ptr<A> pB = std::static_pointer_cast<A>(pA);
assert(pB.get() == pA.get());
assert(!pB.owner_before(pA) && !pA.owner_before(pB));
}
{
const std::shared_ptr<A> pA;
std::shared_ptr<B> pB = std::static_pointer_cast<B>(pA);
assert(pB.get() == pA.get());
assert(!pB.owner_before(pA) && !pA.owner_before(pB));
}
{
const std::shared_ptr<B> pA;
std::shared_ptr<A> pB = std::static_pointer_cast<A>(pA);
assert(pB.get() == pA.get());
assert(!pB.owner_before(pA) && !pA.owner_before(pB));
}
}
\ 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>
+
+// shared_ptr
+
+// template<class T, class U> shared_ptr<T> static_pointer_cast(const shared_ptr<U>& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ const std::shared_ptr<A> pA(new A);
+ std::shared_ptr<B> pB = std::static_pointer_cast<B>(pA);
+ assert(pB.get() == pA.get());
+ assert(!pB.owner_before(pA) && !pA.owner_before(pB));
+ }
+ {
+ const std::shared_ptr<B> pA(new A);
+ std::shared_ptr<A> pB = std::static_pointer_cast<A>(pA);
+ assert(pB.get() == pA.get());
+ assert(!pB.owner_before(pA) && !pA.owner_before(pB));
+ }
+ {
+ const std::shared_ptr<A> pA;
+ std::shared_ptr<B> pB = std::static_pointer_cast<B>(pA);
+ assert(pB.get() == pA.get());
+ assert(!pB.owner_before(pA) && !pA.owner_before(pB));
+ }
+ {
+ const std::shared_ptr<B> pA;
+ std::shared_ptr<A> pB = std::static_pointer_cast<A>(pA);
+ assert(pB.get() == pA.get());
+ assert(!pB.owner_before(pA) && !pA.owner_before(pB));
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cmp/eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cmp/eq.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cmp/eq.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cmp/eq.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class T, class U> bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b);
// template<class T, class U> bool operator!=(const shared_ptr<T>& a, const shared_ptr<U>& b);
#include <memory>
#include <cassert>
void do_nothing(int*) {}
int main()
{
int* ptr1(new int);
int* ptr2(new int);
const std::shared_ptr<int> p1(ptr1);
const std::shared_ptr<int> p2(ptr2);
const std::shared_ptr<int> p3(ptr2, do_nothing);
assert(p1 != p2);
assert(p2 == p3);
}
\ 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>
+
+// shared_ptr
+
+// template<class T, class U> bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b);
+// template<class T, class U> bool operator!=(const shared_ptr<T>& a, const shared_ptr<U>& b);
+
+#include <memory>
+#include <cassert>
+
+void do_nothing(int*) {}
+
+int main()
+{
+ int* ptr1(new int);
+ int* ptr2(new int);
+ const std::shared_ptr<int> p1(ptr1);
+ const std::shared_ptr<int> p2(ptr2);
+ const std::shared_ptr<int> p3(ptr2, do_nothing);
+ assert(p1 != p2);
+ assert(p2 == p3);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cmp/lt.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cmp/lt.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cmp/lt.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cmp/lt.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,30 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class T, class U> bool operator<(const shared_ptr<T>& a, const shared_ptr<U>& b);
#include <memory>
#include <cassert>
void do_nothing(int*) {}
int main()
{
int* ptr1(new int);
int* ptr2(new int);
const std::shared_ptr<int> p1(ptr1);
const std::shared_ptr<int> p2(ptr2);
const std::shared_ptr<int> p3(ptr2, do_nothing);
assert((p1 < p2) == (ptr1 < ptr2));
assert(!(p2 < p3) && !(p3 < p2));
}
\ 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>
+
+// shared_ptr
+
+// template<class T, class U> bool operator<(const shared_ptr<T>& a, const shared_ptr<U>& b);
+
+#include <memory>
+#include <cassert>
+
+void do_nothing(int*) {}
+
+int main()
+{
+ int* ptr1(new int);
+ int* ptr2(new int);
+ const std::shared_ptr<int> p1(ptr1);
+ const std::shared_ptr<int> p2(ptr2);
+ const std::shared_ptr<int> p3(ptr2, do_nothing);
+ assert((p1 < p2) == (ptr1 < ptr2));
+ assert(!(p2 < p3) && !(p3 < p2));
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,94 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class Y> explicit shared_ptr(auto_ptr<Y>&& r);
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
bool throw_next = false;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
if (throw_next)
throw std::bad_alloc();
return std::malloc(s);
}
void operator delete(void* p) throw()
{
std::free(p);
}
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int m
ain()
{
{
std::auto_ptr<A> ptr(new A);
A* raw_ptr = ptr.get();
#ifdef _LIBCPP_MOVE
std::shared_ptr<B> p(std::move(ptr));
#else
std::shared_ptr<B> p(ptr);
#endif
assert(A::count == 1);
assert(B::count == 1);
assert(p.use_count() == 1);
assert(p.get() == raw_ptr);
assert(ptr.get() == 0);
}
assert(A::count == 0);
{
std::auto_ptr<A> ptr(new A);
A* raw_ptr = ptr.get();
throw_next = true;
try
{
#ifdef _LIBCPP_MOVE
std::shared_ptr<B> p(std::move(ptr));
#else
std::shared_ptr<B> p(ptr);
#endif
assert(false);
}
catch (...)
{
assert(A::count == 1);
assert(B::count == 1);
assert(ptr.get() == raw_ptr);
}
}
assert(A::count == 0);
}
\ 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>
+
+// template<class Y> explicit shared_ptr(auto_ptr<Y>&& r);
+
+#include <memory>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+bool throw_next = false;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+ if (throw_next)
+ throw std::bad_alloc();
+ return std::malloc(s);
+}
+
+void operator delete(void* p) throw()
+{
+ std::free(p);
+}
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::auto_ptr<A> ptr(new A);
+ A* raw_ptr = ptr.get();
+#ifdef _LIBCPP_MOVE
+ std::shared_ptr<B> p(std::move(ptr));
+#else
+ std::shared_ptr<B> p(ptr);
+#endif
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == raw_ptr);
+ assert(ptr.get() == 0);
+ }
+ assert(A::count == 0);
+ {
+ std::auto_ptr<A> ptr(new A);
+ A* raw_ptr = ptr.get();
+ throw_next = true;
+ try
+ {
+#ifdef _LIBCPP_MOVE
+ std::shared_ptr<B> p(std::move(ptr));
+#else
+ std::shared_ptr<B> p(ptr);
+#endif
+ assert(false);
+ }
+ catch (...)
+ {
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(ptr.get() == raw_ptr);
+ }
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/default.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/default.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,22 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr();
#include <memory>
#include <cassert>
int main()
{
std::shared_ptr<int> p;
assert(p.use_count() == 0);
assert(p.get() == 0);
}
\ 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>
+
+// shared_ptr();
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ std::shared_ptr<int> p;
+ assert(p.use_count() == 0);
+ assert(p.get() == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,22 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr(nullptr_t)
#include <memory>
#include <cassert>
int main()
{
std::shared_ptr<int> p(nullptr);
assert(p.use_count() == 0);
assert(p.get() == 0);
}
\ 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>
+
+// shared_ptr(nullptr_t)
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ std::shared_ptr<int> p(nullptr);
+ assert(p.use_count() == 0);
+ assert(p.get() == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,47 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class D> shared_ptr(nullptr_t, D d);
#include <memory>
#include <cassert>
#include "../test_deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
assert(A::count == 0);
assert(p.use_count() == 1);
assert(p.get() == 0);
test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
assert(test_deleter<A>::count == 1);
assert(test_deleter<A>::dealloc_count == 0);
assert(d);
assert(d->state() == 3);
}
assert(A::co
unt == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 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>
+
+// shared_ptr
+
+// template<class D> shared_ptr(nullptr_t, D d);
+
+#include <memory>
+#include <cassert>
+#include "../test_deleter.h"
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
+ assert(A::count == 0);
+ assert(p.use_count() == 1);
+ assert(p.get() == 0);
+ test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+ assert(test_deleter<A>::count == 1);
+ assert(test_deleter<A>::dealloc_count == 0);
+ assert(d);
+ assert(d->state() == 3);
+ }
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,50 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class D, class A> shared_ptr(nullptr_t, D d, A a);
#include <memory>
#include <cassert>
#include "../test_deleter.h"
#include "../test_allocator.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<A> p(nullptr, test_deleter<A>(3), test_allocator<A>(5));
assert(A::count == 0);
assert(p.use_count() == 1);
assert(p.get() == 0);
test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
assert(test_deleter<A>::count == 1);
assert(test_deleter<A>::dealloc_count == 0);
assert(d);
assert(d->state() == 3);
assert(test_allocator<A>::count == 1);
assert(test_allocator<A>::alloc_count == 1);
}
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
assert(test_allocator<A>::count == 0);
assert(test_allocator<A>::alloc_count == 0);
}
\ 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>
+
+// template<class D, class A> shared_ptr(nullptr_t, D d, A a);
+
+#include <memory>
+#include <cassert>
+#include "../test_deleter.h"
+#include "../test_allocator.h"
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<A> p(nullptr, test_deleter<A>(3), test_allocator<A>(5));
+ assert(A::count == 0);
+ assert(p.use_count() == 1);
+ assert(p.get() == 0);
+ test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+ assert(test_deleter<A>::count == 1);
+ assert(test_deleter<A>::dealloc_count == 0);
+ assert(d);
+ assert(d->state() == 3);
+ assert(test_allocator<A>::count == 1);
+ assert(test_allocator<A>::alloc_count == 1);
+ }
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+ assert(test_allocator<A>::count == 0);
+ assert(test_allocator<A>::alloc_count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class D, class A> shared_ptr(nullptr_t, D d, A a);
#include <memory>
#include <cassert>
#include "../test_deleter.h"
#include "../test_allocator.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
try
{
test_allocator<A>::throw_after = 0;
std::shared_ptr<A> p(nullptr, test_deleter<A>(3), test_allocator<A>(5));
assert(false);
}
catch (std::bad_alloc&)
{
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
assert(test_allocator<A>::count == 0);
assert(test_allocator<A>::alloc_count == 0);
}
}
\ 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>
+
+// template<class D, class A> shared_ptr(nullptr_t, D d, A a);
+
+#include <memory>
+#include <cassert>
+#include "../test_deleter.h"
+#include "../test_allocator.h"
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ try
+ {
+ test_allocator<A>::throw_after = 0;
+ std::shared_ptr<A> p(nullptr, test_deleter<A>(3), test_allocator<A>(5));
+ assert(false);
+ }
+ catch (std::bad_alloc&)
+ {
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+ assert(test_allocator<A>::count == 0);
+ assert(test_allocator<A>::alloc_count == 0);
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class D> shared_ptr(nullptr_t, D d);
#include <memory>
#include <cassert>
#include <new>
#include <cstdlib>
#include "../test_deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
bool throw_next = false;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
if (throw_next)
throw std::bad_alloc();
return std::malloc(s);
}
void operator delete(void* p) throw()
{
std::free(p);
}
int main()
{
throw_next = true;
try
{
std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
assert(false);
}
catch (std::bad_alloc&)
{
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 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>
+
+// shared_ptr
+
+// template<class D> shared_ptr(nullptr_t, D d);
+
+#include <memory>
+#include <cassert>
+#include <new>
+#include <cstdlib>
+#include "../test_deleter.h"
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+bool throw_next = false;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+ if (throw_next)
+ throw std::bad_alloc();
+ return std::malloc(s);
+}
+
+void operator delete(void* p) throw()
+{
+ std::free(p);
+}
+
+int main()
+{
+ throw_next = true;
+ try
+ {
+ std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
+ assert(false);
+ }
+ catch (std::bad_alloc&)
+ {
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class Y> explicit shared_ptr(Y* p);
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
A* ptr = new A;
std::shared_ptr<A> p(ptr);
assert(A::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
}
assert(A::count == 0);
{
A* ptr = new A;
std::shared_ptr<void> p(ptr);
assert(A::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
}
assert(A::count == 0);
}
\ 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>
+
+// template<class Y> explicit shared_ptr(Y* p);
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ A* ptr = new A;
+ std::shared_ptr<A> p(ptr);
+ assert(A::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == ptr);
+ }
+ assert(A::count == 0);
+ {
+ A* ptr = new A;
+ std::shared_ptr<void> p(ptr);
+ assert(A::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == ptr);
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y, class D> shared_ptr(Y* p, D d);
#include <memory>
#include <cassert>
#include "../test_deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
A* ptr = new A;
std::shared_ptr<A> p(ptr, test_deleter<A>(3));
assert(A::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
assert(test_deleter<A>::count == 1);
assert(test_deleter<A>::dealloc_count == 0);
assert(d);
assert(d->state() == 3);
}
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 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>
+
+// shared_ptr
+
+// template<class Y, class D> shared_ptr(Y* p, D d);
+
+#include <memory>
+#include <cassert>
+#include "../test_deleter.h"
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ A* ptr = new A;
+ std::shared_ptr<A> p(ptr, test_deleter<A>(3));
+ assert(A::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == ptr);
+ test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+ assert(test_deleter<A>::count == 1);
+ assert(test_deleter<A>::dealloc_count == 0);
+ assert(d);
+ assert(d->state() == 3);
+ }
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,51 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class Y, class D, class A> shared_ptr(Y* p, D d, A a);
#include <memory>
#include <cassert>
#include "../test_deleter.h"
#include "../test_allocator.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
A* ptr = new A;
std::shared_ptr<A> p(ptr, test_deleter<A>(3), test_allocator<A>(5));
assert(A::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
assert(test_deleter<A>::count == 1);
assert(test_deleter<A>::dealloc_count
== 0);
assert(d);
assert(d->state() == 3);
assert(test_allocator<A>::count == 1);
assert(test_allocator<A>::alloc_count == 1);
}
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
assert(test_allocator<A>::count == 0);
assert(test_allocator<A>::alloc_count == 0);
}
\ 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>
+
+// template<class Y, class D, class A> shared_ptr(Y* p, D d, A a);
+
+#include <memory>
+#include <cassert>
+#include "../test_deleter.h"
+#include "../test_allocator.h"
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ A* ptr = new A;
+ std::shared_ptr<A> p(ptr, test_deleter<A>(3), test_allocator<A>(5));
+ assert(A::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == ptr);
+ test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+ assert(test_deleter<A>::count == 1);
+ assert(test_deleter<A>::dealloc_count == 0);
+ assert(d);
+ assert(d->state() == 3);
+ assert(test_allocator<A>::count == 1);
+ assert(test_allocator<A>::alloc_count == 1);
+ }
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+ assert(test_allocator<A>::count == 0);
+ assert(test_allocator<A>::alloc_count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,47 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class Y, class D, class A> shared_ptr(Y* p, D d, A a);
#include <memory>
#include <cassert>
#include "../test_deleter.h"
#include "../test_allocator.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
A* ptr = new A;
try
{
test_allocator<A>::throw_after = 0;
std::shared_ptr<A> p(ptr, test_deleter<A>(3), test_allocator<A>(5));
assert(false);
}
catch (std::bad_alloc&)
{
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::deallo
c_count == 1);
assert(test_allocator<A>::count == 0);
assert(test_allocator<A>::alloc_count == 0);
}
}
\ 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>
+
+// template<class Y, class D, class A> shared_ptr(Y* p, D d, A a);
+
+#include <memory>
+#include <cassert>
+#include "../test_deleter.h"
+#include "../test_allocator.h"
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ A* ptr = new A;
+ try
+ {
+ test_allocator<A>::throw_after = 0;
+ std::shared_ptr<A> p(ptr, test_deleter<A>(3), test_allocator<A>(5));
+ assert(false);
+ }
+ catch (std::bad_alloc&)
+ {
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+ assert(test_allocator<A>::count == 0);
+ assert(test_allocator<A>::alloc_count == 0);
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,62 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y, class D> shared_ptr(Y* p, D d);
#include <memory>
#include <cassert>
#include <new>
#include <cstdlib>
#include "../test_deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
bool throw_next = false;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
if (throw_next)
throw std::bad_alloc();
return std::malloc(s);
}
void operator delete(void* p) throw()
{
std::free(p);
}
int main()
{
A* ptr = new A;
throw_next = true;
try
{
std::shared_ptr<A> p(ptr, test_dele
ter<A>(3));
assert(false);
}
catch (std::bad_alloc&)
{
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 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>
+
+// shared_ptr
+
+// template<class Y, class D> shared_ptr(Y* p, D d);
+
+#include <memory>
+#include <cassert>
+#include <new>
+#include <cstdlib>
+#include "../test_deleter.h"
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+bool throw_next = false;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+ if (throw_next)
+ throw std::bad_alloc();
+ return std::malloc(s);
+}
+
+void operator delete(void* p) throw()
+{
+ std::free(p);
+}
+
+int main()
+{
+ A* ptr = new A;
+ throw_next = true;
+ try
+ {
+ std::shared_ptr<A> p(ptr, test_deleter<A>(3));
+ assert(false);
+ }
+ catch (std::bad_alloc&)
+ {
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,60 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class Y> explicit shared_ptr(Y* p);
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
bool throw_next = false;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
if (throw_next)
throw std::bad_alloc();
return std::malloc(s);
}
void operator delete(void* p) throw()
{
std::free(p);
}
int main()
{
{
A* ptr = new A;
throw_next = true;
assert(A::count == 1);
try
{
std::shared_ptr<A> p(ptr);
assert(false);
}
catch (std::bad_alloc&)
{
assert(A::count == 0);
}
}
}
\ 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>
+
+// template<class Y> explicit shared_ptr(Y* p);
+
+#include <memory>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+bool throw_next = false;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+ if (throw_next)
+ throw std::bad_alloc();
+ return std::malloc(s);
+}
+
+void operator delete(void* p) throw()
+{
+ std::free(p);
+}
+
+int main()
+{
+ {
+ A* ptr = new A;
+ throw_next = true;
+ assert(A::count == 1);
+ try
+ {
+ std::shared_ptr<A> p(ptr);
+ assert(false);
+ }
+ catch (std::bad_alloc&)
+ {
+ assert(A::count == 0);
+ }
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,62 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// shared_ptr(const shared_ptr& r);
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<A> pA(new A);
assert(pA.use_count() == 1);
assert(A::count == 1);
{
std::shared_ptr<A> pA2(pA);
assert(A::count == 1);
assert(pA.use_count() == 2);
assert(pA2.use_count() == 2);
assert(pA2.get() == pA.get());
}
assert(pA.use_count() == 1);
assert(A::count == 1);
}
assert(A::count == 0);
{
std::shared_ptr<A> pA;
assert(pA.use_count() == 0);
assert(A::count == 0);
{
std::shared_ptr<A> pA2(pA);
assert(A::count == 0);
assert(pA.use_count() == 0);
assert(pA2.use_count() == 0);
assert(pA2.get() == pA.get());
}
assert(pA.use_count() == 0);
assert(A::count == 0);
}
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// shared_ptr(const shared_ptr& r);
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<A> pA(new A);
+ assert(pA.use_count() == 1);
+ assert(A::count == 1);
+ {
+ std::shared_ptr<A> pA2(pA);
+ assert(A::count == 1);
+ assert(pA.use_count() == 2);
+ assert(pA2.use_count() == 2);
+ assert(pA2.get() == pA.get());
+ }
+ assert(pA.use_count() == 1);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA;
+ assert(pA.use_count() == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA2(pA);
+ assert(A::count == 0);
+ assert(pA.use_count() == 0);
+ assert(pA2.use_count() == 0);
+ assert(pA2.get() == pA.get());
+ }
+ assert(pA.use_count() == 0);
+ assert(A::count == 0);
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,97 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y> shared_ptr(const shared_ptr<Y>& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
struct C
{
static int count;
C() {++count;}
C(const C&) {++count;}
virtual ~C() {--count;}
};
int C::count = 0;
int main()
{
static_assert(( std::is_convertible<std::shared_ptr<A>, std::shared_ptr<B> >::value
), "");
static_assert((!std::is_convertible<std::shared_ptr<B>, std::shared_ptr<A> >::value), "");
static_assert((!std::is_convertible<std::shared_ptr<A>, std::shared_ptr<C> >::value), "");
{
const std::shared_ptr<A> pA(new A);
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
{
std::shared_ptr<B> pB(pA);
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 2);
assert(pA.use_count() == 2);
assert(pA.get() == pB.get());
}
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::shared_ptr<A> pA;
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
{
std::shared_ptr<B> pB(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
assert(pA.get() == pB.get());
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class Y> shared_ptr(const shared_ptr<Y>& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct C
+{
+ static int count;
+
+ C() {++count;}
+ C(const C&) {++count;}
+ virtual ~C() {--count;}
+};
+
+int C::count = 0;
+
+int main()
+{
+ static_assert(( std::is_convertible<std::shared_ptr<A>, std::shared_ptr<B> >::value), "");
+ static_assert((!std::is_convertible<std::shared_ptr<B>, std::shared_ptr<A> >::value), "");
+ static_assert((!std::is_convertible<std::shared_ptr<A>, std::shared_ptr<C> >::value), "");
+ {
+ const std::shared_ptr<A> pA(new A);
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ {
+ std::shared_ptr<B> pB(pA);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 2);
+ assert(pA.use_count() == 2);
+ assert(pA.get() == pB.get());
+ }
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA;
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<B> pB(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == pB.get());
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,109 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y> shared_ptr(shared_ptr<Y>&& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
struct C
{
static int count;
C() {++count;}
C(const C&) {++count;}
virtual ~C() {--count;}
};
int C::count = 0;
int main()
{
static_assert(( std::is_convertible<std::shared_ptr<A>, std::shared_ptr<B> >::value), ""
);
static_assert((!std::is_convertible<std::shared_ptr<B>, std::shared_ptr<A> >::value), "");
static_assert((!std::is_convertible<std::shared_ptr<A>, std::shared_ptr<C> >::value), "");
{
std::shared_ptr<A> pA(new A);
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
{
B* p = pA.get();
std::shared_ptr<B> pB(std::move(pA));
assert(B::count == 1);
assert(A::count == 1);
#ifdef _LIBCPP_MOVE
assert(pB.use_count() == 1);
assert(pA.use_count() == 0);
#else
assert(pB.use_count() == 2);
assert(pA.use_count() == 2);
#endif
assert(p == pB.get());
}
#ifdef _LIBCPP_MOVE
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
#else
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
#endif
}
assert(B::c
ount == 0);
assert(A::count == 0);
{
std::shared_ptr<A> pA;
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
{
std::shared_ptr<B> pB(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
assert(pA.get() == pB.get());
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class Y> shared_ptr(shared_ptr<Y>&& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct C
+{
+ static int count;
+
+ C() {++count;}
+ C(const C&) {++count;}
+ virtual ~C() {--count;}
+};
+
+int C::count = 0;
+
+int main()
+{
+ static_assert(( std::is_convertible<std::shared_ptr<A>, std::shared_ptr<B> >::value), "");
+ static_assert((!std::is_convertible<std::shared_ptr<B>, std::shared_ptr<A> >::value), "");
+ static_assert((!std::is_convertible<std::shared_ptr<A>, std::shared_ptr<C> >::value), "");
+ {
+ std::shared_ptr<A> pA(new A);
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ {
+ B* p = pA.get();
+ std::shared_ptr<B> pB(std::move(pA));
+ assert(B::count == 1);
+ assert(A::count == 1);
+#ifdef _LIBCPP_MOVE
+ assert(pB.use_count() == 1);
+ assert(pA.use_count() == 0);
+#else // _LIBCPP_MOVE
+ assert(pB.use_count() == 2);
+ assert(pA.use_count() == 2);
+#endif // _LIBCPP_MOVE
+ assert(p == pB.get());
+ }
+#ifdef _LIBCPP_MOVE
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+#else // _LIBCPP_MOVE
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+#endif // _LIBCPP_MOVE
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA;
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<B> pB(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ assert(pA.get() == pB.get());
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y> shared_ptr(const shared_ptr<Y>& r, T *p);
#include <memory>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
~B() {--count;}
};
int B::count = 0;
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<A> pA(new A);
assert(pA.use_count() == 1);
{
B b;
std::shared_ptr<B> pB(pA, &b);
assert(A::count == 1);
assert(B::count == 1);
assert(pA.use_count() ==
2);
assert(pB.use_count() == 2);
assert(pB.get() == &b);
}
assert(pA.use_count() == 1);
assert(A::count == 1);
assert(B::count == 0);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class Y> shared_ptr(const shared_ptr<Y>& r, T *p);
+
+#include <memory>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<A> pA(new A);
+ assert(pA.use_count() == 1);
+ {
+ B b;
+ std::shared_ptr<B> pB(pA, &b);
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(pA.use_count() == 2);
+ assert(pB.use_count() == 2);
+ assert(pB.get() == &b);
+ }
+ assert(pA.use_count() == 1);
+ assert(A::count == 1);
+ assert(B::count == 0);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_rv.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_rv.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_rv.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,73 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// shared_ptr(shared_ptr&& r);
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<A> pA(new A);
assert(pA.use_count() == 1);
assert(A::count == 1);
{
A* p = pA.get();
std::shared_ptr<A> pA2(std::move(pA));
assert(A::count == 1);
#ifdef _LIBCPP_MOVE
assert(pA.use_count() == 0);
assert(pA2.use_count() == 1);
#else
assert(pA.use_count() == 2);
assert(pA2.use
_count() == 2);
#endif
assert(pA2.get() == p);
}
#ifdef _LIBCPP_MOVE
assert(pA.use_count() == 0);
assert(A::count == 0);
#else
assert(pA.use_count() == 1);
assert(A::count == 1);
#endif
}
assert(A::count == 0);
{
std::shared_ptr<A> pA;
assert(pA.use_count() == 0);
assert(A::count == 0);
{
std::shared_ptr<A> pA2(std::move(pA));
assert(A::count == 0);
assert(pA.use_count() == 0);
assert(pA2.use_count() == 0);
assert(pA2.get() == pA.get());
}
assert(pA.use_count() == 0);
assert(A::count == 0);
}
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// shared_ptr(shared_ptr&& r);
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<A> pA(new A);
+ assert(pA.use_count() == 1);
+ assert(A::count == 1);
+ {
+ A* p = pA.get();
+ std::shared_ptr<A> pA2(std::move(pA));
+ assert(A::count == 1);
+#ifdef _LIBCPP_MOVE
+ assert(pA.use_count() == 0);
+ assert(pA2.use_count() == 1);
+#else // _LIBCPP_MOVE
+ assert(pA.use_count() == 2);
+ assert(pA2.use_count() == 2);
+#endif // _LIBCPP_MOVE
+ assert(pA2.get() == p);
+ }
+#ifdef _LIBCPP_MOVE
+ assert(pA.use_count() == 0);
+ assert(A::count == 0);
+#else // _LIBCPP_MOVE
+ assert(pA.use_count() == 1);
+ assert(A::count == 1);
+#endif // _LIBCPP_MOVE
+ }
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA;
+ assert(pA.use_count() == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA2(std::move(pA));
+ assert(A::count == 0);
+ assert(pA.use_count() == 0);
+ assert(pA2.use_count() == 0);
+ assert(pA2.get() == pA.get());
+ }
+ assert(pA.use_count() == 0);
+ assert(A::count == 0);
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,86 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Y, class D> explicit shared_ptr(unique_ptr<Y, D>&&r);
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
bool throw_next = false;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
if (throw_next)
throw std::bad_alloc();
return std::malloc(s);
}
void operator delete(void* p) throw()
{
std::free(p);
}
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::cou
nt = 0;
int main()
{
{
std::unique_ptr<A> ptr(new A);
A* raw_ptr = ptr.get();
std::shared_ptr<B> p(std::move(ptr));
assert(A::count == 1);
assert(B::count == 1);
assert(p.use_count() == 1);
assert(p.get() == raw_ptr);
assert(ptr.get() == 0);
}
assert(A::count == 0);
{
std::unique_ptr<A> ptr(new A);
A* raw_ptr = ptr.get();
throw_next = true;
try
{
std::shared_ptr<B> p(std::move(ptr));
assert(false);
}
catch (...)
{
assert(A::count == 1);
assert(B::count == 1);
assert(ptr.get() == raw_ptr);
}
}
assert(A::count == 0);
}
\ 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>
+
+// template <class Y, class D> explicit shared_ptr(unique_ptr<Y, D>&&r);
+
+#include <memory>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+bool throw_next = false;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+ if (throw_next)
+ throw std::bad_alloc();
+ return std::malloc(s);
+}
+
+void operator delete(void* p) throw()
+{
+ std::free(p);
+}
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::unique_ptr<A> ptr(new A);
+ A* raw_ptr = ptr.get();
+ std::shared_ptr<B> p(std::move(ptr));
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == raw_ptr);
+ assert(ptr.get() == 0);
+ }
+ assert(A::count == 0);
+ {
+ std::unique_ptr<A> ptr(new A);
+ A* raw_ptr = ptr.get();
+ throw_next = true;
+ try
+ {
+ std::shared_ptr<B> p(std::move(ptr));
+ assert(false);
+ }
+ catch (...)
+ {
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(ptr.get() == raw_ptr);
+ }
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,79 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y> explicit shared_ptr(const weak_ptr<Y>& r);
#include <memory>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::weak_ptr<A> wp;
try
{
std::shared_ptr<A> sp(wp);
assert(false);
}
catch (std::bad_weak_ptr&)
{
}
assert(A::count == 0);
}
{
std::shared_ptr<A> sp0(new A);
std::weak_ptr<A> wp(sp0);
std::shared_ptr<A> sp(wp);
assert(sp.use_count() == 2);
assert(sp.get() == sp0.get());
assert(A::count == 1);
}
assert(A::count == 0);
{
std::shared_ptr<A> sp0(new A);
std::weak_ptr<A> wp(sp0);
sp0.reset();
try
{
std::shared_ptr<A> sp(wp);
assert(false);
}
catch (std::bad_weak_ptr&)
{
}
}
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class Y> explicit shared_ptr(const weak_ptr<Y>& r);
+
+#include <memory>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::weak_ptr<A> wp;
+ try
+ {
+ std::shared_ptr<A> sp(wp);
+ assert(false);
+ }
+ catch (std::bad_weak_ptr&)
+ {
+ }
+ assert(A::count == 0);
+ }
+ {
+ std::shared_ptr<A> sp0(new A);
+ std::weak_ptr<A> wp(sp0);
+ std::shared_ptr<A> sp(wp);
+ assert(sp.use_count() == 2);
+ assert(sp.get() == sp0.get());
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> sp0(new A);
+ std::weak_ptr<A> wp(sp0);
+ sp0.reset();
+ try
+ {
+ std::shared_ptr<A> sp(wp);
+ assert(false);
+ }
+ catch (std::bad_weak_ptr&)
+ {
+ }
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class T, class A, class... Args>
// shared_ptr<T> allocate_shared(const A& a, Args&&... args);
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
#include "../test_allocator.h"
int new_count = 0;
struct A
{
static int count;
A(int i, char c) : int_(i), char_(c) {++count;}
A(const A& a)
: int_(a.int_), char_(a.char_)
{++count;}
~A() {--count;}
int get_int() const {return int_;}
char get_char() const {return char_;}
private:
int int_;
char char_;
};
int A::count = 0;
int main()
{
{
int i = 67;
char c = 'e';
st
d::shared_ptr<A> p = std::allocate_shared<A>(test_allocator<A>(54), i, c);
assert(test_allocator<A>::alloc_count == 1);
assert(A::count == 1);
assert(p->get_int() == 67);
assert(p->get_char() == 'e');
}
assert(A::count == 0);
assert(test_allocator<A>::alloc_count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class T, class A, class... Args>
+// shared_ptr<T> allocate_shared(const A& a, Args&&... args);
+
+#include <memory>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include "../test_allocator.h"
+
+int new_count = 0;
+
+struct A
+{
+ static int count;
+
+ A(int i, char c) : int_(i), char_(c) {++count;}
+ A(const A& a)
+ : int_(a.int_), char_(a.char_)
+ {++count;}
+ ~A() {--count;}
+
+ int get_int() const {return int_;}
+ char get_char() const {return char_;}
+private:
+ int int_;
+ char char_;
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ int i = 67;
+ char c = 'e';
+ std::shared_ptr<A> p = std::allocate_shared<A>(test_allocator<A>(54), i, c);
+ assert(test_allocator<A>::alloc_count == 1);
+ assert(A::count == 1);
+ assert(p->get_int() == 67);
+ assert(p->get_char() == 'e');
+ }
+ assert(A::count == 0);
+ assert(test_allocator<A>::alloc_count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,66 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args);
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
int new_count = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_count;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
std::free(p);
}
struct A
{
static int count;
A(int i, char c) : int_(i), char_(c) {++count;}
A(const A& a)
: int_(a.int_), char_(a.char_)
{++count;}
~A() {--count;}
int get_int() const {return int_;}
char get_char() const {return char_;}
private:
int
int_;
char char_;
};
int A::count = 0;
int main()
{
int nc = new_count;
{
int i = 67;
char c = 'e';
std::shared_ptr<A> p = std::make_shared<A>(i, c);
assert(new_count == nc+1);
assert(A::count == 1);
assert(p->get_int() == 67);
assert(p->get_char() == 'e');
}
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args);
+
+#include <memory>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+int new_count = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+ ++new_count;
+ return std::malloc(s);
+}
+
+void operator delete(void* p) throw()
+{
+ std::free(p);
+}
+
+struct A
+{
+ static int count;
+
+ A(int i, char c) : int_(i), char_(c) {++count;}
+ A(const A& a)
+ : int_(a.int_), char_(a.char_)
+ {++count;}
+ ~A() {--count;}
+
+ int get_int() const {return int_;}
+ char get_char() const {return char_;}
+private:
+ int int_;
+ char char_;
+};
+
+int A::count = 0;
+
+int main()
+{
+ int nc = new_count;
+ {
+ int i = 67;
+ char c = 'e';
+ std::shared_ptr<A> p = std::make_shared<A>(i, c);
+ assert(new_count == nc+1);
+ assert(A::count == 1);
+ assert(p->get_int() == 67);
+ assert(p->get_char() == 'e');
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.dest/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.dest/tested_elsewhere.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.dest/tested_elsewhere.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.dest/tested_elsewhere.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,62 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// void reset();
#include <memory>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<B> p(new B);
p.reset();
assert(A::count == 0);
assert(B::count == 0);
assert(p.use_count() == 0);
assert(p.get() == 0);
}
assert(A::count == 0);
{
std::shared_ptr<B> p;
p.reset();
assert(A::count == 0);
assert(B::count == 0);
assert(p.use_count() == 0);
assert(p.get() == 0);
}
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// void reset();
+
+#include <memory>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<B> p(new B);
+ p.reset();
+ assert(A::count == 0);
+ assert(B::count == 0);
+ assert(p.use_count() == 0);
+ assert(p.get() == 0);
+ }
+ assert(A::count == 0);
+ {
+ std::shared_ptr<B> p;
+ p.reset();
+ assert(A::count == 0);
+ assert(B::count == 0);
+ assert(p.use_count() == 0);
+ assert(p.get() == 0);
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,64 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y> void reset(Y* p);
#include <memory>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<B> p(new B);
A* ptr = new A;
p.reset(ptr);
assert(A::count == 1);
assert(B::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
}
assert(A::count == 0);
{
std::shared_ptr<B> p;
A* ptr = new A;
p.reset(ptr);
assert(A::count == 1);
assert(B::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
}
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class Y> void reset(Y* p);
+
+#include <memory>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<B> p(new B);
+ A* ptr = new A;
+ p.reset(ptr);
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == ptr);
+ }
+ assert(A::count == 0);
+ {
+ std::shared_ptr<B> p;
+ A* ptr = new A;
+ p.reset(ptr);
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == ptr);
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,79 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y, class D> void reset(Y* p, D d);
#include <memory>
#include <cassert>
#include "../test_deleter.h"
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<B> p(new B);
A* ptr = new A;
p.reset(ptr, test_deleter<A>(3));
assert(A::count == 1);
assert(B::count == 1);
assert(p.use_count() == 1);
a
ssert(p.get() == ptr);
test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
assert(test_deleter<A>::count == 1);
assert(test_deleter<A>::dealloc_count == 0);
assert(d);
assert(d->state() == 3);
}
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
{
std::shared_ptr<B> p;
A* ptr = new A;
p.reset(ptr, test_deleter<A>(3));
assert(A::count == 1);
assert(B::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
assert(test_deleter<A>::count == 1);
assert(test_deleter<A>::dealloc_count == 1);
assert(d);
assert(d->state() == 3);
}
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 2);
}
\ 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>
+
+// shared_ptr
+
+// template<class Y, class D> void reset(Y* p, D d);
+
+#include <memory>
+#include <cassert>
+#include "../test_deleter.h"
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<B> p(new B);
+ A* ptr = new A;
+ p.reset(ptr, test_deleter<A>(3));
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == ptr);
+ test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+ assert(test_deleter<A>::count == 1);
+ assert(test_deleter<A>::dealloc_count == 0);
+ assert(d);
+ assert(d->state() == 3);
+ }
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+ {
+ std::shared_ptr<B> p;
+ A* ptr = new A;
+ p.reset(ptr, test_deleter<A>(3));
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == ptr);
+ test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+ assert(test_deleter<A>::count == 1);
+ assert(test_deleter<A>::dealloc_count == 1);
+ assert(d);
+ assert(d->state() == 3);
+ }
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 2);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter_allocator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter_allocator.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter_allocator.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter_allocator.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,88 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y, class D, class A> void reset(Y* p, D d, A a);
#include <memory>
#include <cassert>
#include "../test_deleter.h"
#include "../test_allocator.h"
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<B> p(new B);
A* ptr = new A;
p.reset(ptr, test_deleter<A>(3), test_allocator<A>(4));
assert(A::count == 1);
a
ssert(B::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
assert(test_deleter<A>::count == 1);
assert(test_deleter<A>::dealloc_count == 0);
assert(d);
assert(d->state() == 3);
assert(test_allocator<A>::count == 1);
assert(test_allocator<A>::alloc_count == 1);
}
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
assert(test_allocator<A>::count == 0);
assert(test_allocator<A>::alloc_count == 0);
{
std::shared_ptr<B> p;
A* ptr = new A;
p.reset(ptr, test_deleter<A>(3), test_allocator<A>(4));
assert(A::count == 1);
assert(B::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
assert(test_deleter<A>::count == 1);
assert(test_deleter<A>::dealloc_count == 1);
assert(d);
assert(d->state() == 3);
assert(test_allocator<A>::count == 1);
assert(test_allocator<A>::alloc_count == 1);
}
assert(A::count == 0);
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 2);
assert(test_allocator<A>::count == 0);
assert(test_allocator<A>::alloc_count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class Y, class D, class A> void reset(Y* p, D d, A a);
+
+#include <memory>
+#include <cassert>
+#include "../test_deleter.h"
+#include "../test_allocator.h"
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<B> p(new B);
+ A* ptr = new A;
+ p.reset(ptr, test_deleter<A>(3), test_allocator<A>(4));
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == ptr);
+ test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+ assert(test_deleter<A>::count == 1);
+ assert(test_deleter<A>::dealloc_count == 0);
+ assert(d);
+ assert(d->state() == 3);
+ assert(test_allocator<A>::count == 1);
+ assert(test_allocator<A>::alloc_count == 1);
+ }
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 1);
+ assert(test_allocator<A>::count == 0);
+ assert(test_allocator<A>::alloc_count == 0);
+ {
+ std::shared_ptr<B> p;
+ A* ptr = new A;
+ p.reset(ptr, test_deleter<A>(3), test_allocator<A>(4));
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(p.use_count() == 1);
+ assert(p.get() == ptr);
+ test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+ assert(test_deleter<A>::count == 1);
+ assert(test_deleter<A>::dealloc_count == 1);
+ assert(d);
+ assert(d->state() == 3);
+ assert(test_allocator<A>::count == 1);
+ assert(test_allocator<A>::alloc_count == 1);
+ }
+ assert(A::count == 0);
+ assert(test_deleter<A>::count == 0);
+ assert(test_deleter<A>::dealloc_count == 2);
+ assert(test_allocator<A>::count == 0);
+ assert(test_allocator<A>::alloc_count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/swap.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/swap.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,104 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// void swap(shared_ptr& r);
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
A* ptr1 = new A;
A* ptr2 = new A;
std::shared_ptr<A> p1(ptr1);
{
std::shared_ptr<A> p2(ptr2);
p1.swap(p2);
assert(p1.use_count() == 1);
assert(p1.get() == ptr2);
assert(p2.use_count() == 1);
assert(p2.get() == ptr1);
assert(A::count == 2);
}
assert(p1.use_count() == 1);
assert(p1.get() == ptr2);
assert(A::count == 1);
}
assert(A::count == 0);
{
A* ptr1 = new A;
A* ptr2 = 0;
std::shared_ptr<A> p1(ptr1);
{
std::shared_ptr<A> p2;
p1.swap(p2);
assert(p1.use_count() == 0);
assert(p1.get() == ptr2);
assert(p2.use_count() == 1);
assert(p2.get() == ptr1);
assert(A::count == 1);
}
assert(p1.use_count() == 0);
assert(p1.get() == ptr2);
assert(A::count == 0);
}
assert(A::count == 0);
{
A* ptr1 = 0;
A* ptr2 = new A;
std::shared_ptr<A> p1;
{
std::shared_ptr<A> p2(ptr2);
p1.swap(p2);
assert(p1.use_count() == 1);
assert(p1.get() == ptr2);
assert(p2.use_count() == 0);
assert(p2.get() == ptr1);
assert(A::count == 1);
}
assert(p1.use_count() == 1);
assert(p1.get() == ptr2);
assert(A::count == 1);
}
assert(A::count == 0);
{
A* ptr1 = 0;
A* ptr2 = 0;
std::shared_ptr<A> p1;
{
std::shared_ptr<A> p2;
p1.swap(p2);
assert(p1.use_count() == 0);
assert(p1.get() == ptr2);
assert(p2.use_count() == 0);
assert(p2.get() == ptr1);
assert(A::count == 0);
}
assert(p1.use_count() == 0);
assert(p1.get() == ptr2);
assert(A::count == 0);
}
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// void swap(shared_ptr& r);
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ A* ptr1 = new A;
+ A* ptr2 = new A;
+ std::shared_ptr<A> p1(ptr1);
+ {
+ std::shared_ptr<A> p2(ptr2);
+ p1.swap(p2);
+ assert(p1.use_count() == 1);
+ assert(p1.get() == ptr2);
+ assert(p2.use_count() == 1);
+ assert(p2.get() == ptr1);
+ assert(A::count == 2);
+ }
+ assert(p1.use_count() == 1);
+ assert(p1.get() == ptr2);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+ {
+ A* ptr1 = new A;
+ A* ptr2 = 0;
+ std::shared_ptr<A> p1(ptr1);
+ {
+ std::shared_ptr<A> p2;
+ p1.swap(p2);
+ assert(p1.use_count() == 0);
+ assert(p1.get() == ptr2);
+ assert(p2.use_count() == 1);
+ assert(p2.get() == ptr1);
+ assert(A::count == 1);
+ }
+ assert(p1.use_count() == 0);
+ assert(p1.get() == ptr2);
+ assert(A::count == 0);
+ }
+ assert(A::count == 0);
+ {
+ A* ptr1 = 0;
+ A* ptr2 = new A;
+ std::shared_ptr<A> p1;
+ {
+ std::shared_ptr<A> p2(ptr2);
+ p1.swap(p2);
+ assert(p1.use_count() == 1);
+ assert(p1.get() == ptr2);
+ assert(p2.use_count() == 0);
+ assert(p2.get() == ptr1);
+ assert(A::count == 1);
+ }
+ assert(p1.use_count() == 1);
+ assert(p1.get() == ptr2);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+ {
+ A* ptr1 = 0;
+ A* ptr2 = 0;
+ std::shared_ptr<A> p1;
+ {
+ std::shared_ptr<A> p2;
+ p1.swap(p2);
+ assert(p1.use_count() == 0);
+ assert(p1.get() == ptr2);
+ assert(p2.use_count() == 0);
+ assert(p2.get() == ptr1);
+ assert(A::count == 0);
+ }
+ assert(p1.use_count() == 0);
+ assert(p1.get() == ptr2);
+ assert(A::count == 0);
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/arrow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/arrow.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/arrow.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/arrow.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,29 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// T* operator->() const;
#include <memory>
#include <utility>
#include <cassert>
int main()
{
const std::shared_ptr<std::pair<int, int> > p(new std::pair<int, int>(3, 4));
assert(p->first == 3);
assert(p->second == 4);
p->first = 5;
p->second = 6;
assert(p->first == 5);
assert(p->second == 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>
+
+// shared_ptr
+
+// T* operator->() const;
+
+#include <memory>
+#include <utility>
+#include <cassert>
+
+int main()
+{
+ const std::shared_ptr<std::pair<int, int> > p(new std::pair<int, int>(3, 4));
+ assert(p->first == 3);
+ assert(p->second == 4);
+ p->first = 5;
+ p->second = 6;
+ assert(p->first == 5);
+ assert(p->second == 6);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/dereference.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/dereference.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/dereference.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/dereference.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// T& operator*() const;
#include <memory>
#include <cassert>
int main()
{
const std::shared_ptr<int> p(new int(32));
assert(*p == 32);
*p = 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>
+
+// shared_ptr
+
+// T& operator*() const;
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ const std::shared_ptr<int> p(new int(32));
+ assert(*p == 32);
+ *p = 3;
+ assert(*p == 3);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/op_bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/op_bool.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/op_bool.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/op_bool.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,29 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// explicit operator bool() const;
#include <memory>
#include <cassert>
int main()
{
{
const std::shared_ptr<int> p(new int(32));
assert(p);
}
{
const std::shared_ptr<int> p;
assert(!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>
+
+// shared_ptr
+
+// explicit operator bool() const;
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::shared_ptr<int> p(new int(32));
+ assert(p);
+ }
+ {
+ const std::shared_ptr<int> p;
+ assert(!p);
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,28 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template <class U> bool owner_before(shared_ptr<U> const& b) const;
#include <memory>
#include <cassert>
int main()
{
const std::shared_ptr<int> p1(new int);
const std::shared_ptr<int> p2 = p1;
const std::shared_ptr<int> p3(new int);
assert(!p1.owner_before(p2));
assert(!p2.owner_before(p1));
assert(p1.owner_before(p3) || p3.owner_before(p1));
assert(p3.owner_before(p1) == p3.owner_before(p2));
}
\ 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>
+
+// shared_ptr
+
+// template <class U> bool owner_before(shared_ptr<U> const& b) const;
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ const std::shared_ptr<int> p1(new int);
+ const std::shared_ptr<int> p2 = p1;
+ const std::shared_ptr<int> p3(new int);
+ assert(!p1.owner_before(p2));
+ assert(!p2.owner_before(p1));
+ assert(p1.owner_before(p3) || p3.owner_before(p1));
+ assert(p3.owner_before(p1) == p3.owner_before(p2));
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template <class U> bool owner_before(weak_ptr<U> const& b) const;
#include <memory>
#include <cassert>
int main()
{
const std::shared_ptr<int> p1(new int);
const std::shared_ptr<int> p2 = p1;
const std::shared_ptr<int> p3(new int);
const std::weak_ptr<int> w1(p1);
const std::weak_ptr<int> w2(p2);
const std::weak_ptr<int> w3(p3);
assert(!p1.owner_before(w2));
assert(!p2.owner_before(w1));
assert(p1.owner_before(w3) || p3.owner_before(w1));
assert(p3.owner_before(w1) == p3.owner_before(w2));
}
\ 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>
+
+// shared_ptr
+
+// template <class U> bool owner_before(weak_ptr<U> const& b) const;
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ const std::shared_ptr<int> p1(new int);
+ const std::shared_ptr<int> p2 = p1;
+ const std::shared_ptr<int> p3(new int);
+ const std::weak_ptr<int> w1(p1);
+ const std::weak_ptr<int> w2(p2);
+ const std::weak_ptr<int> w3(p3);
+ assert(!p1.owner_before(w2));
+ assert(!p2.owner_before(w1));
+ assert(p1.owner_before(w3) || p3.owner_before(w1));
+ assert(p3.owner_before(w1) == p3.owner_before(w2));
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/unique.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/unique.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/unique.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/unique.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,28 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// bool unique() const;
#include <memory>
#include <cassert>
int main()
{
const std::shared_ptr<int> p(new int(32));
assert(p.unique());
{
std::shared_ptr<int> p2 = p;
assert(!p.unique());
}
assert(p.unique());
}
\ 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>
+
+// shared_ptr
+
+// bool unique() const;
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ const std::shared_ptr<int> p(new int(32));
+ assert(p.unique());
+ {
+ std::shared_ptr<int> p2 = p;
+ assert(!p.unique());
+ }
+ assert(p.unique());
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.spec/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.spec/swap.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.spec/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.spec/swap.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,104 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b);
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
A* ptr1 = new A;
A* ptr2 = new A;
std::shared_ptr<A> p1(ptr1);
{
std::shared_ptr<A> p2(ptr2);
swap(p1, p2);
assert(p1.use_count() == 1);
assert(p1.get() == ptr2);
assert(p2.use_count() == 1);
assert(p2.get() == ptr1);
assert(A::count == 2);
}
assert(p1.use_count() == 1);
assert(p1.get() == ptr2);
assert(A::count == 1);
}
assert(A::count == 0);
{
A* ptr1 = new A;
A* ptr2 = 0;
std::shared_ptr<A> p1(ptr1);
{
std::shared_ptr<A> p2;
swap(p1, p2);
assert(p1.use_count() == 0);
assert(p1.get() == ptr2);
assert(p2.use_count() == 1);
assert(p2.get() == ptr1);
assert(A::count == 1);
}
assert(p1.use_count() == 0);
assert(p1.get() == ptr2);
assert(A::count == 0);
}
assert(A::count == 0);
{
A* ptr1 = 0;
A* ptr2 = new A;
std::shared_ptr<A> p1;
{
std::shared_ptr<A> p2(ptr2);
swap(p1, p2);
assert(p1.use_count() == 1);
assert(p1.get() == ptr2);
assert(p2.use_count() == 0);
assert(p2.get() == ptr1);
assert(A::count == 1);
}
assert(p1.use_count() == 1);
assert(p1.get() == ptr2);
assert(A::count == 1);
}
assert(A::count == 0);
{
A* ptr1 = 0;
A* ptr2 = 0;
std::shared_ptr<A> p1;
{
std::shared_ptr<A> p2;
swap(p1, p2);
assert(p1.use_count() == 0);
assert(p1.get() == ptr2);
assert(p2.use_count() == 0);
assert(p2.get() == ptr1);
assert(A::count == 0);
}
assert(p1.use_count() == 0);
assert(p1.get() == ptr2);
assert(A::count == 0);
}
assert(A::count == 0);
}
\ 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>
+
+// shared_ptr
+
+// template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b);
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ A* ptr1 = new A;
+ A* ptr2 = new A;
+ std::shared_ptr<A> p1(ptr1);
+ {
+ std::shared_ptr<A> p2(ptr2);
+ swap(p1, p2);
+ assert(p1.use_count() == 1);
+ assert(p1.get() == ptr2);
+ assert(p2.use_count() == 1);
+ assert(p2.get() == ptr1);
+ assert(A::count == 2);
+ }
+ assert(p1.use_count() == 1);
+ assert(p1.get() == ptr2);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+ {
+ A* ptr1 = new A;
+ A* ptr2 = 0;
+ std::shared_ptr<A> p1(ptr1);
+ {
+ std::shared_ptr<A> p2;
+ swap(p1, p2);
+ assert(p1.use_count() == 0);
+ assert(p1.get() == ptr2);
+ assert(p2.use_count() == 1);
+ assert(p2.get() == ptr1);
+ assert(A::count == 1);
+ }
+ assert(p1.use_count() == 0);
+ assert(p1.get() == ptr2);
+ assert(A::count == 0);
+ }
+ assert(A::count == 0);
+ {
+ A* ptr1 = 0;
+ A* ptr2 = new A;
+ std::shared_ptr<A> p1;
+ {
+ std::shared_ptr<A> p2(ptr2);
+ swap(p1, p2);
+ assert(p1.use_count() == 1);
+ assert(p1.get() == ptr2);
+ assert(p2.use_count() == 0);
+ assert(p2.get() == ptr1);
+ assert(A::count == 1);
+ }
+ assert(p1.use_count() == 1);
+ assert(p1.get() == ptr2);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+ {
+ A* ptr1 = 0;
+ A* ptr2 = 0;
+ std::shared_ptr<A> p1;
+ {
+ std::shared_ptr<A> p2;
+ swap(p1, p2);
+ assert(p1.use_count() == 0);
+ assert(p1.get() == ptr2);
+ assert(p2.use_count() == 0);
+ assert(p2.get() == ptr1);
+ assert(A::count == 0);
+ }
+ assert(p1.use_count() == 0);
+ assert(p1.get() == ptr2);
+ assert(A::count == 0);
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/types.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/types.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/types.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class T> class weak_ptr
// {
// public:
// typedef T element_type;
// ...
// };
#include <memory>
struct A; // purposefully incomplete
int main()
{
static_assert((std::is_same<std::weak_ptr<A>::element_type, A>::value), "");
}
\ 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>
+
+// template<class T> class weak_ptr
+// {
+// public:
+// typedef T element_type;
+// ...
+// };
+
+#include <memory>
+
+struct A; // purposefully incomplete
+
+int main()
+{
+ static_assert((std::is_same<std::weak_ptr<A>::element_type, A>::value), "");
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,74 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T> struct owner_less;
//
// template <class T>
// struct owner_less<shared_ptr<T> >
// : binary_function<shared_ptr<T>, shared_ptr<T>, bool>
// {
// typedef bool result_type;
// bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const;
// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
// };
//
// template <class T>
// struct owner_less<weak_ptr<T> >
// : binary_function<weak_ptr<T>, weak_ptr<T>, bool>
// {
// typedef bool result_type;
// bool operator()(weak_ptr<T> const&,
weak_ptr<T> const&) const;
// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
// };
#include <memory>
#include <cassert>
int main()
{
const std::shared_ptr<int> p1(new int);
const std::shared_ptr<int> p2 = p1;
const std::shared_ptr<int> p3(new int);
const std::weak_ptr<int> w1(p1);
const std::weak_ptr<int> w2(p2);
const std::weak_ptr<int> w3(p3);
{
typedef std::owner_less<std::shared_ptr<int> > CS;
CS cs;
assert(!cs(p1, p2));
assert(!cs(p2, p1));
assert(cs(p1 ,p3) || cs(p3, p1));
assert(cs(p3, p1) == cs(p3, p2));
assert(!cs(p1, w2));
assert(!cs(p2, w1));
assert(cs(p1, w3) || cs(p3, w1));
assert(cs(p3, w1) == cs(p3, w2));
}
{
typedef std::owner_less<std::weak_ptr<int> > CS;
CS cs;
assert(!cs(w1, w2));
assert(!cs(w2, w1));
assert(cs(w1, w3) || cs(w3, w1));
assert(cs(w3, w1) ==
cs(w3, w2));
assert(!cs(w1, p2));
assert(!cs(w2, p1));
assert(cs(w1, p3) || cs(w3, p1));
assert(cs(w3, p1) == cs(w3, p2));
}
}
\ 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>
+
+// template <class T> struct owner_less;
+//
+// template <class T>
+// struct owner_less<shared_ptr<T> >
+// : binary_function<shared_ptr<T>, shared_ptr<T>, bool>
+// {
+// typedef bool result_type;
+// bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const;
+// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
+// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
+// };
+//
+// template <class T>
+// struct owner_less<weak_ptr<T> >
+// : binary_function<weak_ptr<T>, weak_ptr<T>, bool>
+// {
+// typedef bool result_type;
+// bool operator()(weak_ptr<T> const&, weak_ptr<T> const&) const;
+// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
+// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
+// };
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ const std::shared_ptr<int> p1(new int);
+ const std::shared_ptr<int> p2 = p1;
+ const std::shared_ptr<int> p3(new int);
+ const std::weak_ptr<int> w1(p1);
+ const std::weak_ptr<int> w2(p2);
+ const std::weak_ptr<int> w3(p3);
+
+ {
+ typedef std::owner_less<std::shared_ptr<int> > CS;
+ CS cs;
+
+ assert(!cs(p1, p2));
+ assert(!cs(p2, p1));
+ assert(cs(p1 ,p3) || cs(p3, p1));
+ assert(cs(p3, p1) == cs(p3, p2));
+
+ assert(!cs(p1, w2));
+ assert(!cs(p2, w1));
+ assert(cs(p1, w3) || cs(p3, w1));
+ assert(cs(p3, w1) == cs(p3, w2));
+ }
+ {
+ typedef std::owner_less<std::weak_ptr<int> > CS;
+ CS cs;
+
+ assert(!cs(w1, w2));
+ assert(!cs(w2, w1));
+ assert(cs(w1, w3) || cs(w3, w1));
+ assert(cs(w3, w1) == cs(w3, w2));
+
+ assert(!cs(w1, p2));
+ assert(!cs(w2, p1));
+ assert(cs(w1, p3) || cs(w3, p1));
+ assert(cs(w3, p1) == cs(w3, p2));
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/shared_ptr_Y.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/shared_ptr_Y.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/shared_ptr_Y.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/shared_ptr_Y.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// template<class Y> weak_ptr& operator=(const shared_ptr<Y>& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
const std::shared_ptr<A> pA(new A);
{
std::weak_ptr<B> pB;
pB = pA;
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_c
ount() == 1);
assert(pA.use_count() == 1);
}
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// weak_ptr
+
+// template<class Y> weak_ptr& operator=(const shared_ptr<Y>& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ const std::shared_ptr<A> pA(new A);
+ {
+ std::weak_ptr<B> pB;
+ pB = pA;
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.use_count() == 1);
+ }
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/weak_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/weak_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/weak_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/weak_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,62 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// weak_ptr& operator=(const weak_ptr& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
const std::shared_ptr<A> ps(new A);
const std::weak_ptr<A> pA(ps);
{
std::weak_ptr<A> pB;
pB = pA;
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 1);
assert(pA.use_count() == 1);
}
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// weak_ptr
+
+// weak_ptr& operator=(const weak_ptr& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ const std::shared_ptr<A> ps(new A);
+ const std::weak_ptr<A> pA(ps);
+ {
+ std::weak_ptr<A> pB;
+ pB = pA;
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.use_count() == 1);
+ }
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/weak_ptr_Y.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/weak_ptr_Y.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/weak_ptr_Y.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/weak_ptr_Y.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,62 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// template<class Y> weak_ptr& operator=(const weak_ptr<Y>& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
const std::shared_ptr<A> ps(new A);
const std::weak_ptr<A> pA(ps);
{
std::weak_ptr<B> pB;
pB = pA;
assert(B::count == 1);
assert(A::cou
nt == 1);
assert(pB.use_count() == 1);
assert(pA.use_count() == 1);
}
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// weak_ptr
+
+// template<class Y> weak_ptr& operator=(const weak_ptr<Y>& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ const std::shared_ptr<A> ps(new A);
+ const std::weak_ptr<A> pA(ps);
+ {
+ std::weak_ptr<B> pB;
+ pB = pA;
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.use_count() == 1);
+ }
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/default.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/default.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class T> class weak_ptr
// weak_ptr();
#include <memory>
#include <cassert>
struct A;
int main()
{
std::weak_ptr<A> p;
assert(p.use_count() == 0);
}
\ 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>
+
+// template<class T> class weak_ptr
+
+// weak_ptr();
+
+#include <memory>
+#include <cassert>
+
+struct A;
+
+int main()
+{
+ std::weak_ptr<A> p;
+ assert(p.use_count() == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/shared_ptr_Y.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/shared_ptr_Y.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/shared_ptr_Y.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/shared_ptr_Y.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,95 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// template<class Y> weak_ptr(const shared_ptr<Y>& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
struct C
{
static int count;
C() {++count;}
C(const C&) {++count;}
virtual ~C() {--count;}
};
int C::count = 0;
int main()
{
static_assert(( std::is_convertible<std::shared_ptr<A>, std::weak_ptr<B> >::value), "")
;
static_assert((!std::is_convertible<std::weak_ptr<B>, std::shared_ptr<A> >::value), "");
static_assert((!std::is_convertible<std::shared_ptr<A>, std::weak_ptr<C> >::value), "");
{
const std::shared_ptr<A> pA(new A);
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
{
std::weak_ptr<B> pB(pA);
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 1);
assert(pA.use_count() == 1);
}
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::shared_ptr<A> pA;
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
{
std::weak_ptr<B> pB(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count
() == 0);
assert(pA.use_count() == 0);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// weak_ptr
+
+// template<class Y> weak_ptr(const shared_ptr<Y>& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct C
+{
+ static int count;
+
+ C() {++count;}
+ C(const C&) {++count;}
+ virtual ~C() {--count;}
+};
+
+int C::count = 0;
+
+int main()
+{
+ static_assert(( std::is_convertible<std::shared_ptr<A>, std::weak_ptr<B> >::value), "");
+ static_assert((!std::is_convertible<std::weak_ptr<B>, std::shared_ptr<A> >::value), "");
+ static_assert((!std::is_convertible<std::shared_ptr<A>, std::weak_ptr<C> >::value), "");
+ {
+ const std::shared_ptr<A> pA(new A);
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ {
+ std::weak_ptr<B> pB(pA);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.use_count() == 1);
+ }
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> pA;
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::weak_ptr<B> pB(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,93 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// weak_ptr(const weak_ptr& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
struct C
{
static int count;
C() {++count;}
C(const C&) {++count;}
virtual ~C() {--count;}
};
int C::count = 0;
int main()
{
{
const std::shared_ptr<A> ps(new A);
const std::weak_ptr<A> pA(ps);
assert(pA.use_cou
nt() == 1);
assert(B::count == 1);
assert(A::count == 1);
{
std::weak_ptr<A> pB(pA);
assert(B::count == 1);
assert(A::count == 1);
assert(pB.use_count() == 1);
assert(pA.use_count() == 1);
}
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::weak_ptr<A> pA;
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
{
std::weak_ptr<A> pB(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// weak_ptr
+
+// weak_ptr(const weak_ptr& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct C
+{
+ static int count;
+
+ C() {++count;}
+ C(const C&) {++count;}
+ virtual ~C() {--count;}
+};
+
+int C::count = 0;
+
+int main()
+{
+ {
+ const std::shared_ptr<A> ps(new A);
+ const std::weak_ptr<A> pA(ps);
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ {
+ std::weak_ptr<A> pB(pA);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ assert(pB.use_count() == 1);
+ assert(pA.use_count() == 1);
+ }
+ assert(pA.use_count() == 1);
+ assert(B::count == 1);
+ assert(A::count == 1);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::weak_ptr<A> pA;
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::weak_ptr<A> pB(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr_Y.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr_Y.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr_Y.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr_Y.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,95 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// template<class Y> weak_ptr(const weak_ptr<Y>& r);
#include <memory>
#include <type_traits>
#include <cassert>
struct B
{
static int count;
B() {++count;}
B(const B&) {++count;}
virtual ~B() {--count;}
};
int B::count = 0;
struct A
: public B
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
struct C
{
static int count;
C() {++count;}
C(const C&) {++count;}
virtual ~C() {--count;}
};
int C::count = 0;
int main()
{
static_assert(( std::is_convertible<std::weak_ptr<A>, std::weak_ptr<B> >::value), "");
static_assert((!std::is_convertible<std::weak_ptr<B>, std::weak_ptr<A> >::value), "");
static_assert((!std::is_convertible<std::weak_ptr<A>, std::weak_ptr<C> >::value), "");
{
const std::weak_ptr<A> pA(std::shared_ptr<A>(new A));
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
{
std::weak_ptr<B> pB(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.use_count() == 0);
assert(pA.use_count() == 0);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
{
std::weak_ptr<A> pA;
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
{
std::weak_ptr<B> pB(pA);
assert(B::count == 0);
assert(A::count == 0);
assert(pB.u
se_count() == 0);
assert(pA.use_count() == 0);
}
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
}
assert(B::count == 0);
assert(A::count == 0);
}
\ 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>
+
+// weak_ptr
+
+// template<class Y> weak_ptr(const weak_ptr<Y>& r);
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+struct B
+{
+ static int count;
+
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+struct A
+ : public B
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct C
+{
+ static int count;
+
+ C() {++count;}
+ C(const C&) {++count;}
+ virtual ~C() {--count;}
+};
+
+int C::count = 0;
+
+int main()
+{
+ static_assert(( std::is_convertible<std::weak_ptr<A>, std::weak_ptr<B> >::value), "");
+ static_assert((!std::is_convertible<std::weak_ptr<B>, std::weak_ptr<A> >::value), "");
+ static_assert((!std::is_convertible<std::weak_ptr<A>, std::weak_ptr<C> >::value), "");
+ {
+ const std::weak_ptr<A> pA(std::shared_ptr<A>(new A));
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::weak_ptr<B> pB(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::weak_ptr<A> pA;
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ {
+ std::weak_ptr<B> pB(pA);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ assert(pB.use_count() == 0);
+ assert(pA.use_count() == 0);
+ }
+ assert(pA.use_count() == 0);
+ assert(B::count == 0);
+ assert(A::count == 0);
+ }
+ assert(B::count == 0);
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.dest/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.dest/tested_elsewhere.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.dest/tested_elsewhere.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.dest/tested_elsewhere.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.mod/reset.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.mod/reset.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.mod/reset.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.mod/reset.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,41 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// void swap(weak_ptr& r);
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::shared_ptr<A> p1(new A);
std::weak_ptr<A> w1(p1);
assert(w1.use_count() == 1);
w1.reset();
assert(w1.use_count() == 0);
assert(p1.use_count() == 1);
}
assert(A::count == 0);
}
\ 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>
+
+// weak_ptr
+
+// void swap(weak_ptr& r);
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::shared_ptr<A> p1(new A);
+ std::weak_ptr<A> w1(p1);
+ assert(w1.use_count() == 1);
+ w1.reset();
+ assert(w1.use_count() == 0);
+ assert(p1.use_count() == 1);
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.mod/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.mod/swap.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.mod/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.mod/swap.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,49 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// void swap(weak_ptr& r);
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
A* ptr1 = new A;
A* ptr2 = new A;
std::shared_ptr<A> p1(ptr1);
std::weak_ptr<A> w1(p1);
{
std::shared_ptr<A> p2(ptr2);
std::weak_ptr<A> w2(p2);
w1.swap(w2);
assert(w1.use_count() == 1);
assert(w1.lock().get() == ptr2);
assert(w2.use_count() == 1);
assert(w2.lock().get() == ptr1);
assert(A::count == 2);
}
}
assert(A::count == 0);
}
\ 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>
+
+// weak_ptr
+
+// void swap(weak_ptr& r);
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ A* ptr1 = new A;
+ A* ptr2 = new A;
+ std::shared_ptr<A> p1(ptr1);
+ std::weak_ptr<A> w1(p1);
+ {
+ std::shared_ptr<A> p2(ptr2);
+ std::weak_ptr<A> w2(p2);
+ w1.swap(w2);
+ assert(w1.use_count() == 1);
+ assert(w1.lock().get() == ptr2);
+ assert(w2.use_count() == 1);
+ assert(w2.lock().get() == ptr1);
+ assert(A::count == 2);
+ }
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/expired.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/expired.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/expired.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/expired.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// bool expired() const;
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::weak_ptr<A> wp;
assert(wp.use_count() == 0);
assert(wp.expired() == (wp.use_count() == 0));
}
{
std::shared_ptr<A> sp0(new A);
std::weak_ptr<A> wp(sp0);
assert(wp.use_count() == 1);
assert(wp.expired() == (wp.use_count() == 0));
sp0.reset();
assert(wp.use_count() == 0);
assert(wp.expired() == (wp.use_count() == 0));
}
}
\ 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>
+
+// weak_ptr
+
+// bool expired() const;
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::weak_ptr<A> wp;
+ assert(wp.use_count() == 0);
+ assert(wp.expired() == (wp.use_count() == 0));
+ }
+ {
+ std::shared_ptr<A> sp0(new A);
+ std::weak_ptr<A> wp(sp0);
+ assert(wp.use_count() == 1);
+ assert(wp.expired() == (wp.use_count() == 0));
+ sp0.reset();
+ assert(wp.use_count() == 0);
+ assert(wp.expired() == (wp.use_count() == 0));
+ }
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/lock.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/lock.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/lock.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/lock.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// shared_ptr<T> lock() const;
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::weak_ptr<A> wp;
std::shared_ptr<A> sp = wp.lock();
assert(sp.use_count() == 0);
assert(sp.get() == 0);
assert(A::count == 0);
}
{
std::shared_ptr<A> sp0(new A);
std::weak_ptr<A> wp(sp0);
std::shared_ptr<A> sp = wp.lock();
assert(sp.use_count() == 2);
assert(sp.get() == sp0.get());
assert(A::count == 1);
}
assert(A::count == 0);
{
std::shared_ptr<A> sp0(new A);
std::weak_ptr<A> wp(sp0);
sp0.reset();
std::shared_ptr<A> sp = wp.lock();
assert(sp.use_count() == 0);
assert(sp.get() == 0);
assert(A::count == 0);
}
assert(A::count == 0);
}
\ 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>
+
+// weak_ptr
+
+// shared_ptr<T> lock() const;
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ std::weak_ptr<A> wp;
+ std::shared_ptr<A> sp = wp.lock();
+ assert(sp.use_count() == 0);
+ assert(sp.get() == 0);
+ assert(A::count == 0);
+ }
+ {
+ std::shared_ptr<A> sp0(new A);
+ std::weak_ptr<A> wp(sp0);
+ std::shared_ptr<A> sp = wp.lock();
+ assert(sp.use_count() == 2);
+ assert(sp.get() == sp0.get());
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+ {
+ std::shared_ptr<A> sp0(new A);
+ std::weak_ptr<A> wp(sp0);
+ sp0.reset();
+ std::shared_ptr<A> sp = wp.lock();
+ assert(sp.use_count() == 0);
+ assert(sp.get() == 0);
+ assert(A::count == 0);
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/not_less_than.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/not_less_than.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/not_less_than.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/not_less_than.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T> class weak_ptr;
//
// not less than comparable
#include <memory>
#include <cassert>
int main()
{
const std::shared_ptr<int> p1(new int);
const std::shared_ptr<int> p2(new int);
const std::weak_ptr<int> w1(p1);
const std::weak_ptr<int> w2(p2);
bool b = w1 < w2;
}
\ 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>
+
+// template <class T> class weak_ptr;
+//
+// not less than comparable
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ const std::shared_ptr<int> p1(new int);
+ const std::shared_ptr<int> p2(new int);
+ const std::weak_ptr<int> w1(p1);
+ const std::weak_ptr<int> w2(p2);
+
+ bool b = w1 < w2;
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// template<class U> bool owner_before(const shared_ptr<U>& b);
#include <memory>
#include <cassert>
int main()
{
const std::shared_ptr<int> p1(new int);
const std::shared_ptr<int> p2 = p1;
const std::shared_ptr<int> p3(new int);
const std::weak_ptr<int> w1(p1);
const std::weak_ptr<int> w2(p2);
const std::weak_ptr<int> w3(p3);
assert(!w1.owner_before(p2));
assert(!w2.owner_before(p1));
assert(w1.owner_before(p3) || w3.owner_before(p1));
assert(w3.owner_before(p1) == w3.owner_before(p2));
}
\ 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>
+
+// weak_ptr
+
+// template<class U> bool owner_before(const shared_ptr<U>& b);
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ const std::shared_ptr<int> p1(new int);
+ const std::shared_ptr<int> p2 = p1;
+ const std::shared_ptr<int> p3(new int);
+ const std::weak_ptr<int> w1(p1);
+ const std::weak_ptr<int> w2(p2);
+ const std::weak_ptr<int> w3(p3);
+ assert(!w1.owner_before(p2));
+ assert(!w2.owner_before(p1));
+ assert(w1.owner_before(p3) || w3.owner_before(p1));
+ assert(w3.owner_before(p1) == w3.owner_before(p2));
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// template<class U> bool owner_before(const weak_ptr<U>& b);
#include <memory>
#include <cassert>
int main()
{
const std::shared_ptr<int> p1(new int);
const std::shared_ptr<int> p2 = p1;
const std::shared_ptr<int> p3(new int);
const std::weak_ptr<int> w1(p1);
const std::weak_ptr<int> w2(p2);
const std::weak_ptr<int> w3(p3);
assert(!w1.owner_before(w2));
assert(!w2.owner_before(w1));
assert(w1.owner_before(w3) || w3.owner_before(w1));
assert(w3.owner_before(w1) == w3.owner_before(w2));
}
\ 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>
+
+// weak_ptr
+
+// template<class U> bool owner_before(const weak_ptr<U>& b);
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ const std::shared_ptr<int> p1(new int);
+ const std::shared_ptr<int> p2 = p1;
+ const std::shared_ptr<int> p3(new int);
+ const std::weak_ptr<int> w1(p1);
+ const std::weak_ptr<int> w2(p2);
+ const std::weak_ptr<int> w3(p3);
+ assert(!w1.owner_before(w2));
+ assert(!w2.owner_before(w1));
+ assert(w1.owner_before(w3) || w3.owner_before(w1));
+ assert(w3.owner_before(w1) == w3.owner_before(w2));
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.spec/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.spec/swap.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.spec/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.spec/swap.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,49 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// weak_ptr
// template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b)
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
A* ptr1 = new A;
A* ptr2 = new A;
std::shared_ptr<A> p1(ptr1);
std::weak_ptr<A> w1(p1);
{
std::shared_ptr<A> p2(ptr2);
std::weak_ptr<A> w2(p2);
swap(w1, w2);
assert(w1.use_count() == 1);
assert(w1.lock().get() == ptr2);
assert(w2.use_count() == 1);
asse
rt(w2.lock().get() == ptr1);
assert(A::count == 2);
}
}
assert(A::count == 0);
}
\ 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>
+
+// weak_ptr
+
+// template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b)
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+ static int count;
+
+ A() {++count;}
+ A(const A&) {++count;}
+ ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+ {
+ A* ptr1 = new A;
+ A* ptr2 = new A;
+ std::shared_ptr<A> p1(ptr1);
+ std::weak_ptr<A> w1(p1);
+ {
+ std::shared_ptr<A> p2(ptr2);
+ std::weak_ptr<A> w2(p2);
+ swap(w1, w2);
+ assert(w1.use_count() == 1);
+ assert(w1.lock().get() == ptr2);
+ assert(w2.use_count() == 1);
+ assert(w2.lock().get() == ptr1);
+ assert(A::count == 2);
+ }
+ }
+ assert(A::count == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weakptr/bad_weak_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weakptr/bad_weak_ptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weakptr/bad_weak_ptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weakptr/bad_weak_ptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// class bad_weak_ptr
// : public std::exception
// {
// public:
// bad_weak_ptr();
// };
#include <memory>
#include <type_traits>
#include <cassert>
#include <cstring>
int main()
{
static_assert((std::is_base_of<std::exception, std::bad_weak_ptr>::value), "");
std::bad_weak_ptr e;
std::bad_weak_ptr e2 = e;
e2 = e;
assert(std::strcmp(e.what(), "bad_weak_ptr") == 0);
}
\ 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>
+
+// class bad_weak_ptr
+// : public std::exception
+// {
+// public:
+// bad_weak_ptr();
+// };
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+#include <cstring>
+
+int main()
+{
+ static_assert((std::is_base_of<std::exception, std::bad_weak_ptr>::value), "");
+ std::bad_weak_ptr e;
+ std::bad_weak_ptr e2 = e;
+ e2 = e;
+ assert(std::strcmp(e.what(), "bad_weak_ptr") == 0);
+}
Modified: libcxx/trunk/test/utilities/memory/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/version.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/version.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/version.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,20 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
#include <memory>
#ifndef _LIBCPP_VERSION
#error _LIBCPP_VERSION not defined
#endif
int main()
{
}
\ 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>
+
+#include <memory>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/meta/meta.hel/integral_constant.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.hel/integral_constant.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.hel/integral_constant.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.hel/integral_constant.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,36 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// integral_constant
#include <type_traits>
int main()
{
typedef std::integral_constant<int, 5> _5;
static_assert(_5::value == 5, "");
static_assert((std::is_same<_5::value_type, int>::value), "");
static_assert((std::is_same<_5::type, _5>::value), "");
static_assert(std::false_type::value == false, "");
static_assert((std::is_same<std::false_type::value_type, bool>::value), "");
static_assert((std::is_same<std::false_type::type, std::false_type>::value), "");
static_assert(std::true_type::value == true, "");
static_assert((std::is_same<std::true_type::value_type, bool>::value), "");
static_assert((std::is_same<std::true_type::type, std::true_type>::value), "");
std::false_type f1;
std::false_type f2 = f1;
std::true_type t1;
std::true_type t2 = t1;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// integral_constant
+
+#include <type_traits>
+
+int main()
+{
+ typedef std::integral_constant<int, 5> _5;
+ static_assert(_5::value == 5, "");
+ static_assert((std::is_same<_5::value_type, int>::value), "");
+ static_assert((std::is_same<_5::type, _5>::value), "");
+
+ static_assert(std::false_type::value == false, "");
+ static_assert((std::is_same<std::false_type::value_type, bool>::value), "");
+ static_assert((std::is_same<std::false_type::type, std::false_type>::value), "");
+
+ static_assert(std::true_type::value == true, "");
+ static_assert((std::is_same<std::true_type::value_type, bool>::value), "");
+ static_assert((std::is_same<std::true_type::type, std::true_type>::value), "");
+
+ std::false_type f1;
+ std::false_type f2 = f1;
+
+ std::true_type t1;
+ std::true_type t2 = t1;
+}
Modified: libcxx/trunk/test/utilities/meta/meta.rel/is_base_of.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.rel/is_base_of.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.rel/is_base_of.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.rel/is_base_of.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,50 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_base_of
#include <type_traits>
template <class T, class U>
void test_is_base_of()
{
static_assert((std::is_base_of<T, U>::value), "");
static_assert((std::is_base_of<const T, U>::value), "");
static_assert((std::is_base_of<T, const U>::value), "");
static_assert((std::is_base_of<const T, const U>::value), "");
}
template <class T, class U>
void test_is_not_base_of()
{
static_assert((!std::is_base_of<T, U>::value), "");
}
struct B {};
struct B1 : B {};
struct B2 : B {};
struct D : private B1, private B2 {};
int main()
{
test_is_base_of<B, D>();
test_is_base_of<B1, D>();
test_is_base
_of<B2, D>();
test_is_base_of<B, B1>();
test_is_base_of<B, B2>();
test_is_base_of<B, B>();
test_is_not_base_of<D, B>();
test_is_not_base_of<B&, D&>();
test_is_not_base_of<B[3], D[3]>();
test_is_not_base_of<int, int>();
test_is_not_base_of<int, int>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_base_of
+
+#include <type_traits>
+
+template <class T, class U>
+void test_is_base_of()
+{
+ static_assert((std::is_base_of<T, U>::value), "");
+ static_assert((std::is_base_of<const T, U>::value), "");
+ static_assert((std::is_base_of<T, const U>::value), "");
+ static_assert((std::is_base_of<const T, const U>::value), "");
+}
+
+template <class T, class U>
+void test_is_not_base_of()
+{
+ static_assert((!std::is_base_of<T, U>::value), "");
+}
+
+struct B {};
+struct B1 : B {};
+struct B2 : B {};
+struct D : private B1, private B2 {};
+
+int main()
+{
+ test_is_base_of<B, D>();
+ test_is_base_of<B1, D>();
+ test_is_base_of<B2, D>();
+ test_is_base_of<B, B1>();
+ test_is_base_of<B, B2>();
+ test_is_base_of<B, B>();
+
+ test_is_not_base_of<D, B>();
+ test_is_not_base_of<B&, D&>();
+ test_is_not_base_of<B[3], D[3]>();
+ test_is_not_base_of<int, int>();
+ test_is_not_base_of<int, int>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.rel/is_convertible.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.rel/is_convertible.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.rel/is_convertible.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.rel/is_convertible.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,369 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_convertible
#include <type_traits>
typedef void Function();
typedef char Array[1];
int main()
{
{
static_assert(( std::is_convertible<void, void>::value), "");
static_assert(( std::is_convertible<const void, void>::value), "");
static_assert(( std::is_convertible<void, const void>::value), "");
static_assert(( std::is_convertible<const void, const void>::value), "");
static_assert((!std::is_convertible<void, Function>::value), "");
static_assert((!std::is_convertible<const void, Function>::value), "");
static_assert((!std::is_convertible<void, Function&>::value), "");
static_as
sert((!std::is_convertible<const void, Function&>::value), "");
static_assert((!std::is_convertible<void, Function*>::value), "");
static_assert((!std::is_convertible<void, Function* const>::value), "");
static_assert((!std::is_convertible<const void, Function*>::value), "");
static_assert((!std::is_convertible<const void, Function*const >::value), "");
static_assert((!std::is_convertible<void, Array>::value), "");
static_assert((!std::is_convertible<void, const Array>::value), "");
static_assert((!std::is_convertible<const void, Array>::value), "");
static_assert((!std::is_convertible<const void, const Array>::value), "");
static_assert((!std::is_convertible<void, Array&>::value), "");
static_assert((!std::is_convertible<void, const Array&>::value), "");
static_assert((!std::is_convertible<const void, Array&>::value), "");
static_assert((!std::is_convertible<const void, const Array&>::value), "");
static_assert((!std::
is_convertible<void, char>::value), "");
static_assert((!std::is_convertible<void, const char>::value), "");
static_assert((!std::is_convertible<const void, char>::value), "");
static_assert((!std::is_convertible<const void, const char>::value), "");
static_assert((!std::is_convertible<void, char&>::value), "");
static_assert((!std::is_convertible<void, const char&>::value), "");
static_assert((!std::is_convertible<const void, char&>::value), "");
static_assert((!std::is_convertible<const void, const char&>::value), "");
static_assert((!std::is_convertible<void, char*>::value), "");
static_assert((!std::is_convertible<void, const char*>::value), "");
static_assert((!std::is_convertible<const void, char*>::value), "");
static_assert((!std::is_convertible<const void, const char*>::value), "");
}
{
static_assert((!std::is_convertible<Function, void>::value), "");
static_assert((!std::is_convertible<Function, const vo
id>::value), "");
static_assert((!std::is_convertible<Function, Function>::value), "");
static_assert((!std::is_convertible<Function, Function&>::value), "");
static_assert((!std::is_convertible<Function, Function&>::value), "");
static_assert(( std::is_convertible<Function, Function*>::value), "");
static_assert(( std::is_convertible<Function, Function* const>::value), "");
static_assert((!std::is_convertible<Function, Array>::value), "");
static_assert((!std::is_convertible<Function, const Array>::value), "");
static_assert((!std::is_convertible<Function, Array&>::value), "");
static_assert((!std::is_convertible<Function, const Array&>::value), "");
static_assert((!std::is_convertible<Function, char>::value), "");
static_assert((!std::is_convertible<Function, const char>::value), "");
static_assert((!std::is_convertible<Function, char&>::value), "");
static_assert((!std::is_convertible<Function, const char&>::value
), "");
static_assert((!std::is_convertible<Function, char*>::value), "");
static_assert((!std::is_convertible<Function, const char*>::value), "");
}
{
static_assert((!std::is_convertible<Function&, void>::value), "");
static_assert((!std::is_convertible<Function&, const void>::value), "");
static_assert((!std::is_convertible<Function&, Function>::value), "");
static_assert(( std::is_convertible<Function&, Function&>::value), "");
static_assert(( std::is_convertible<Function&, const Function&>::value), "");
static_assert(( std::is_convertible<Function&, Function*>::value), "");
static_assert(( std::is_convertible<Function&, Function* const>::value), "");
static_assert((!std::is_convertible<Function&, Array>::value), "");
static_assert((!std::is_convertible<Function&, const Array>::value), "");
static_assert((!std::is_convertible<Function&, Array&>::value), "");
static_assert((!std::is_convertible<Function&, co
nst Array&>::value), "");
static_assert((!std::is_convertible<Function&, char>::value), "");
static_assert((!std::is_convertible<Function&, const char>::value), "");
static_assert((!std::is_convertible<Function&, char&>::value), "");
static_assert((!std::is_convertible<Function&, const char&>::value), "");
static_assert((!std::is_convertible<Function&, char*>::value), "");
static_assert((!std::is_convertible<Function&, const char*>::value), "");
}
{
static_assert((!std::is_convertible<Function*, void>::value), "");
static_assert((!std::is_convertible<Function*const, void>::value), "");
static_assert((!std::is_convertible<Function*, const void>::value), "");
static_assert((!std::is_convertible<Function*const, const void>::value), "");
static_assert((!std::is_convertible<Function*, Function>::value), "");
static_assert((!std::is_convertible<Function*const, Function>::value), "");
static_assert((!std::is_convertib
le<Function*, Function&>::value), "");
static_assert((!std::is_convertible<Function*const, Function&>::value), "");
static_assert(( std::is_convertible<Function*, Function*>::value), "");
static_assert(( std::is_convertible<Function*, Function* const>::value), "");
static_assert(( std::is_convertible<Function*const, Function*>::value), "");
static_assert(( std::is_convertible<Function*const, Function*const >::value), "");
static_assert((!std::is_convertible<Function*, Array>::value), "");
static_assert((!std::is_convertible<Function*, const Array>::value), "");
static_assert((!std::is_convertible<Function*const, Array>::value), "");
static_assert((!std::is_convertible<Function*const, const Array>::value), "");
static_assert((!std::is_convertible<Function*, Array&>::value), "");
static_assert((!std::is_convertible<Function*, const Array&>::value), "");
static_assert((!std::is_convertible<Function*const, Array&>::value), "");
static_assert((!std::is_convertible<Function*const, const Array&>::value), "");
static_assert((!std::is_convertible<Function*, char>::value), "");
static_assert((!std::is_convertible<Function*, const char>::value), "");
static_assert((!std::is_convertible<Function*const, char>::value), "");
static_assert((!std::is_convertible<Function*const, const char>::value), "");
static_assert((!std::is_convertible<Function*, char&>::value), "");
static_assert((!std::is_convertible<Function*, const char&>::value), "");
static_assert((!std::is_convertible<Function*const, char&>::value), "");
static_assert((!std::is_convertible<Function*const, const char&>::value), "");
static_assert((!std::is_convertible<Function*, char*>::value), "");
static_assert((!std::is_convertible<Function*, const char*>::value), "");
static_assert((!std::is_convertible<Function*const, char*>::value), "");
static_assert((!std::is_convertible<Function*const, con
st char*>::value), "");
}
{
static_assert((!std::is_convertible<Array, void>::value), "");
static_assert((!std::is_convertible<const Array, void>::value), "");
static_assert((!std::is_convertible<Array, const void>::value), "");
static_assert((!std::is_convertible<const Array, const void>::value), "");
static_assert((!std::is_convertible<Array, Function>::value), "");
static_assert((!std::is_convertible<const Array, Function>::value), "");
static_assert((!std::is_convertible<Array, Function&>::value), "");
static_assert((!std::is_convertible<const Array, Function&>::value), "");
static_assert((!std::is_convertible<Array, Function*>::value), "");
static_assert((!std::is_convertible<Array, Function* const>::value), "");
static_assert((!std::is_convertible<const Array, Function*>::value), "");
static_assert((!std::is_convertible<const Array, Function*const >::value), "");
static_assert((!std::is_convertible<Array,
Array>::value), "");
static_assert((!std::is_convertible<Array, const Array>::value), "");
static_assert((!std::is_convertible<const Array, Array>::value), "");
static_assert((!std::is_convertible<const Array, const Array>::value), "");
static_assert((!std::is_convertible<Array, Array&>::value), "");
static_assert(( std::is_convertible<Array, const Array&>::value), "");
static_assert((!std::is_convertible<const Array, Array&>::value), "");
static_assert((!std::is_convertible<const Array, const Array&>::value), "");
static_assert((!std::is_convertible<Array, char>::value), "");
static_assert((!std::is_convertible<Array, const char>::value), "");
static_assert((!std::is_convertible<const Array, char>::value), "");
static_assert((!std::is_convertible<const Array, const char>::value), "");
static_assert((!std::is_convertible<Array, char&>::value), "");
static_assert((!std::is_convertible<Array, const char&>::value), "");
static_assert((!std::is_convertible<const Array, char&>::value), "");
static_assert((!std::is_convertible<const Array, const char&>::value), "");
static_assert(( std::is_convertible<Array, char*>::value), "");
static_assert(( std::is_convertible<Array, const char*>::value), "");
static_assert((!std::is_convertible<const Array, char*>::value), "");
static_assert(( std::is_convertible<const Array, const char*>::value), "");
}
{
static_assert((!std::is_convertible<Array&, void>::value), "");
static_assert((!std::is_convertible<const Array&, void>::value), "");
static_assert((!std::is_convertible<Array&, const void>::value), "");
static_assert((!std::is_convertible<const Array&, const void>::value), "");
static_assert((!std::is_convertible<Array&, Function>::value), "");
static_assert((!std::is_convertible<const Array&, Function>::value), "");
static_assert((!std::is_convertible<Array&, Function&>::value), "");
stat
ic_assert((!std::is_convertible<const Array&, Function&>::value), "");
static_assert((!std::is_convertible<Array&, Function*>::value), "");
static_assert((!std::is_convertible<Array&, Function* const>::value), "");
static_assert((!std::is_convertible<const Array&, Function*>::value), "");
static_assert((!std::is_convertible<const Array&, Function*const >::value), "");
static_assert((!std::is_convertible<Array&, Array>::value), "");
static_assert((!std::is_convertible<Array&, const Array>::value), "");
static_assert((!std::is_convertible<const Array&, Array>::value), "");
static_assert((!std::is_convertible<const Array&, const Array>::value), "");
static_assert(( std::is_convertible<Array&, Array&>::value), "");
static_assert(( std::is_convertible<Array&, const Array&>::value), "");
static_assert((!std::is_convertible<const Array&, Array&>::value), "");
static_assert(( std::is_convertible<const Array&, const Array&>::value),
"");
static_assert((!std::is_convertible<Array&, char>::value), "");
static_assert((!std::is_convertible<Array&, const char>::value), "");
static_assert((!std::is_convertible<const Array&, char>::value), "");
static_assert((!std::is_convertible<const Array&, const char>::value), "");
static_assert((!std::is_convertible<Array&, char&>::value), "");
static_assert((!std::is_convertible<Array&, const char&>::value), "");
static_assert((!std::is_convertible<const Array&, char&>::value), "");
static_assert((!std::is_convertible<const Array&, const char&>::value), "");
static_assert(( std::is_convertible<Array&, char*>::value), "");
static_assert(( std::is_convertible<Array&, const char*>::value), "");
static_assert((!std::is_convertible<const Array&, char*>::value), "");
static_assert(( std::is_convertible<const Array&, const char*>::value), "");
}
{
static_assert((!std::is_convertible<char, void>::value), "");
sta
tic_assert((!std::is_convertible<const char, void>::value), "");
static_assert((!std::is_convertible<char, const void>::value), "");
static_assert((!std::is_convertible<const char, const void>::value), "");
static_assert((!std::is_convertible<char, Function>::value), "");
static_assert((!std::is_convertible<const char, Function>::value), "");
static_assert((!std::is_convertible<char, Function&>::value), "");
static_assert((!std::is_convertible<const char, Function&>::value), "");
static_assert((!std::is_convertible<char, Function*>::value), "");
static_assert((!std::is_convertible<char, Function* const>::value), "");
static_assert((!std::is_convertible<const char, Function*>::value), "");
static_assert((!std::is_convertible<const char, Function*const >::value), "");
static_assert((!std::is_convertible<char, Array>::value), "");
static_assert((!std::is_convertible<char, const Array>::value), "");
static_assert((!std::is_
convertible<const char, Array>::value), "");
static_assert((!std::is_convertible<const char, const Array>::value), "");
static_assert((!std::is_convertible<char, Array&>::value), "");
static_assert((!std::is_convertible<char, const Array&>::value), "");
static_assert((!std::is_convertible<const char, Array&>::value), "");
static_assert((!std::is_convertible<const char, const Array&>::value), "");
static_assert(( std::is_convertible<char, char>::value), "");
static_assert(( std::is_convertible<char, const char>::value), "");
static_assert(( std::is_convertible<const char, char>::value), "");
static_assert(( std::is_convertible<const char, const char>::value), "");
static_assert((!std::is_convertible<char, char&>::value), "");
static_assert(( std::is_convertible<char, const char&>::value), "");
static_assert((!std::is_convertible<const char, char&>::value), "");
static_assert(( std::is_convertible<const char, const char&>:
:value), "");
static_assert((!std::is_convertible<char, char*>::value), "");
static_assert((!std::is_convertible<char, const char*>::value), "");
static_assert((!std::is_convertible<const char, char*>::value), "");
static_assert((!std::is_convertible<const char, const char*>::value), "");
}
{
static_assert((!std::is_convertible<char&, void>::value), "");
static_assert((!std::is_convertible<const char&, void>::value), "");
static_assert((!std::is_convertible<char&, const void>::value), "");
static_assert((!std::is_convertible<const char&, const void>::value), "");
static_assert((!std::is_convertible<char&, Function>::value), "");
static_assert((!std::is_convertible<const char&, Function>::value), "");
static_assert((!std::is_convertible<char&, Function&>::value), "");
static_assert((!std::is_convertible<const char&, Function&>::value), "");
static_assert((!std::is_convertible<char&, Function*>::value), "");
s
tatic_assert((!std::is_convertible<char&, Function* const>::value), "");
static_assert((!std::is_convertible<const char&, Function*>::value), "");
static_assert((!std::is_convertible<const char&, Function*const >::value), "");
static_assert((!std::is_convertible<char&, Array>::value), "");
static_assert((!std::is_convertible<char&, const Array>::value), "");
static_assert((!std::is_convertible<const char&, Array>::value), "");
static_assert((!std::is_convertible<const char&, const Array>::value), "");
static_assert((!std::is_convertible<char&, Array&>::value), "");
static_assert((!std::is_convertible<char&, const Array&>::value), "");
static_assert((!std::is_convertible<const char&, Array&>::value), "");
static_assert((!std::is_convertible<const char&, const Array&>::value), "");
static_assert(( std::is_convertible<char&, char>::value), "");
static_assert(( std::is_convertible<char&, const char>::value), "");
static_asse
rt(( std::is_convertible<const char&, char>::value), "");
static_assert(( std::is_convertible<const char&, const char>::value), "");
static_assert(( std::is_convertible<char&, char&>::value), "");
static_assert(( std::is_convertible<char&, const char&>::value), "");
static_assert((!std::is_convertible<const char&, char&>::value), "");
static_assert(( std::is_convertible<const char&, const char&>::value), "");
static_assert((!std::is_convertible<char&, char*>::value), "");
static_assert((!std::is_convertible<char&, const char*>::value), "");
static_assert((!std::is_convertible<const char&, char*>::value), "");
static_assert((!std::is_convertible<const char&, const char*>::value), "");
}
{
static_assert((!std::is_convertible<char*, void>::value), "");
static_assert((!std::is_convertible<const char*, void>::value), "");
static_assert((!std::is_convertible<char*, const void>::value), "");
static_assert((!std::is_conve
rtible<const char*, const void>::value), "");
static_assert((!std::is_convertible<char*, Function>::value), "");
static_assert((!std::is_convertible<const char*, Function>::value), "");
static_assert((!std::is_convertible<char*, Function&>::value), "");
static_assert((!std::is_convertible<const char*, Function&>::value), "");
static_assert((!std::is_convertible<char*, Function*>::value), "");
static_assert((!std::is_convertible<char*, Function* const>::value), "");
static_assert((!std::is_convertible<const char*, Function*>::value), "");
static_assert((!std::is_convertible<const char*, Function*const >::value), "");
static_assert((!std::is_convertible<char*, Array>::value), "");
static_assert((!std::is_convertible<char*, const Array>::value), "");
static_assert((!std::is_convertible<const char*, Array>::value), "");
static_assert((!std::is_convertible<const char*, const Array>::value), "");
static_assert((!std::is_conv
ertible<char*, Array&>::value), "");
static_assert((!std::is_convertible<char*, const Array&>::value), "");
static_assert((!std::is_convertible<const char*, Array&>::value), "");
static_assert((!std::is_convertible<const char*, const Array&>::value), "");
static_assert((!std::is_convertible<char*, char>::value), "");
static_assert((!std::is_convertible<char*, const char>::value), "");
static_assert((!std::is_convertible<const char*, char>::value), "");
static_assert((!std::is_convertible<const char*, const char>::value), "");
static_assert((!std::is_convertible<char*, char&>::value), "");
static_assert((!std::is_convertible<char*, const char&>::value), "");
static_assert((!std::is_convertible<const char*, char&>::value), "");
static_assert((!std::is_convertible<const char*, const char&>::value), "");
static_assert(( std::is_convertible<char*, char*>::value), "");
static_assert(( std::is_convertible<char*, const char*>::v
alue), "");
static_assert((!std::is_convertible<const char*, char*>::value), "");
static_assert(( std::is_convertible<const char*, const char*>::value), "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_convertible
+
+#include <type_traits>
+
+typedef void Function();
+typedef char Array[1];
+
+int main()
+{
+ {
+ static_assert(( std::is_convertible<void, void>::value), "");
+ static_assert(( std::is_convertible<const void, void>::value), "");
+ static_assert(( std::is_convertible<void, const void>::value), "");
+ static_assert(( std::is_convertible<const void, const void>::value), "");
+
+ static_assert((!std::is_convertible<void, Function>::value), "");
+ static_assert((!std::is_convertible<const void, Function>::value), "");
+
+ static_assert((!std::is_convertible<void, Function&>::value), "");
+ static_assert((!std::is_convertible<const void, Function&>::value), "");
+
+ static_assert((!std::is_convertible<void, Function*>::value), "");
+ static_assert((!std::is_convertible<void, Function* const>::value), "");
+ static_assert((!std::is_convertible<const void, Function*>::value), "");
+ static_assert((!std::is_convertible<const void, Function*const >::value), "");
+
+ static_assert((!std::is_convertible<void, Array>::value), "");
+ static_assert((!std::is_convertible<void, const Array>::value), "");
+ static_assert((!std::is_convertible<const void, Array>::value), "");
+ static_assert((!std::is_convertible<const void, const Array>::value), "");
+
+ static_assert((!std::is_convertible<void, Array&>::value), "");
+ static_assert((!std::is_convertible<void, const Array&>::value), "");
+ static_assert((!std::is_convertible<const void, Array&>::value), "");
+ static_assert((!std::is_convertible<const void, const Array&>::value), "");
+
+ static_assert((!std::is_convertible<void, char>::value), "");
+ static_assert((!std::is_convertible<void, const char>::value), "");
+ static_assert((!std::is_convertible<const void, char>::value), "");
+ static_assert((!std::is_convertible<const void, const char>::value), "");
+
+ static_assert((!std::is_convertible<void, char&>::value), "");
+ static_assert((!std::is_convertible<void, const char&>::value), "");
+ static_assert((!std::is_convertible<const void, char&>::value), "");
+ static_assert((!std::is_convertible<const void, const char&>::value), "");
+
+ static_assert((!std::is_convertible<void, char*>::value), "");
+ static_assert((!std::is_convertible<void, const char*>::value), "");
+ static_assert((!std::is_convertible<const void, char*>::value), "");
+ static_assert((!std::is_convertible<const void, const char*>::value), "");
+ }
+ {
+ static_assert((!std::is_convertible<Function, void>::value), "");
+ static_assert((!std::is_convertible<Function, const void>::value), "");
+
+ static_assert((!std::is_convertible<Function, Function>::value), "");
+
+ static_assert((!std::is_convertible<Function, Function&>::value), "");
+ static_assert((!std::is_convertible<Function, Function&>::value), "");
+
+ static_assert(( std::is_convertible<Function, Function*>::value), "");
+ static_assert(( std::is_convertible<Function, Function* const>::value), "");
+
+ static_assert((!std::is_convertible<Function, Array>::value), "");
+ static_assert((!std::is_convertible<Function, const Array>::value), "");
+
+ static_assert((!std::is_convertible<Function, Array&>::value), "");
+ static_assert((!std::is_convertible<Function, const Array&>::value), "");
+
+ static_assert((!std::is_convertible<Function, char>::value), "");
+ static_assert((!std::is_convertible<Function, const char>::value), "");
+
+ static_assert((!std::is_convertible<Function, char&>::value), "");
+ static_assert((!std::is_convertible<Function, const char&>::value), "");
+
+ static_assert((!std::is_convertible<Function, char*>::value), "");
+ static_assert((!std::is_convertible<Function, const char*>::value), "");
+ }
+ {
+ static_assert((!std::is_convertible<Function&, void>::value), "");
+ static_assert((!std::is_convertible<Function&, const void>::value), "");
+
+ static_assert((!std::is_convertible<Function&, Function>::value), "");
+
+ static_assert(( std::is_convertible<Function&, Function&>::value), "");
+ static_assert(( std::is_convertible<Function&, const Function&>::value), "");
+
+ static_assert(( std::is_convertible<Function&, Function*>::value), "");
+ static_assert(( std::is_convertible<Function&, Function* const>::value), "");
+
+ static_assert((!std::is_convertible<Function&, Array>::value), "");
+ static_assert((!std::is_convertible<Function&, const Array>::value), "");
+
+ static_assert((!std::is_convertible<Function&, Array&>::value), "");
+ static_assert((!std::is_convertible<Function&, const Array&>::value), "");
+
+ static_assert((!std::is_convertible<Function&, char>::value), "");
+ static_assert((!std::is_convertible<Function&, const char>::value), "");
+
+ static_assert((!std::is_convertible<Function&, char&>::value), "");
+ static_assert((!std::is_convertible<Function&, const char&>::value), "");
+
+ static_assert((!std::is_convertible<Function&, char*>::value), "");
+ static_assert((!std::is_convertible<Function&, const char*>::value), "");
+ }
+ {
+ static_assert((!std::is_convertible<Function*, void>::value), "");
+ static_assert((!std::is_convertible<Function*const, void>::value), "");
+ static_assert((!std::is_convertible<Function*, const void>::value), "");
+ static_assert((!std::is_convertible<Function*const, const void>::value), "");
+
+ static_assert((!std::is_convertible<Function*, Function>::value), "");
+ static_assert((!std::is_convertible<Function*const, Function>::value), "");
+
+ static_assert((!std::is_convertible<Function*, Function&>::value), "");
+ static_assert((!std::is_convertible<Function*const, Function&>::value), "");
+
+ static_assert(( std::is_convertible<Function*, Function*>::value), "");
+ static_assert(( std::is_convertible<Function*, Function* const>::value), "");
+ static_assert(( std::is_convertible<Function*const, Function*>::value), "");
+ static_assert(( std::is_convertible<Function*const, Function*const >::value), "");
+
+ static_assert((!std::is_convertible<Function*, Array>::value), "");
+ static_assert((!std::is_convertible<Function*, const Array>::value), "");
+ static_assert((!std::is_convertible<Function*const, Array>::value), "");
+ static_assert((!std::is_convertible<Function*const, const Array>::value), "");
+
+ static_assert((!std::is_convertible<Function*, Array&>::value), "");
+ static_assert((!std::is_convertible<Function*, const Array&>::value), "");
+ static_assert((!std::is_convertible<Function*const, Array&>::value), "");
+ static_assert((!std::is_convertible<Function*const, const Array&>::value), "");
+
+ static_assert((!std::is_convertible<Function*, char>::value), "");
+ static_assert((!std::is_convertible<Function*, const char>::value), "");
+ static_assert((!std::is_convertible<Function*const, char>::value), "");
+ static_assert((!std::is_convertible<Function*const, const char>::value), "");
+
+ static_assert((!std::is_convertible<Function*, char&>::value), "");
+ static_assert((!std::is_convertible<Function*, const char&>::value), "");
+ static_assert((!std::is_convertible<Function*const, char&>::value), "");
+ static_assert((!std::is_convertible<Function*const, const char&>::value), "");
+
+ static_assert((!std::is_convertible<Function*, char*>::value), "");
+ static_assert((!std::is_convertible<Function*, const char*>::value), "");
+ static_assert((!std::is_convertible<Function*const, char*>::value), "");
+ static_assert((!std::is_convertible<Function*const, const char*>::value), "");
+ }
+ {
+ static_assert((!std::is_convertible<Array, void>::value), "");
+ static_assert((!std::is_convertible<const Array, void>::value), "");
+ static_assert((!std::is_convertible<Array, const void>::value), "");
+ static_assert((!std::is_convertible<const Array, const void>::value), "");
+
+ static_assert((!std::is_convertible<Array, Function>::value), "");
+ static_assert((!std::is_convertible<const Array, Function>::value), "");
+
+ static_assert((!std::is_convertible<Array, Function&>::value), "");
+ static_assert((!std::is_convertible<const Array, Function&>::value), "");
+
+ static_assert((!std::is_convertible<Array, Function*>::value), "");
+ static_assert((!std::is_convertible<Array, Function* const>::value), "");
+ static_assert((!std::is_convertible<const Array, Function*>::value), "");
+ static_assert((!std::is_convertible<const Array, Function*const >::value), "");
+
+ static_assert((!std::is_convertible<Array, Array>::value), "");
+ static_assert((!std::is_convertible<Array, const Array>::value), "");
+ static_assert((!std::is_convertible<const Array, Array>::value), "");
+ static_assert((!std::is_convertible<const Array, const Array>::value), "");
+
+ static_assert((!std::is_convertible<Array, Array&>::value), "");
+ static_assert(( std::is_convertible<Array, const Array&>::value), "");
+ static_assert((!std::is_convertible<const Array, Array&>::value), "");
+ static_assert((!std::is_convertible<const Array, const Array&>::value), "");
+
+ static_assert((!std::is_convertible<Array, char>::value), "");
+ static_assert((!std::is_convertible<Array, const char>::value), "");
+ static_assert((!std::is_convertible<const Array, char>::value), "");
+ static_assert((!std::is_convertible<const Array, const char>::value), "");
+
+ static_assert((!std::is_convertible<Array, char&>::value), "");
+ static_assert((!std::is_convertible<Array, const char&>::value), "");
+ static_assert((!std::is_convertible<const Array, char&>::value), "");
+ static_assert((!std::is_convertible<const Array, const char&>::value), "");
+
+ static_assert(( std::is_convertible<Array, char*>::value), "");
+ static_assert(( std::is_convertible<Array, const char*>::value), "");
+ static_assert((!std::is_convertible<const Array, char*>::value), "");
+ static_assert(( std::is_convertible<const Array, const char*>::value), "");
+ }
+ {
+ static_assert((!std::is_convertible<Array&, void>::value), "");
+ static_assert((!std::is_convertible<const Array&, void>::value), "");
+ static_assert((!std::is_convertible<Array&, const void>::value), "");
+ static_assert((!std::is_convertible<const Array&, const void>::value), "");
+
+ static_assert((!std::is_convertible<Array&, Function>::value), "");
+ static_assert((!std::is_convertible<const Array&, Function>::value), "");
+
+ static_assert((!std::is_convertible<Array&, Function&>::value), "");
+ static_assert((!std::is_convertible<const Array&, Function&>::value), "");
+
+ static_assert((!std::is_convertible<Array&, Function*>::value), "");
+ static_assert((!std::is_convertible<Array&, Function* const>::value), "");
+ static_assert((!std::is_convertible<const Array&, Function*>::value), "");
+ static_assert((!std::is_convertible<const Array&, Function*const >::value), "");
+
+ static_assert((!std::is_convertible<Array&, Array>::value), "");
+ static_assert((!std::is_convertible<Array&, const Array>::value), "");
+ static_assert((!std::is_convertible<const Array&, Array>::value), "");
+ static_assert((!std::is_convertible<const Array&, const Array>::value), "");
+
+ static_assert(( std::is_convertible<Array&, Array&>::value), "");
+ static_assert(( std::is_convertible<Array&, const Array&>::value), "");
+ static_assert((!std::is_convertible<const Array&, Array&>::value), "");
+ static_assert(( std::is_convertible<const Array&, const Array&>::value), "");
+
+ static_assert((!std::is_convertible<Array&, char>::value), "");
+ static_assert((!std::is_convertible<Array&, const char>::value), "");
+ static_assert((!std::is_convertible<const Array&, char>::value), "");
+ static_assert((!std::is_convertible<const Array&, const char>::value), "");
+
+ static_assert((!std::is_convertible<Array&, char&>::value), "");
+ static_assert((!std::is_convertible<Array&, const char&>::value), "");
+ static_assert((!std::is_convertible<const Array&, char&>::value), "");
+ static_assert((!std::is_convertible<const Array&, const char&>::value), "");
+
+ static_assert(( std::is_convertible<Array&, char*>::value), "");
+ static_assert(( std::is_convertible<Array&, const char*>::value), "");
+ static_assert((!std::is_convertible<const Array&, char*>::value), "");
+ static_assert(( std::is_convertible<const Array&, const char*>::value), "");
+ }
+ {
+ static_assert((!std::is_convertible<char, void>::value), "");
+ static_assert((!std::is_convertible<const char, void>::value), "");
+ static_assert((!std::is_convertible<char, const void>::value), "");
+ static_assert((!std::is_convertible<const char, const void>::value), "");
+
+ static_assert((!std::is_convertible<char, Function>::value), "");
+ static_assert((!std::is_convertible<const char, Function>::value), "");
+
+ static_assert((!std::is_convertible<char, Function&>::value), "");
+ static_assert((!std::is_convertible<const char, Function&>::value), "");
+
+ static_assert((!std::is_convertible<char, Function*>::value), "");
+ static_assert((!std::is_convertible<char, Function* const>::value), "");
+ static_assert((!std::is_convertible<const char, Function*>::value), "");
+ static_assert((!std::is_convertible<const char, Function*const >::value), "");
+
+ static_assert((!std::is_convertible<char, Array>::value), "");
+ static_assert((!std::is_convertible<char, const Array>::value), "");
+ static_assert((!std::is_convertible<const char, Array>::value), "");
+ static_assert((!std::is_convertible<const char, const Array>::value), "");
+
+ static_assert((!std::is_convertible<char, Array&>::value), "");
+ static_assert((!std::is_convertible<char, const Array&>::value), "");
+ static_assert((!std::is_convertible<const char, Array&>::value), "");
+ static_assert((!std::is_convertible<const char, const Array&>::value), "");
+
+ static_assert(( std::is_convertible<char, char>::value), "");
+ static_assert(( std::is_convertible<char, const char>::value), "");
+ static_assert(( std::is_convertible<const char, char>::value), "");
+ static_assert(( std::is_convertible<const char, const char>::value), "");
+
+ static_assert((!std::is_convertible<char, char&>::value), "");
+ static_assert(( std::is_convertible<char, const char&>::value), "");
+ static_assert((!std::is_convertible<const char, char&>::value), "");
+ static_assert(( std::is_convertible<const char, const char&>::value), "");
+
+ static_assert((!std::is_convertible<char, char*>::value), "");
+ static_assert((!std::is_convertible<char, const char*>::value), "");
+ static_assert((!std::is_convertible<const char, char*>::value), "");
+ static_assert((!std::is_convertible<const char, const char*>::value), "");
+ }
+ {
+ static_assert((!std::is_convertible<char&, void>::value), "");
+ static_assert((!std::is_convertible<const char&, void>::value), "");
+ static_assert((!std::is_convertible<char&, const void>::value), "");
+ static_assert((!std::is_convertible<const char&, const void>::value), "");
+
+ static_assert((!std::is_convertible<char&, Function>::value), "");
+ static_assert((!std::is_convertible<const char&, Function>::value), "");
+
+ static_assert((!std::is_convertible<char&, Function&>::value), "");
+ static_assert((!std::is_convertible<const char&, Function&>::value), "");
+
+ static_assert((!std::is_convertible<char&, Function*>::value), "");
+ static_assert((!std::is_convertible<char&, Function* const>::value), "");
+ static_assert((!std::is_convertible<const char&, Function*>::value), "");
+ static_assert((!std::is_convertible<const char&, Function*const >::value), "");
+
+ static_assert((!std::is_convertible<char&, Array>::value), "");
+ static_assert((!std::is_convertible<char&, const Array>::value), "");
+ static_assert((!std::is_convertible<const char&, Array>::value), "");
+ static_assert((!std::is_convertible<const char&, const Array>::value), "");
+
+ static_assert((!std::is_convertible<char&, Array&>::value), "");
+ static_assert((!std::is_convertible<char&, const Array&>::value), "");
+ static_assert((!std::is_convertible<const char&, Array&>::value), "");
+ static_assert((!std::is_convertible<const char&, const Array&>::value), "");
+
+ static_assert(( std::is_convertible<char&, char>::value), "");
+ static_assert(( std::is_convertible<char&, const char>::value), "");
+ static_assert(( std::is_convertible<const char&, char>::value), "");
+ static_assert(( std::is_convertible<const char&, const char>::value), "");
+
+ static_assert(( std::is_convertible<char&, char&>::value), "");
+ static_assert(( std::is_convertible<char&, const char&>::value), "");
+ static_assert((!std::is_convertible<const char&, char&>::value), "");
+ static_assert(( std::is_convertible<const char&, const char&>::value), "");
+
+ static_assert((!std::is_convertible<char&, char*>::value), "");
+ static_assert((!std::is_convertible<char&, const char*>::value), "");
+ static_assert((!std::is_convertible<const char&, char*>::value), "");
+ static_assert((!std::is_convertible<const char&, const char*>::value), "");
+ }
+ {
+ static_assert((!std::is_convertible<char*, void>::value), "");
+ static_assert((!std::is_convertible<const char*, void>::value), "");
+ static_assert((!std::is_convertible<char*, const void>::value), "");
+ static_assert((!std::is_convertible<const char*, const void>::value), "");
+
+ static_assert((!std::is_convertible<char*, Function>::value), "");
+ static_assert((!std::is_convertible<const char*, Function>::value), "");
+
+ static_assert((!std::is_convertible<char*, Function&>::value), "");
+ static_assert((!std::is_convertible<const char*, Function&>::value), "");
+
+ static_assert((!std::is_convertible<char*, Function*>::value), "");
+ static_assert((!std::is_convertible<char*, Function* const>::value), "");
+ static_assert((!std::is_convertible<const char*, Function*>::value), "");
+ static_assert((!std::is_convertible<const char*, Function*const >::value), "");
+
+ static_assert((!std::is_convertible<char*, Array>::value), "");
+ static_assert((!std::is_convertible<char*, const Array>::value), "");
+ static_assert((!std::is_convertible<const char*, Array>::value), "");
+ static_assert((!std::is_convertible<const char*, const Array>::value), "");
+
+ static_assert((!std::is_convertible<char*, Array&>::value), "");
+ static_assert((!std::is_convertible<char*, const Array&>::value), "");
+ static_assert((!std::is_convertible<const char*, Array&>::value), "");
+ static_assert((!std::is_convertible<const char*, const Array&>::value), "");
+
+ static_assert((!std::is_convertible<char*, char>::value), "");
+ static_assert((!std::is_convertible<char*, const char>::value), "");
+ static_assert((!std::is_convertible<const char*, char>::value), "");
+ static_assert((!std::is_convertible<const char*, const char>::value), "");
+
+ static_assert((!std::is_convertible<char*, char&>::value), "");
+ static_assert((!std::is_convertible<char*, const char&>::value), "");
+ static_assert((!std::is_convertible<const char*, char&>::value), "");
+ static_assert((!std::is_convertible<const char*, const char&>::value), "");
+
+ static_assert(( std::is_convertible<char*, char*>::value), "");
+ static_assert(( std::is_convertible<char*, const char*>::value), "");
+ static_assert((!std::is_convertible<const char*, char*>::value), "");
+ static_assert(( std::is_convertible<const char*, const char*>::value), "");
+ }
+}
Modified: libcxx/trunk/test/utilities/meta/meta.rel/is_same.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.rel/is_same.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.rel/is_same.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.rel/is_same.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,59 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_same
#include <type_traits>
template <class T, class U>
void test_is_same()
{
static_assert((std::is_same<T, U>::value), "");
static_assert((!std::is_same<const T, U>::value), "");
static_assert((!std::is_same<T, const U>::value), "");
static_assert((std::is_same<const T, const U>::value), "");
}
template <class T, class U>
void test_is_same_ref()
{
static_assert((std::is_same<T, U>::value), "");
static_assert((std::is_same<const T, U>::value), "");
static_assert((std::is_same<T, const U>::value), "");
static_assert((std::is_same<const T, const U>::value), "");
}
template <class T,
class U>
void test_is_not_same()
{
static_assert((!std::is_same<T, U>::value), "");
}
class Class
{
public:
~Class();
};
int main()
{
test_is_same<int, int>();
test_is_same<void, void>();
test_is_same<Class, Class>();
test_is_same<int*, int*>();
test_is_same_ref<int&, int&>();
test_is_not_same<int, void>();
test_is_not_same<void, Class>();
test_is_not_same<Class, int*>();
test_is_not_same<int*, int&>();
test_is_not_same<int&, int>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_same
+
+#include <type_traits>
+
+template <class T, class U>
+void test_is_same()
+{
+ static_assert((std::is_same<T, U>::value), "");
+ static_assert((!std::is_same<const T, U>::value), "");
+ static_assert((!std::is_same<T, const U>::value), "");
+ static_assert((std::is_same<const T, const U>::value), "");
+}
+
+template <class T, class U>
+void test_is_same_ref()
+{
+ static_assert((std::is_same<T, U>::value), "");
+ static_assert((std::is_same<const T, U>::value), "");
+ static_assert((std::is_same<T, const U>::value), "");
+ static_assert((std::is_same<const T, const U>::value), "");
+}
+
+template <class T, class U>
+void test_is_not_same()
+{
+ static_assert((!std::is_same<T, U>::value), "");
+}
+
+class Class
+{
+public:
+ ~Class();
+};
+
+int main()
+{
+ test_is_same<int, int>();
+ test_is_same<void, void>();
+ test_is_same<Class, Class>();
+ test_is_same<int*, int*>();
+ test_is_same_ref<int&, int&>();
+
+ test_is_not_same<int, void>();
+ test_is_not_same<void, Class>();
+ test_is_not_same<Class, int*>();
+ test_is_not_same<int*, int&>();
+ test_is_not_same<int&, int>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,32 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_all_extents
#include <type_traits>
enum Enum {zero, one_};
int main()
{
static_assert((std::is_same<std::remove_all_extents<int>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const Enum>::type, const Enum>::value), "");
static_assert((std::is_same<std::remove_all_extents<int[]>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const int[]>::type, const int>::value), "");
static_assert((std::is_same<std::remove_all_extents<int[3]>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const int[3]>::type, c
onst int>::value), "");
static_assert((std::is_same<std::remove_all_extents<int[][3]>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const int[][3]>::type, const int>::value), "");
static_assert((std::is_same<std::remove_all_extents<int[2][3]>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const int[2][3]>::type, const int>::value), "");
static_assert((std::is_same<std::remove_all_extents<int[1][2][3]>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const int[1][2][3]>::type, const int>::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// remove_all_extents
+
+#include <type_traits>
+
+enum Enum {zero, one_};
+
+int main()
+{
+ static_assert((std::is_same<std::remove_all_extents<int>::type, int>::value), "");
+ static_assert((std::is_same<std::remove_all_extents<const Enum>::type, const Enum>::value), "");
+ static_assert((std::is_same<std::remove_all_extents<int[]>::type, int>::value), "");
+ static_assert((std::is_same<std::remove_all_extents<const int[]>::type, const int>::value), "");
+ static_assert((std::is_same<std::remove_all_extents<int[3]>::type, int>::value), "");
+ static_assert((std::is_same<std::remove_all_extents<const int[3]>::type, const int>::value), "");
+ static_assert((std::is_same<std::remove_all_extents<int[][3]>::type, int>::value), "");
+ static_assert((std::is_same<std::remove_all_extents<const int[][3]>::type, const int>::value), "");
+ static_assert((std::is_same<std::remove_all_extents<int[2][3]>::type, int>::value), "");
+ static_assert((std::is_same<std::remove_all_extents<const int[2][3]>::type, const int>::value), "");
+ static_assert((std::is_same<std::remove_all_extents<int[1][2][3]>::type, int>::value), "");
+ static_assert((std::is_same<std::remove_all_extents<const int[1][2][3]>::type, const int>::value), "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,32 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_extent
#include <type_traits>
enum Enum {zero, one_};
int main()
{
static_assert((std::is_same<std::remove_extent<int>::type, int>::value), "");
static_assert((std::is_same<std::remove_extent<const Enum>::type, const Enum>::value), "");
static_assert((std::is_same<std::remove_extent<int[]>::type, int>::value), "");
static_assert((std::is_same<std::remove_extent<const int[]>::type, const int>::value), "");
static_assert((std::is_same<std::remove_extent<int[3]>::type, int>::value), "");
static_assert((std::is_same<std::remove_extent<const int[3]>::type, const int>::value), "");
static_
assert((std::is_same<std::remove_extent<int[][3]>::type, int[3]>::value), "");
static_assert((std::is_same<std::remove_extent<const int[][3]>::type, const int[3]>::value), "");
static_assert((std::is_same<std::remove_extent<int[2][3]>::type, int[3]>::value), "");
static_assert((std::is_same<std::remove_extent<const int[2][3]>::type, const int[3]>::value), "");
static_assert((std::is_same<std::remove_extent<int[1][2][3]>::type, int[2][3]>::value), "");
static_assert((std::is_same<std::remove_extent<const int[1][2][3]>::type, const int[2][3]>::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// remove_extent
+
+#include <type_traits>
+
+enum Enum {zero, one_};
+
+int main()
+{
+ static_assert((std::is_same<std::remove_extent<int>::type, int>::value), "");
+ static_assert((std::is_same<std::remove_extent<const Enum>::type, const Enum>::value), "");
+ static_assert((std::is_same<std::remove_extent<int[]>::type, int>::value), "");
+ static_assert((std::is_same<std::remove_extent<const int[]>::type, const int>::value), "");
+ static_assert((std::is_same<std::remove_extent<int[3]>::type, int>::value), "");
+ static_assert((std::is_same<std::remove_extent<const int[3]>::type, const int>::value), "");
+ static_assert((std::is_same<std::remove_extent<int[][3]>::type, int[3]>::value), "");
+ static_assert((std::is_same<std::remove_extent<const int[][3]>::type, const int[3]>::value), "");
+ static_assert((std::is_same<std::remove_extent<int[2][3]>::type, int[3]>::value), "");
+ static_assert((std::is_same<std::remove_extent<const int[2][3]>::type, const int[3]>::value), "");
+ static_assert((std::is_same<std::remove_extent<int[1][2][3]>::type, int[2][3]>::value), "");
+ static_assert((std::is_same<std::remove_extent<const int[1][2][3]>::type, const int[2][3]>::value), "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_const
#include <type_traits>
template <class T, class U>
void test_add_const_imp()
{
static_assert((std::is_same<typename std::add_const<T>::type, const U>::value), "");
}
template <class T>
void test_add_const()
{
test_add_const_imp<T, const T>();
test_add_const_imp<const T, const T>();
test_add_const_imp<volatile T, volatile const T>();
test_add_const_imp<const volatile T, const volatile T>();
}
int main()
{
test_add_const<void>();
test_add_const<int>();
test_add_const<int[3]>();
test_add_const<int&>();
test_add_const<const int&>();
test_add_const<int*>();
test_ad
d_const<const int*>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// add_const
+
+#include <type_traits>
+
+template <class T, class U>
+void test_add_const_imp()
+{
+ static_assert((std::is_same<typename std::add_const<T>::type, const U>::value), "");
+}
+
+template <class T>
+void test_add_const()
+{
+ test_add_const_imp<T, const T>();
+ test_add_const_imp<const T, const T>();
+ test_add_const_imp<volatile T, volatile const T>();
+ test_add_const_imp<const volatile T, const volatile T>();
+}
+
+int main()
+{
+ test_add_const<void>();
+ test_add_const<int>();
+ test_add_const<int[3]>();
+ test_add_const<int&>();
+ test_add_const<const int&>();
+ test_add_const<int*>();
+ test_add_const<const int*>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_cv
#include <type_traits>
template <class T, class U>
void test_add_cv_imp()
{
static_assert((std::is_same<typename std::add_cv<T>::type, const volatile U>::value), "");
}
template <class T>
void test_add_cv()
{
test_add_cv_imp<T, const volatile T>();
test_add_cv_imp<const T, const volatile T>();
test_add_cv_imp<volatile T, volatile const T>();
test_add_cv_imp<const volatile T, const volatile T>();
}
int main()
{
test_add_cv<void>();
test_add_cv<int>();
test_add_cv<int[3]>();
test_add_cv<int&>();
test_add_cv<const int&>();
test_add_cv<int*>();
test_add_cv<const int*
>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// add_cv
+
+#include <type_traits>
+
+template <class T, class U>
+void test_add_cv_imp()
+{
+ static_assert((std::is_same<typename std::add_cv<T>::type, const volatile U>::value), "");
+}
+
+template <class T>
+void test_add_cv()
+{
+ test_add_cv_imp<T, const volatile T>();
+ test_add_cv_imp<const T, const volatile T>();
+ test_add_cv_imp<volatile T, volatile const T>();
+ test_add_cv_imp<const volatile T, const volatile T>();
+}
+
+int main()
+{
+ test_add_cv<void>();
+ test_add_cv<int>();
+ test_add_cv<int[3]>();
+ test_add_cv<int&>();
+ test_add_cv<const int&>();
+ test_add_cv<int*>();
+ test_add_cv<const int*>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_volatile
#include <type_traits>
template <class T, class U>
void test_add_volatile_imp()
{
static_assert((std::is_same<typename std::add_volatile<T>::type, volatile U>::value), "");
}
template <class T>
void test_add_volatile()
{
test_add_volatile_imp<T, volatile T>();
test_add_volatile_imp<const T, const volatile T>();
test_add_volatile_imp<volatile T, volatile T>();
test_add_volatile_imp<const volatile T, const volatile T>();
}
int main()
{
test_add_volatile<void>();
test_add_volatile<int>();
test_add_volatile<int[3]>();
test_add_volatile<int&>();
test_add_volatile<const
int&>();
test_add_volatile<int*>();
test_add_volatile<const int*>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// add_volatile
+
+#include <type_traits>
+
+template <class T, class U>
+void test_add_volatile_imp()
+{
+ static_assert((std::is_same<typename std::add_volatile<T>::type, volatile U>::value), "");
+}
+
+template <class T>
+void test_add_volatile()
+{
+ test_add_volatile_imp<T, volatile T>();
+ test_add_volatile_imp<const T, const volatile T>();
+ test_add_volatile_imp<volatile T, volatile T>();
+ test_add_volatile_imp<const volatile T, const volatile T>();
+}
+
+int main()
+{
+ test_add_volatile<void>();
+ test_add_volatile<int>();
+ test_add_volatile<int[3]>();
+ test_add_volatile<int&>();
+ test_add_volatile<const int&>();
+ test_add_volatile<int*>();
+ test_add_volatile<const int*>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_const
#include <type_traits>
template <class T, class U>
void test_remove_const_imp()
{
static_assert((std::is_same<typename std::remove_const<T>::type, U>::value), "");
}
template <class T>
void test_remove_const()
{
test_remove_const_imp<T, T>();
test_remove_const_imp<const T, T>();
test_remove_const_imp<volatile T, volatile T>();
test_remove_const_imp<const volatile T, volatile T>();
}
int main()
{
test_remove_const<void>();
test_remove_const<int>();
test_remove_const<int[3]>();
test_remove_const<int&>();
test_remove_const<const int&>();
test_remove_const<int*>();
test_remove_const<const int*>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// remove_const
+
+#include <type_traits>
+
+template <class T, class U>
+void test_remove_const_imp()
+{
+ static_assert((std::is_same<typename std::remove_const<T>::type, U>::value), "");
+}
+
+template <class T>
+void test_remove_const()
+{
+ test_remove_const_imp<T, T>();
+ test_remove_const_imp<const T, T>();
+ test_remove_const_imp<volatile T, volatile T>();
+ test_remove_const_imp<const volatile T, volatile T>();
+}
+
+int main()
+{
+ test_remove_const<void>();
+ test_remove_const<int>();
+ test_remove_const<int[3]>();
+ test_remove_const<int&>();
+ test_remove_const<const int&>();
+ test_remove_const<int*>();
+ test_remove_const<const int*>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_cv
#include <type_traits>
template <class T, class U>
void test_remove_cv_imp()
{
static_assert((std::is_same<typename std::remove_cv<T>::type, U>::value), "");
}
template <class T>
void test_remove_cv()
{
test_remove_cv_imp<T, T>();
test_remove_cv_imp<const T, T>();
test_remove_cv_imp<volatile T, T>();
test_remove_cv_imp<const volatile T, T>();
}
int main()
{
test_remove_cv<void>();
test_remove_cv<int>();
test_remove_cv<int[3]>();
test_remove_cv<int&>();
test_remove_cv<const int&>();
test_remove_cv<int*>();
test_remove_cv<const int*>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// remove_cv
+
+#include <type_traits>
+
+template <class T, class U>
+void test_remove_cv_imp()
+{
+ static_assert((std::is_same<typename std::remove_cv<T>::type, U>::value), "");
+}
+
+template <class T>
+void test_remove_cv()
+{
+ test_remove_cv_imp<T, T>();
+ test_remove_cv_imp<const T, T>();
+ test_remove_cv_imp<volatile T, T>();
+ test_remove_cv_imp<const volatile T, T>();
+}
+
+int main()
+{
+ test_remove_cv<void>();
+ test_remove_cv<int>();
+ test_remove_cv<int[3]>();
+ test_remove_cv<int&>();
+ test_remove_cv<const int&>();
+ test_remove_cv<int*>();
+ test_remove_cv<const int*>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_volatile
#include <type_traits>
template <class T, class U>
void test_remove_volatile_imp()
{
static_assert((std::is_same<typename std::remove_volatile<T>::type, U>::value), "");
}
template <class T>
void test_remove_volatile()
{
test_remove_volatile_imp<T, T>();
test_remove_volatile_imp<const T, const T>();
test_remove_volatile_imp<volatile T, T>();
test_remove_volatile_imp<const volatile T, const T>();
}
int main()
{
test_remove_volatile<void>();
test_remove_volatile<int>();
test_remove_volatile<int[3]>();
test_remove_volatile<int&>();
test_remove_volatile<const int&>(
);
test_remove_volatile<int*>();
test_remove_volatile<volatile int*>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// remove_volatile
+
+#include <type_traits>
+
+template <class T, class U>
+void test_remove_volatile_imp()
+{
+ static_assert((std::is_same<typename std::remove_volatile<T>::type, U>::value), "");
+}
+
+template <class T>
+void test_remove_volatile()
+{
+ test_remove_volatile_imp<T, T>();
+ test_remove_volatile_imp<const T, const T>();
+ test_remove_volatile_imp<volatile T, T>();
+ test_remove_volatile_imp<const volatile T, const T>();
+}
+
+int main()
+{
+ test_remove_volatile<void>();
+ test_remove_volatile<int>();
+ test_remove_volatile<int[3]>();
+ test_remove_volatile<int&>();
+ test_remove_volatile<const int&>();
+ test_remove_volatile<int*>();
+ test_remove_volatile<volatile int*>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,123 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// aligned_storage
#include <type_traits>
int main()
{
{
typedef std::aligned_storage<10, 1 >::type T1;
static_assert(std::alignment_of<T1>::value == 1, "");
static_assert(sizeof(T1) == 10, "");
}
{
typedef std::aligned_storage<10, 2 >::type T1;
static_assert(std::alignment_of<T1>::value == 2, "");
static_assert(sizeof(T1) == 10, "");
}
{
typedef std::aligned_storage<10, 4 >::type T1;
static_assert(std::alignment_of<T1>::value == 4, "");
static_assert(sizeof(T1) == 12, "");
}
{
typedef std::aligned_storage<10, 8 >::type T1;
static_assert(std::alignmen
t_of<T1>::value == 8, "");
static_assert(sizeof(T1) == 16, "");
}
{
typedef std::aligned_storage<10, 16 >::type T1;
static_assert(std::alignment_of<T1>::value == 16, "");
static_assert(sizeof(T1) == 16, "");
}
{
typedef std::aligned_storage<10, 32 >::type T1;
static_assert(std::alignment_of<T1>::value == 32, "");
static_assert(sizeof(T1) == 32, "");
}
{
typedef std::aligned_storage<20, 32 >::type T1;
static_assert(std::alignment_of<T1>::value == 32, "");
static_assert(sizeof(T1) == 32, "");
}
{
typedef std::aligned_storage<40, 32 >::type T1;
static_assert(std::alignment_of<T1>::value == 32, "");
static_assert(sizeof(T1) == 64, "");
}
{
typedef std::aligned_storage<12, 16 >::type T1;
static_assert(std::alignment_of<T1>::value == 16, "");
static_assert(sizeof(T1) == 16, "");
}
{
typedef std::aligned_storage<1>::type T1;
static_assert(std::alignment_of<T1>::va
lue == 1, "");
static_assert(sizeof(T1) == 1, "");
}
{
typedef std::aligned_storage<2>::type T1;
static_assert(std::alignment_of<T1>::value == 2, "");
static_assert(sizeof(T1) == 2, "");
}
{
typedef std::aligned_storage<3>::type T1;
static_assert(std::alignment_of<T1>::value == 2, "");
static_assert(sizeof(T1) == 4, "");
}
{
typedef std::aligned_storage<4>::type T1;
static_assert(std::alignment_of<T1>::value == 4, "");
static_assert(sizeof(T1) == 4, "");
}
{
typedef std::aligned_storage<5>::type T1;
static_assert(std::alignment_of<T1>::value == 4, "");
static_assert(sizeof(T1) == 8, "");
}
{
typedef std::aligned_storage<7>::type T1;
static_assert(std::alignment_of<T1>::value == 4, "");
static_assert(sizeof(T1) == 8, "");
}
{
typedef std::aligned_storage<8>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
static_a
ssert(sizeof(T1) == 8, "");
}
{
typedef std::aligned_storage<9>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), "");
}
{
typedef std::aligned_storage<15>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
static_assert(sizeof(T1) == 16, "");
}
{
typedef std::aligned_storage<16>::type T1;
static_assert(std::alignment_of<T1>::value == 16, "");
static_assert(sizeof(T1) == 16, "");
}
{
typedef std::aligned_storage<17>::type T1;
static_assert(std::alignment_of<T1>::value == 16, "");
static_assert(sizeof(T1) == 32, "");
}
{
typedef std::aligned_storage<10>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// aligned_storage
+
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::aligned_storage<10, 1 >::type T1;
+ static_assert(std::alignment_of<T1>::value == 1, "");
+ static_assert(sizeof(T1) == 10, "");
+ }
+ {
+ typedef std::aligned_storage<10, 2 >::type T1;
+ static_assert(std::alignment_of<T1>::value == 2, "");
+ static_assert(sizeof(T1) == 10, "");
+ }
+ {
+ typedef std::aligned_storage<10, 4 >::type T1;
+ static_assert(std::alignment_of<T1>::value == 4, "");
+ static_assert(sizeof(T1) == 12, "");
+ }
+ {
+ typedef std::aligned_storage<10, 8 >::type T1;
+ static_assert(std::alignment_of<T1>::value == 8, "");
+ static_assert(sizeof(T1) == 16, "");
+ }
+ {
+ typedef std::aligned_storage<10, 16 >::type T1;
+ static_assert(std::alignment_of<T1>::value == 16, "");
+ static_assert(sizeof(T1) == 16, "");
+ }
+ {
+ typedef std::aligned_storage<10, 32 >::type T1;
+ static_assert(std::alignment_of<T1>::value == 32, "");
+ static_assert(sizeof(T1) == 32, "");
+ }
+ {
+ typedef std::aligned_storage<20, 32 >::type T1;
+ static_assert(std::alignment_of<T1>::value == 32, "");
+ static_assert(sizeof(T1) == 32, "");
+ }
+ {
+ typedef std::aligned_storage<40, 32 >::type T1;
+ static_assert(std::alignment_of<T1>::value == 32, "");
+ static_assert(sizeof(T1) == 64, "");
+ }
+ {
+ typedef std::aligned_storage<12, 16 >::type T1;
+ static_assert(std::alignment_of<T1>::value == 16, "");
+ static_assert(sizeof(T1) == 16, "");
+ }
+ {
+ typedef std::aligned_storage<1>::type T1;
+ static_assert(std::alignment_of<T1>::value == 1, "");
+ static_assert(sizeof(T1) == 1, "");
+ }
+ {
+ typedef std::aligned_storage<2>::type T1;
+ static_assert(std::alignment_of<T1>::value == 2, "");
+ static_assert(sizeof(T1) == 2, "");
+ }
+ {
+ typedef std::aligned_storage<3>::type T1;
+ static_assert(std::alignment_of<T1>::value == 2, "");
+ static_assert(sizeof(T1) == 4, "");
+ }
+ {
+ typedef std::aligned_storage<4>::type T1;
+ static_assert(std::alignment_of<T1>::value == 4, "");
+ static_assert(sizeof(T1) == 4, "");
+ }
+ {
+ typedef std::aligned_storage<5>::type T1;
+ static_assert(std::alignment_of<T1>::value == 4, "");
+ static_assert(sizeof(T1) == 8, "");
+ }
+ {
+ typedef std::aligned_storage<7>::type T1;
+ static_assert(std::alignment_of<T1>::value == 4, "");
+ static_assert(sizeof(T1) == 8, "");
+ }
+ {
+ typedef std::aligned_storage<8>::type T1;
+ static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
+ static_assert(sizeof(T1) == 8, "");
+ }
+ {
+ typedef std::aligned_storage<9>::type T1;
+ static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
+ static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), "");
+ }
+ {
+ typedef std::aligned_storage<15>::type T1;
+ static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
+ static_assert(sizeof(T1) == 16, "");
+ }
+ {
+ typedef std::aligned_storage<16>::type T1;
+ static_assert(std::alignment_of<T1>::value == 16, "");
+ static_assert(sizeof(T1) == 16, "");
+ }
+ {
+ typedef std::aligned_storage<17>::type T1;
+ static_assert(std::alignment_of<T1>::value == 16, "");
+ static_assert(sizeof(T1) == 32, "");
+ }
+ {
+ typedef std::aligned_storage<10>::type T1;
+ static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
+ static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), "");
+ }
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// common_type
#include <type_traits>
int main()
{
static_assert((std::is_same<std::common_type<int>::type, int>::value), "");
static_assert((std::is_same<std::common_type<char>::type, char>::value), "");
static_assert((std::is_same<std::common_type<double, char>::type, double>::value), "");
static_assert((std::is_same<std::common_type<short, char>::type, int>::value), "");
static_assert((std::is_same<std::common_type<double, char, long long>::type, double>::value), "");
static_assert((std::is_same<std::common_type<unsigned, char, long long>::type, long long>::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// common_type
+
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_same<std::common_type<int>::type, int>::value), "");
+ static_assert((std::is_same<std::common_type<char>::type, char>::value), "");
+
+ static_assert((std::is_same<std::common_type<double, char>::type, double>::value), "");
+ static_assert((std::is_same<std::common_type<short, char>::type, int>::value), "");
+
+ static_assert((std::is_same<std::common_type<double, char, long long>::type, double>::value), "");
+ static_assert((std::is_same<std::common_type<unsigned, char, long long>::type, long long>::value), "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,20 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// conditional
#include <type_traits>
int main()
{
static_assert((std::is_same<std::conditional<true, char, int>::type, char>::value), "");
static_assert((std::is_same<std::conditional<false, char, int>::type, int>::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// conditional
+
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_same<std::conditional<true, char, int>::type, char>::value), "");
+ static_assert((std::is_same<std::conditional<false, char, int>::type, int>::value), "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// decay
#include <type_traits>
template <class T, class U>
void test_decay()
{
static_assert((std::is_same<typename std::decay<T>::type, U>::value), "");
}
int main()
{
test_decay<void, void>();
test_decay<int, int>();
test_decay<const volatile int, int>();
test_decay<int*, int*>();
test_decay<int[3], int*>();
test_decay<const int[3], const int*>();
test_decay<void(), void (*)()>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// decay
+
+#include <type_traits>
+
+template <class T, class U>
+void test_decay()
+{
+ static_assert((std::is_same<typename std::decay<T>::type, U>::value), "");
+}
+
+int main()
+{
+ test_decay<void, void>();
+ test_decay<int, int>();
+ test_decay<const volatile int, int>();
+ test_decay<int*, int*>();
+ test_decay<int[3], int*>();
+ test_decay<const int[3], const int*>();
+ test_decay<void(), void (*)()>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,19 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// enable_if
#include <type_traits>
int main()
{
typedef std::enable_if<false>::type A;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// enable_if
+
+#include <type_traits>
+
+int main()
+{
+ typedef std::enable_if<false>::type A;
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,20 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// enable_if
#include <type_traits>
int main()
{
static_assert((std::is_same<std::enable_if<true>::type, void>::value), "");
static_assert((std::is_same<std::enable_if<true, int>::type, int>::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// enable_if
+
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_same<std::enable_if<true>::type, void>::value), "");
+ static_assert((std::is_same<std::enable_if<true, int>::type, int>::value), "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,39 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// result_of<Fn(ArgTypes...)>
#include <type_traits>
#include <memory>
typedef bool (&PF1)();
typedef short (*PF2)(long);
struct S
{
operator PF2() const;
double operator()(char, int&);
void calc(long) const;
char data_;
};
typedef void (S::*PMS)(long) const;
typedef char S::*PMD;
int main()
{
static_assert((std::is_same<std::result_of<S(int)>::type, short>::value), "Error!");
static_assert((std::is_same<std::result_of<S&(unsigned char, int&)>::type, double>::value), "Error!");
static_assert((std::is_same<std::result_of<PF1()>::type, bool>::value), "Error!");
// static_assert(std::is_sa
me<std::result_of<PMS(std::unique_ptr<S>, int)>::type, void>::value, "Error!");
// static_assert(std::is_same<std::result_of<PMD(S)>::type, char&&>::value, "Error!");
// static_assert(std::is_same<std::result_of<PMD(const S*)>::type, const char&>::value, "Error!");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// result_of<Fn(ArgTypes...)>
+
+#include <type_traits>
+#include <memory>
+
+typedef bool (&PF1)();
+typedef short (*PF2)(long);
+
+struct S
+{
+ operator PF2() const;
+ double operator()(char, int&);
+ void calc(long) const;
+ char data_;
+};
+
+typedef void (S::*PMS)(long) const;
+typedef char S::*PMD;
+
+int main()
+{
+ static_assert((std::is_same<std::result_of<S(int)>::type, short>::value), "Error!");
+ static_assert((std::is_same<std::result_of<S&(unsigned char, int&)>::type, double>::value), "Error!");
+ static_assert((std::is_same<std::result_of<PF1()>::type, bool>::value), "Error!");
+// static_assert(std::is_same<std::result_of<PMS(std::unique_ptr<S>, int)>::type, void>::value, "Error!");
+// static_assert(std::is_same<std::result_of<PMD(S)>::type, char&&>::value, "Error!");
+// static_assert(std::is_same<std::result_of<PMD(const S*)>::type, const char&>::value, "Error!");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,19 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// underlying_type
#include <type_traits>
int main()
{
#error underlying_type is not implemented
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// underlying_type
+
+#include <type_traits>
+
+int main()
+{
+#error underlying_type is not implemented
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_pointer
#include <type_traits>
template <class T, class U>
void test_add_pointer()
{
static_assert((std::is_same<typename std::add_pointer<T>::type, U>::value), "");
}
int main()
{
test_add_pointer<void, void*>();
test_add_pointer<int, int*>();
test_add_pointer<int[3], int(*)[3]>();
test_add_pointer<int&, int*>();
test_add_pointer<const int&, const int*>();
test_add_pointer<int*, int**>();
test_add_pointer<const int*, const int**>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// add_pointer
+
+#include <type_traits>
+
+template <class T, class U>
+void test_add_pointer()
+{
+ static_assert((std::is_same<typename std::add_pointer<T>::type, U>::value), "");
+}
+
+int main()
+{
+ test_add_pointer<void, void*>();
+ test_add_pointer<int, int*>();
+ test_add_pointer<int[3], int(*)[3]>();
+ test_add_pointer<int&, int*>();
+ test_add_pointer<const int&, const int*>();
+ test_add_pointer<int*, int**>();
+ test_add_pointer<const int*, const int**>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_pointer
#include <type_traits>
template <class T, class U>
void test_remove_pointer()
{
static_assert((std::is_same<typename std::remove_pointer<T>::type, U>::value), "");
}
int main()
{
test_remove_pointer<void, void>();
test_remove_pointer<int, int>();
test_remove_pointer<int[3], int[3]>();
test_remove_pointer<int*, int>();
test_remove_pointer<const int*, const int>();
test_remove_pointer<int**, int*>();
test_remove_pointer<int** const, int*>();
test_remove_pointer<int*const * , int* const>();
test_remove_pointer<const int** , const int*>();
test_remove_pointer<int
&, int&>();
test_remove_pointer<const int&, const int&>();
test_remove_pointer<int(&)[3], int(&)[3]>();
test_remove_pointer<int(*)[3], int[3]>();
test_remove_pointer<int*&, int*&>();
test_remove_pointer<const int*&, const int*&>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// remove_pointer
+
+#include <type_traits>
+
+template <class T, class U>
+void test_remove_pointer()
+{
+ static_assert((std::is_same<typename std::remove_pointer<T>::type, U>::value), "");
+}
+
+int main()
+{
+ test_remove_pointer<void, void>();
+ test_remove_pointer<int, int>();
+ test_remove_pointer<int[3], int[3]>();
+ test_remove_pointer<int*, int>();
+ test_remove_pointer<const int*, const int>();
+ test_remove_pointer<int**, int*>();
+ test_remove_pointer<int** const, int*>();
+ test_remove_pointer<int*const * , int* const>();
+ test_remove_pointer<const int** , const int*>();
+
+ test_remove_pointer<int&, int&>();
+ test_remove_pointer<const int&, const int&>();
+ test_remove_pointer<int(&)[3], int(&)[3]>();
+ test_remove_pointer<int(*)[3], int[3]>();
+ test_remove_pointer<int*&, int*&>();
+ test_remove_pointer<const int*&, const int*&>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_lvalue_reference
#include <type_traits>
template <class T, class U>
void test_add_lvalue_reference()
{
static_assert((std::is_same<typename std::add_lvalue_reference<T>::type, U>::value), "");
}
int main()
{
test_add_lvalue_reference<void, void>();
test_add_lvalue_reference<int, int&>();
test_add_lvalue_reference<int[3], int(&)[3]>();
test_add_lvalue_reference<int&, int&>();
test_add_lvalue_reference<const int&, const int&>();
test_add_lvalue_reference<int*, int*&>();
test_add_lvalue_reference<const int*, const int*&>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// add_lvalue_reference
+
+#include <type_traits>
+
+template <class T, class U>
+void test_add_lvalue_reference()
+{
+ static_assert((std::is_same<typename std::add_lvalue_reference<T>::type, U>::value), "");
+}
+
+int main()
+{
+ test_add_lvalue_reference<void, void>();
+ test_add_lvalue_reference<int, int&>();
+ test_add_lvalue_reference<int[3], int(&)[3]>();
+ test_add_lvalue_reference<int&, int&>();
+ test_add_lvalue_reference<const int&, const int&>();
+ test_add_lvalue_reference<int*, int*&>();
+ test_add_lvalue_reference<const int*, const int*&>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,37 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_rvalue_reference
#include <type_traits>
#ifdef _LIBCPP_MOVE
template <class T, class U>
void test_add_rvalue_reference()
{
static_assert((std::is_same<typename std::add_rvalue_reference<T>::type, U>::value), "");
}
#endif
int main()
{
#ifdef _LIBCPP_MOVE
test_add_rvalue_reference<void, void>();
test_add_rvalue_reference<int, int&&>();
test_add_rvalue_reference<int[3], int(&&)[3]>();
test_add_rvalue_reference<int&, int&>();
test_add_rvalue_reference<const int&, const int&>();
test_add_rvalue_reference<int*, int*&&>();
test_add_rvalue_reference<const int*, const int*&&>();
#endif
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// add_rvalue_reference
+
+#include <type_traits>
+
+#ifdef _LIBCPP_MOVE
+
+template <class T, class U>
+void test_add_rvalue_reference()
+{
+ static_assert((std::is_same<typename std::add_rvalue_reference<T>::type, U>::value), "");
+}
+
+#endif // _LIBCPP_MOVE
+
+int main()
+{
+#ifdef _LIBCPP_MOVE
+ test_add_rvalue_reference<void, void>();
+ test_add_rvalue_reference<int, int&&>();
+ test_add_rvalue_reference<int[3], int(&&)[3]>();
+ test_add_rvalue_reference<int&, int&>();
+ test_add_rvalue_reference<const int&, const int&>();
+ test_add_rvalue_reference<int*, int*&&>();
+ test_add_rvalue_reference<const int*, const int*&&>();
+#endif // _LIBCPP_MOVE
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,43 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_reference
#include <type_traits>
template <class T, class U>
void test_remove_reference()
{
static_assert((std::is_same<typename std::remove_reference<T>::type, U>::value), "");
}
int main()
{
test_remove_reference<void, void>();
test_remove_reference<int, int>();
test_remove_reference<int[3], int[3]>();
test_remove_reference<int*, int*>();
test_remove_reference<const int*, const int*>();
test_remove_reference<int&, int>();
test_remove_reference<const int&, const int>();
test_remove_reference<int(&)[3], int[3]>();
test_remove_reference<int*&, int*>();
test_remove_ref
erence<const int*&, const int*>();
#ifdef _LIBCPP_MOVE
test_remove_reference<int&&, int>();
test_remove_reference<const int&&, const int>();
test_remove_reference<int(&&)[3], int[3]>();
test_remove_reference<int*&&, int*>();
test_remove_reference<const int*&&, const int*>();
#endif
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// remove_reference
+
+#include <type_traits>
+
+template <class T, class U>
+void test_remove_reference()
+{
+ static_assert((std::is_same<typename std::remove_reference<T>::type, U>::value), "");
+}
+
+int main()
+{
+ test_remove_reference<void, void>();
+ test_remove_reference<int, int>();
+ test_remove_reference<int[3], int[3]>();
+ test_remove_reference<int*, int*>();
+ test_remove_reference<const int*, const int*>();
+
+ test_remove_reference<int&, int>();
+ test_remove_reference<const int&, const int>();
+ test_remove_reference<int(&)[3], int[3]>();
+ test_remove_reference<int*&, int*>();
+ test_remove_reference<const int*&, const int*>();
+
+#ifdef _LIBCPP_MOVE
+ test_remove_reference<int&&, int>();
+ test_remove_reference<const int&&, const int>();
+ test_remove_reference<int(&&)[3], int[3]>();
+ test_remove_reference<int*&&, int*>();
+ test_remove_reference<const int*&&, const int*>();
+#endif // _LIBCPP_MOVE
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// make_signed
#include <type_traits>
enum Enum {zero, one_};
enum BigEnum
{
bzero,
big = 0xFFFFFFFFFFFFFFFFULL
};
int main()
{
static_assert((std::is_same<std::make_signed<signed char>::type, signed char>::value), "");
static_assert((std::is_same<std::make_signed<unsigned char>::type, signed char>::value), "");
static_assert((std::is_same<std::make_signed<char>::type, signed char>::value), "");
static_assert((std::is_same<std::make_signed<short>::type, signed short>::value), "");
static_assert((std::is_same<std::make_signed<unsigned short>::type, signed short>::value), "");
static_assert
((std::is_same<std::make_signed<int>::type, signed int>::value), "");
static_assert((std::is_same<std::make_signed<unsigned int>::type, signed int>::value), "");
static_assert((std::is_same<std::make_signed<long>::type, signed long>::value), "");
static_assert((std::is_same<std::make_signed<unsigned long>::type, long>::value), "");
static_assert((std::is_same<std::make_signed<long long>::type, signed long long>::value), "");
static_assert((std::is_same<std::make_signed<unsigned long long>::type, signed long long>::value), "");
static_assert((std::is_same<std::make_signed<wchar_t>::type, int>::value), "");
static_assert((std::is_same<std::make_signed<const wchar_t>::type, const int>::value), "");
static_assert((std::is_same<std::make_signed<const Enum>::type, const int>::value), "");
static_assert((std::is_same<std::make_signed<BigEnum>::type,
std::conditional<sizeof(long) == 4, long long, long>::type>::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// make_signed
+
+#include <type_traits>
+
+enum Enum {zero, one_};
+
+enum BigEnum
+{
+ bzero,
+ big = 0xFFFFFFFFFFFFFFFFULL
+};
+
+int main()
+{
+ static_assert((std::is_same<std::make_signed<signed char>::type, signed char>::value), "");
+ static_assert((std::is_same<std::make_signed<unsigned char>::type, signed char>::value), "");
+ static_assert((std::is_same<std::make_signed<char>::type, signed char>::value), "");
+ static_assert((std::is_same<std::make_signed<short>::type, signed short>::value), "");
+ static_assert((std::is_same<std::make_signed<unsigned short>::type, signed short>::value), "");
+ static_assert((std::is_same<std::make_signed<int>::type, signed int>::value), "");
+ static_assert((std::is_same<std::make_signed<unsigned int>::type, signed int>::value), "");
+ static_assert((std::is_same<std::make_signed<long>::type, signed long>::value), "");
+ static_assert((std::is_same<std::make_signed<unsigned long>::type, long>::value), "");
+ static_assert((std::is_same<std::make_signed<long long>::type, signed long long>::value), "");
+ static_assert((std::is_same<std::make_signed<unsigned long long>::type, signed long long>::value), "");
+ static_assert((std::is_same<std::make_signed<wchar_t>::type, int>::value), "");
+ static_assert((std::is_same<std::make_signed<const wchar_t>::type, const int>::value), "");
+ static_assert((std::is_same<std::make_signed<const Enum>::type, const int>::value), "");
+ static_assert((std::is_same<std::make_signed<BigEnum>::type,
+ std::conditional<sizeof(long) == 4, long long, long>::type>::value), "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// make_unsigned
#include <type_traits>
enum Enum {zero, one_};
enum BigEnum
{
bzero,
big = 0xFFFFFFFFFFFFFFFFULL
};
int main()
{
static_assert((std::is_same<std::make_unsigned<signed char>::type, unsigned char>::value), "");
static_assert((std::is_same<std::make_unsigned<unsigned char>::type, unsigned char>::value), "");
static_assert((std::is_same<std::make_unsigned<char>::type, unsigned char>::value), "");
static_assert((std::is_same<std::make_unsigned<short>::type, unsigned short>::value), "");
static_assert((std::is_same<std::make_unsigned<unsigned short>::type, unsigned short>::value),
"");
static_assert((std::is_same<std::make_unsigned<int>::type, unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<unsigned int>::type, unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<long>::type, unsigned long>::value), "");
static_assert((std::is_same<std::make_unsigned<unsigned long>::type, unsigned long>::value), "");
static_assert((std::is_same<std::make_unsigned<long long>::type, unsigned long long>::value), "");
static_assert((std::is_same<std::make_unsigned<unsigned long long>::type, unsigned long long>::value), "");
static_assert((std::is_same<std::make_unsigned<wchar_t>::type, unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<const wchar_t>::type, const unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<const Enum>::type, const unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<BigEnum>::type,
std::conditional<sizeof(long) == 4, unsigned long long, unsigned long>::type>::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// make_unsigned
+
+#include <type_traits>
+
+enum Enum {zero, one_};
+
+enum BigEnum
+{
+ bzero,
+ big = 0xFFFFFFFFFFFFFFFFULL
+};
+
+int main()
+{
+ static_assert((std::is_same<std::make_unsigned<signed char>::type, unsigned char>::value), "");
+ static_assert((std::is_same<std::make_unsigned<unsigned char>::type, unsigned char>::value), "");
+ static_assert((std::is_same<std::make_unsigned<char>::type, unsigned char>::value), "");
+ static_assert((std::is_same<std::make_unsigned<short>::type, unsigned short>::value), "");
+ static_assert((std::is_same<std::make_unsigned<unsigned short>::type, unsigned short>::value), "");
+ static_assert((std::is_same<std::make_unsigned<int>::type, unsigned int>::value), "");
+ static_assert((std::is_same<std::make_unsigned<unsigned int>::type, unsigned int>::value), "");
+ static_assert((std::is_same<std::make_unsigned<long>::type, unsigned long>::value), "");
+ static_assert((std::is_same<std::make_unsigned<unsigned long>::type, unsigned long>::value), "");
+ static_assert((std::is_same<std::make_unsigned<long long>::type, unsigned long long>::value), "");
+ static_assert((std::is_same<std::make_unsigned<unsigned long long>::type, unsigned long long>::value), "");
+ static_assert((std::is_same<std::make_unsigned<wchar_t>::type, unsigned int>::value), "");
+ static_assert((std::is_same<std::make_unsigned<const wchar_t>::type, const unsigned int>::value), "");
+ static_assert((std::is_same<std::make_unsigned<const Enum>::type, const unsigned int>::value), "");
+ static_assert((std::is_same<std::make_unsigned<BigEnum>::type,
+ std::conditional<sizeof(long) == 4, unsigned long long, unsigned long>::type>::value), "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.trans/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.trans/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.trans/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.trans/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,52 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// array
#include <type_traits>
template <class T>
void test_array_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert( std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "
");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_array()
{
test_array_imp<T>();
test_array_imp<const T>();
test_array_imp<volatile T>();
test_array_imp<const volatile T>();
}
typedef char array[3];
typedef const char const_array[3];
typedef char incomplete_array[];
int main()
{
test_array<array>();
test_array<const_array>();
test_array<incomplete_array>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// array
+
+#include <type_traits>
+
+template <class T>
+void test_array_imp()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert( std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_array()
+{
+ test_array_imp<T>();
+ test_array_imp<const T>();
+ test_array_imp<volatile T>();
+ test_array_imp<const volatile T>();
+}
+
+typedef char array[3];
+typedef const char const_array[3];
+typedef char incomplete_array[];
+
+int main()
+{
+ test_array<array>();
+ test_array<const_array>();
+ test_array<incomplete_array>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,52 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// class
#include <type_traits>
template <class T>
void test_class_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "
");
static_assert(!std::is_union<T>::value, "");
static_assert( std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_class()
{
test_class_imp<T>();
test_class_imp<const T>();
test_class_imp<volatile T>();
test_class_imp<const volatile T>();
}
class Class
{
int _;
double __;
};
int main()
{
test_class<Class>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// class
+
+#include <type_traits>
+
+template <class T>
+void test_class_imp()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert( std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_class()
+{
+ test_class_imp<T>();
+ test_class_imp<const T>();
+ test_class_imp<volatile T>();
+ test_class_imp<const volatile T>();
+}
+
+class Class
+{
+ int _;
+ double __;
+};
+
+int main()
+{
+ test_class<Class>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// enum
#include <type_traits>
template <class T>
void test_enum_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert( std::is_enum<T>::value, "")
;
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_enum()
{
test_enum_imp<T>();
test_enum_imp<const T>();
test_enum_imp<volatile T>();
test_enum_imp<const volatile T>();
}
enum Enum {zero, one};
int main()
{
test_enum<Enum>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// enum
+
+#include <type_traits>
+
+template <class T>
+void test_enum_imp()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert( std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_enum()
+{
+ test_enum_imp<T>();
+ test_enum_imp<const T>();
+ test_enum_imp<volatile T>();
+ test_enum_imp<const volatile T>();
+}
+
+enum Enum {zero, one};
+
+int main()
+{
+ test_enum<Enum>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// floating_point
#include <type_traits>
template <class T>
void test_floating_point_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert( std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is
_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_floating_point()
{
test_floating_point_imp<T>();
test_floating_point_imp<const T>();
test_floating_point_imp<volatile T>();
test_floating_point_imp<const volatile T>();
}
int main()
{
test_floating_point<float>();
test_floating_point<double>();
test_floating_point<long double>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// floating_point
+
+#include <type_traits>
+
+template <class T>
+void test_floating_point_imp()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert( std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_floating_point()
+{
+ test_floating_point_imp<T>();
+ test_floating_point_imp<const T>();
+ test_floating_point_imp<volatile T>();
+ test_floating_point_imp<const volatile T>();
+}
+
+int main()
+{
+ test_floating_point<float>();
+ test_floating_point<double>();
+ test_floating_point<long double>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,49 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// function
#include <type_traits>
template <class T>
void test_function_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::va
lue, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert( std::is_function<T>::value, "");
}
template <class T>
void test_function()
{
test_function_imp<T>();
test_function_imp<const T>();
test_function_imp<volatile T>();
test_function_imp<const volatile T>();
}
int main()
{
test_function<void ()>();
test_function<void (int)>();
test_function<int (double)>();
test_function<int (double, char)>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// function
+
+#include <type_traits>
+
+template <class T>
+void test_function_imp()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert( std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_function()
+{
+ test_function_imp<T>();
+ test_function_imp<const T>();
+ test_function_imp<volatile T>();
+ test_function_imp<const volatile T>();
+}
+
+int main()
+{
+ test_function<void ()>();
+ test_function<void (int)>();
+ test_function<int (double)>();
+ test_function<int (double, char)>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// integral
#include <type_traits>
template <class T>
void test_integral_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert( std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::va
lue, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_integral()
{
test_integral_imp<T>();
test_integral_imp<const T>();
test_integral_imp<volatile T>();
test_integral_imp<const volatile T>();
}
int main()
{
test_integral<bool>();
test_integral<char>();
test_integral<signed char>();
test_integral<unsigned char>();
test_integral<wchar_t>();
test_integral<short>();
test_integral<unsigned short>();
test_integral<int>();
test_integral<unsigned int>();
test_integral<long>();
test_integral<unsigned long>();
test_integral<long long>();
test_integral<unsigned long long>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// integral
+
+#include <type_traits>
+
+template <class T>
+void test_integral_imp()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert( std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_integral()
+{
+ test_integral_imp<T>();
+ test_integral_imp<const T>();
+ test_integral_imp<volatile T>();
+ test_integral_imp<const volatile T>();
+}
+
+int main()
+{
+ test_integral<bool>();
+ test_integral<char>();
+ test_integral<signed char>();
+ test_integral<unsigned char>();
+ test_integral<wchar_t>();
+ test_integral<short>();
+ test_integral<unsigned short>();
+ test_integral<int>();
+ test_integral<unsigned int>();
+ test_integral<long>();
+ test_integral<unsigned long>();
+ test_integral<long long>();
+ test_integral<unsigned long long>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,38 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// lvalue_ref
#include <type_traits>
template <class T>
void test_lvalue_ref()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert( std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::va
lue, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
int main()
{
test_lvalue_ref<int&>();
test_lvalue_ref<const int&>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// lvalue_ref
+
+#include <type_traits>
+
+template <class T>
+void test_lvalue_ref()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert( std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+int main()
+{
+ test_lvalue_ref<int&>();
+ test_lvalue_ref<const int&>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,52 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// member_function_pointer
#include <type_traits>
template <class T>
void test_member_function_pointer_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert( std::is_member_function_pointer<T>::value, "");
stat
ic_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_member_function_pointer()
{
test_member_function_pointer_imp<T>();
test_member_function_pointer_imp<const T>();
test_member_function_pointer_imp<volatile T>();
test_member_function_pointer_imp<const volatile T>();
}
class Class
{
};
int main()
{
test_member_function_pointer<void (Class::*)()>();
test_member_function_pointer<void (Class::*)(int)>();
test_member_function_pointer<void (Class::*)(int, char)>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// member_function_pointer
+
+#include <type_traits>
+
+template <class T>
+void test_member_function_pointer_imp()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert( std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_member_function_pointer()
+{
+ test_member_function_pointer_imp<T>();
+ test_member_function_pointer_imp<const T>();
+ test_member_function_pointer_imp<volatile T>();
+ test_member_function_pointer_imp<const volatile T>();
+}
+
+class Class
+{
+};
+
+int main()
+{
+ test_member_function_pointer<void (Class::*)()>();
+ test_member_function_pointer<void (Class::*)(int)>();
+ test_member_function_pointer<void (Class::*)(int, char)>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,50 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// member_object_pointer
#include <type_traits>
template <class T>
void test_member_object_pointer_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert( std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_a
ssert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_member_object_pointer()
{
test_member_object_pointer_imp<T>();
test_member_object_pointer_imp<const T>();
test_member_object_pointer_imp<volatile T>();
test_member_object_pointer_imp<const volatile T>();
}
class Class
{
};
int main()
{
test_member_object_pointer<int Class::*>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// member_object_pointer
+
+#include <type_traits>
+
+template <class T>
+void test_member_object_pointer_imp()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert( std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_member_object_pointer()
+{
+ test_member_object_pointer_imp<T>();
+ test_member_object_pointer_imp<const T>();
+ test_member_object_pointer_imp<volatile T>();
+ test_member_object_pointer_imp<const volatile T>();
+}
+
+class Class
+{
+};
+
+int main()
+{
+ test_member_object_pointer<int Class::*>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,49 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// pointer
#include <type_traits>
template <class T>
void test_pointer_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert( std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::valu
e, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_pointer()
{
test_pointer_imp<T>();
test_pointer_imp<const T>();
test_pointer_imp<volatile T>();
test_pointer_imp<const volatile T>();
}
int main()
{
test_pointer<void*>();
test_pointer<int*>();
test_pointer<const int*>();
test_pointer<void (*)(int)>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// pointer
+
+#include <type_traits>
+
+template <class T>
+void test_pointer_imp()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert( std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_pointer()
+{
+ test_pointer_imp<T>();
+ test_pointer_imp<const T>();
+ test_pointer_imp<volatile T>();
+ test_pointer_imp<const volatile T>();
+}
+
+int main()
+{
+ test_pointer<void*>();
+ test_pointer<int*>();
+ test_pointer<const int*>();
+ test_pointer<void (*)(int)>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// rvalue_ref
#include <type_traits>
template <class T>
void test_rvalue_ref()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert( std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::va
lue, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
int main()
{
#ifdef _LIBCPP_MOVE
test_rvalue_ref<int&&>();
test_rvalue_ref<const int&&>();
#endif
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// rvalue_ref
+
+#include <type_traits>
+
+template <class T>
+void test_rvalue_ref()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert( std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+int main()
+{
+#ifdef _LIBCPP_MOVE
+ test_rvalue_ref<int&&>();
+ test_rvalue_ref<const int&&>();
+#endif // _LIBCPP_MOVE
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,52 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// union
#include <type_traits>
template <class T>
void test_union_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "
");
static_assert( std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_union()
{
test_union_imp<T>();
test_union_imp<const T>();
test_union_imp<volatile T>();
test_union_imp<const volatile T>();
}
union Union
{
int _;
double __;
};
int main()
{
test_union<Union>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// union
+
+#include <type_traits>
+
+template <class T>
+void test_union_imp()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert( std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_union()
+{
+ test_union_imp<T>();
+ test_union_imp<const T>();
+ test_union_imp<volatile T>();
+ test_union_imp<const volatile T>();
+}
+
+union Union
+{
+ int _;
+ double __;
+};
+
+int main()
+{
+ test_union<Union>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// void
#include <type_traits>
template <class T>
void test_void_imp()
{
static_assert( std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "")
;
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_void()
{
test_void_imp<T>();
test_void_imp<const T>();
test_void_imp<volatile T>();
test_void_imp<const volatile T>();
}
int main()
{
test_void<void>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// void
+
+#include <type_traits>
+
+template <class T>
+void test_void_imp()
+{
+ static_assert( std::is_void<T>::value, "");
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_function_pointer<T>::value, "");
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_void()
+{
+ test_void_imp<T>();
+ test_void_imp<const T>();
+ test_void_imp<volatile T>();
+ test_void_imp<const volatile T>();
+}
+
+int main()
+{
+ test_void<void>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// array
#include <type_traits>
template <class T>
void test_array_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_array()
{
test_array_imp<T>();
test_array_imp<const T>();
test_array_imp<volatile T>();
test_array_imp<const volatile T>();
}
typedef
char array[3];
typedef const char const_array[3];
typedef char incomplete_array[];
int main()
{
test_array<array>();
test_array<const_array>();
test_array<incomplete_array>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// array
+
+#include <type_traits>
+
+template <class T>
+void test_array_imp()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert(!std::is_fundamental<T>::value, "");
+ static_assert( std::is_object<T>::value, "");
+ static_assert(!std::is_scalar<T>::value, "");
+ static_assert( std::is_compound<T>::value, "");
+ static_assert(!std::is_member_pointer<T>::value, "");
+}
+
+template <class T>
+void test_array()
+{
+ test_array_imp<T>();
+ test_array_imp<const T>();
+ test_array_imp<volatile T>();
+ test_array_imp<const volatile T>();
+}
+
+typedef char array[3];
+typedef const char const_array[3];
+typedef char incomplete_array[];
+
+int main()
+{
+ test_array<array>();
+ test_array<const_array>();
+ test_array<incomplete_array>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// class
#include <type_traits>
template <class T>
void test_class_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_class()
{
test_class_imp<T>();
test_class_imp<const T>();
test_class_imp<volatile T>();
test_class_imp<const volatile T>();
}
class C
lass
{
int _;
double __;
};
int main()
{
test_class<Class>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// class
+
+#include <type_traits>
+
+template <class T>
+void test_class_imp()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert(!std::is_fundamental<T>::value, "");
+ static_assert( std::is_object<T>::value, "");
+ static_assert(!std::is_scalar<T>::value, "");
+ static_assert( std::is_compound<T>::value, "");
+ static_assert(!std::is_member_pointer<T>::value, "");
+}
+
+template <class T>
+void test_class()
+{
+ test_class_imp<T>();
+ test_class_imp<const T>();
+ test_class_imp<volatile T>();
+ test_class_imp<const volatile T>();
+}
+
+class Class
+{
+ int _;
+ double __;
+};
+
+int main()
+{
+ test_class<Class>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// enum
#include <type_traits>
template <class T>
void test_enum_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_enum()
{
test_enum_imp<T>();
test_enum_imp<const T>();
test_enum_imp<volatile T>();
test_enum_imp<const volatile T>();
}
enum Enum {zer
o, one};
int main()
{
test_enum<Enum>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// enum
+
+#include <type_traits>
+
+template <class T>
+void test_enum_imp()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert(!std::is_fundamental<T>::value, "");
+ static_assert( std::is_object<T>::value, "");
+ static_assert( std::is_scalar<T>::value, "");
+ static_assert( std::is_compound<T>::value, "");
+ static_assert(!std::is_member_pointer<T>::value, "");
+}
+
+template <class T>
+void test_enum()
+{
+ test_enum_imp<T>();
+ test_enum_imp<const T>();
+ test_enum_imp<volatile T>();
+ test_enum_imp<const volatile T>();
+}
+
+enum Enum {zero, one};
+
+int main()
+{
+ test_enum<Enum>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// floating_point
#include <type_traits>
template <class T>
void test_floating_point_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert( std::is_arithmetic<T>::value, "");
static_assert( std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert(!std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_floating_point()
{
test_floating_point_imp<T>();
test_floating_point_imp<const T>();
test_floating_point_imp<volatile T>
();
test_floating_point_imp<const volatile T>();
}
int main()
{
test_floating_point<float>();
test_floating_point<double>();
test_floating_point<long double>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// floating_point
+
+#include <type_traits>
+
+template <class T>
+void test_floating_point_imp()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert( std::is_arithmetic<T>::value, "");
+ static_assert( std::is_fundamental<T>::value, "");
+ static_assert( std::is_object<T>::value, "");
+ static_assert( std::is_scalar<T>::value, "");
+ static_assert(!std::is_compound<T>::value, "");
+ static_assert(!std::is_member_pointer<T>::value, "");
+}
+
+template <class T>
+void test_floating_point()
+{
+ test_floating_point_imp<T>();
+ test_floating_point_imp<const T>();
+ test_floating_point_imp<volatile T>();
+ test_floating_point_imp<const volatile T>();
+}
+
+int main()
+{
+ test_floating_point<float>();
+ test_floating_point<double>();
+ test_floating_point<long double>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,43 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// function
#include <type_traits>
template <class T>
void test_function_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert(!std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_function()
{
test_function_imp<T>();
test_function_imp<const T>();
test_function_imp<volatile T>();
test_function_imp<const vola
tile T>();
}
int main()
{
test_function<void ()>();
test_function<void (int)>();
test_function<int (double)>();
test_function<int (double, char)>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// function
+
+#include <type_traits>
+
+template <class T>
+void test_function_imp()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert(!std::is_fundamental<T>::value, "");
+ static_assert(!std::is_object<T>::value, "");
+ static_assert(!std::is_scalar<T>::value, "");
+ static_assert( std::is_compound<T>::value, "");
+ static_assert(!std::is_member_pointer<T>::value, "");
+}
+
+template <class T>
+void test_function()
+{
+ test_function_imp<T>();
+ test_function_imp<const T>();
+ test_function_imp<volatile T>();
+ test_function_imp<const volatile T>();
+}
+
+int main()
+{
+ test_function<void ()>();
+ test_function<void (int)>();
+ test_function<int (double)>();
+ test_function<int (double, char)>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,52 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// integral
#include <type_traits>
template <class T>
void test_integral_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert( std::is_arithmetic<T>::value, "");
static_assert( std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert(!std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_integral()
{
test_integral_imp<T>();
test_integral_imp<const T>();
test_integral_imp<volatile T>();
test_integral_imp<const vola
tile T>();
}
int main()
{
test_integral<bool>();
test_integral<char>();
test_integral<signed char>();
test_integral<unsigned char>();
test_integral<wchar_t>();
test_integral<short>();
test_integral<unsigned short>();
test_integral<int>();
test_integral<unsigned int>();
test_integral<long>();
test_integral<unsigned long>();
test_integral<long long>();
test_integral<unsigned long long>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// integral
+
+#include <type_traits>
+
+template <class T>
+void test_integral_imp()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert( std::is_arithmetic<T>::value, "");
+ static_assert( std::is_fundamental<T>::value, "");
+ static_assert( std::is_object<T>::value, "");
+ static_assert( std::is_scalar<T>::value, "");
+ static_assert(!std::is_compound<T>::value, "");
+ static_assert(!std::is_member_pointer<T>::value, "");
+}
+
+template <class T>
+void test_integral()
+{
+ test_integral_imp<T>();
+ test_integral_imp<const T>();
+ test_integral_imp<volatile T>();
+ test_integral_imp<const volatile T>();
+}
+
+int main()
+{
+ test_integral<bool>();
+ test_integral<char>();
+ test_integral<signed char>();
+ test_integral<unsigned char>();
+ test_integral<wchar_t>();
+ test_integral<short>();
+ test_integral<unsigned short>();
+ test_integral<int>();
+ test_integral<unsigned int>();
+ test_integral<long>();
+ test_integral<unsigned long>();
+ test_integral<long long>();
+ test_integral<unsigned long long>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,32 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// lvalue_ref
#include <type_traits>
template <class T>
void test_lvalue_ref()
{
static_assert( std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert(!std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
int main()
{
test_lvalue_ref<int&>();
test_lvalue_ref<const int&>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// lvalue_ref
+
+#include <type_traits>
+
+template <class T>
+void test_lvalue_ref()
+{
+ static_assert( std::is_reference<T>::value, "");
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert(!std::is_fundamental<T>::value, "");
+ static_assert(!std::is_object<T>::value, "");
+ static_assert(!std::is_scalar<T>::value, "");
+ static_assert( std::is_compound<T>::value, "");
+ static_assert(!std::is_member_pointer<T>::value, "");
+}
+
+int main()
+{
+ test_lvalue_ref<int&>();
+ test_lvalue_ref<const int&>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// member_function_pointer
#include <type_traits>
template <class T>
void test_member_function_pointer_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert( std::is_member_pointer<T>::value, "");
}
template <class T>
void test_member_function_pointer()
{
test_member_function_pointer_imp<T>();
test_member_function_pointer_imp<const
T>();
test_member_function_pointer_imp<volatile T>();
test_member_function_pointer_imp<const volatile T>();
}
class Class
{
};
int main()
{
test_member_function_pointer<void (Class::*)()>();
test_member_function_pointer<void (Class::*)(int)>();
test_member_function_pointer<void (Class::*)(int, char)>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// member_function_pointer
+
+#include <type_traits>
+
+template <class T>
+void test_member_function_pointer_imp()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert(!std::is_fundamental<T>::value, "");
+ static_assert( std::is_object<T>::value, "");
+ static_assert( std::is_scalar<T>::value, "");
+ static_assert( std::is_compound<T>::value, "");
+ static_assert( std::is_member_pointer<T>::value, "");
+}
+
+template <class T>
+void test_member_function_pointer()
+{
+ test_member_function_pointer_imp<T>();
+ test_member_function_pointer_imp<const T>();
+ test_member_function_pointer_imp<volatile T>();
+ test_member_function_pointer_imp<const volatile T>();
+}
+
+class Class
+{
+};
+
+int main()
+{
+ test_member_function_pointer<void (Class::*)()>();
+ test_member_function_pointer<void (Class::*)(int)>();
+ test_member_function_pointer<void (Class::*)(int, char)>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,44 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// member_object_pointer
#include <type_traits>
template <class T>
void test_member_object_pointer_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert( std::is_member_pointer<T>::value, "");
}
template <class T>
void test_member_object_pointer()
{
test_member_object_pointer_imp<T>();
test_member_object_pointer_imp<const T>();
test_member_object_pointer_imp<volatile T>();
test_member_object_pointer_imp<const volatile T>();
}
class Class
{
};
int main()
{
test_member_object_pointer<int Class::*>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// member_object_pointer
+
+#include <type_traits>
+
+template <class T>
+void test_member_object_pointer_imp()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert(!std::is_fundamental<T>::value, "");
+ static_assert( std::is_object<T>::value, "");
+ static_assert( std::is_scalar<T>::value, "");
+ static_assert( std::is_compound<T>::value, "");
+ static_assert( std::is_member_pointer<T>::value, "");
+}
+
+template <class T>
+void test_member_object_pointer()
+{
+ test_member_object_pointer_imp<T>();
+ test_member_object_pointer_imp<const T>();
+ test_member_object_pointer_imp<volatile T>();
+ test_member_object_pointer_imp<const volatile T>();
+}
+
+class Class
+{
+};
+
+int main()
+{
+ test_member_object_pointer<int Class::*>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,43 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// pointer
#include <type_traits>
template <class T>
void test_pointer_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_pointer()
{
test_pointer_imp<T>();
test_pointer_imp<const T>();
test_pointer_imp<volatile T>();
test_pointer_imp<const volatile T>
();
}
int main()
{
test_pointer<void*>();
test_pointer<int*>();
test_pointer<const int*>();
test_pointer<void (*)(int)>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// pointer
+
+#include <type_traits>
+
+template <class T>
+void test_pointer_imp()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert(!std::is_fundamental<T>::value, "");
+ static_assert( std::is_object<T>::value, "");
+ static_assert( std::is_scalar<T>::value, "");
+ static_assert( std::is_compound<T>::value, "");
+ static_assert(!std::is_member_pointer<T>::value, "");
+}
+
+template <class T>
+void test_pointer()
+{
+ test_pointer_imp<T>();
+ test_pointer_imp<const T>();
+ test_pointer_imp<volatile T>();
+ test_pointer_imp<const volatile T>();
+}
+
+int main()
+{
+ test_pointer<void*>();
+ test_pointer<int*>();
+ test_pointer<const int*>();
+ test_pointer<void (*)(int)>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,34 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// rvalue_ref
#include <type_traits>
template <class T>
void test_rvalue_ref()
{
static_assert(std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert(!std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
int main()
{
#ifdef _LIBCPP_MOVE
test_rvalue_ref<int&&>();
test_rvalue_ref<const int&&>();
#endif
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// rvalue_ref
+
+#include <type_traits>
+
+template <class T>
+void test_rvalue_ref()
+{
+ static_assert(std::is_reference<T>::value, "");
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert(!std::is_fundamental<T>::value, "");
+ static_assert(!std::is_object<T>::value, "");
+ static_assert(!std::is_scalar<T>::value, "");
+ static_assert( std::is_compound<T>::value, "");
+ static_assert(!std::is_member_pointer<T>::value, "");
+}
+
+int main()
+{
+#ifdef _LIBCPP_MOVE
+ test_rvalue_ref<int&&>();
+ test_rvalue_ref<const int&&>();
+#endif // _LIBCPP_MOVE
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// union
#include <type_traits>
template <class T>
void test_union_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_union()
{
test_union_imp<T>();
test_union_imp<const T>();
test_union_imp<volatile T>();
test_union_imp<const volatile T>();
}
union U
nion
{
int _;
double __;
};
int main()
{
test_union<Union>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// union
+
+#include <type_traits>
+
+template <class T>
+void test_union_imp()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert(!std::is_fundamental<T>::value, "");
+ static_assert( std::is_object<T>::value, "");
+ static_assert(!std::is_scalar<T>::value, "");
+ static_assert( std::is_compound<T>::value, "");
+ static_assert(!std::is_member_pointer<T>::value, "");
+}
+
+template <class T>
+void test_union()
+{
+ test_union_imp<T>();
+ test_union_imp<const T>();
+ test_union_imp<volatile T>();
+ test_union_imp<const volatile T>();
+}
+
+union Union
+{
+ int _;
+ double __;
+};
+
+int main()
+{
+ test_union<Union>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// void
#include <type_traits>
template <class T>
void test_void_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert( std::is_fundamental<T>::value, "");
static_assert(!std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert(!std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_void()
{
test_void_imp<T>();
test_void_imp<const T>();
test_void_imp<volatile T>();
test_void_imp<const volatile T>();
}
int main()
{
test_void<void>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// void
+
+#include <type_traits>
+
+template <class T>
+void test_void_imp()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert( std::is_fundamental<T>::value, "");
+ static_assert(!std::is_object<T>::value, "");
+ static_assert(!std::is_scalar<T>::value, "");
+ static_assert(!std::is_compound<T>::value, "");
+ static_assert(!std::is_member_pointer<T>::value, "");
+}
+
+template <class T>
+void test_void()
+{
+ test_void_imp<T>();
+ test_void_imp<const T>();
+ test_void_imp<volatile T>();
+ test_void_imp<const volatile T>();
+}
+
+int main()
+{
+ test_void<void>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/alignment_of.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/alignment_of.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/alignment_of.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/alignment_of.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// alignment_of
#include <type_traits>
template <class T, unsigned A>
void test_alignment_of()
{
static_assert( std::alignment_of<T>::value == A, "");
static_assert( std::alignment_of<const T>::value == A, "");
static_assert( std::alignment_of<volatile T>::value == A, "");
static_assert( std::alignment_of<const volatile T>::value == A, "");
}
class Class
{
public:
~Class();
};
int main()
{
test_alignment_of<int&, sizeof(long) == 4 ? 4 : 8>();
test_alignment_of<Class, 1>();
test_alignment_of<int*, sizeof(long) == 4 ? 4 : 8>();
test_alignment_of<const int*, sizeof(long) == 4 ? 4 : 8>();
test_alignment_of<char[3], 1>();
test_alignment_of<int, 4>();
test_alignment_of<double, sizeof(long) == 4 ? 4 : 8>();
test_alignment_of<bool, 1>();
test_alignment_of<unsigned, 4>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// alignment_of
+
+#include <type_traits>
+
+template <class T, unsigned A>
+void test_alignment_of()
+{
+ static_assert( std::alignment_of<T>::value == A, "");
+ static_assert( std::alignment_of<const T>::value == A, "");
+ static_assert( std::alignment_of<volatile T>::value == A, "");
+ static_assert( std::alignment_of<const volatile T>::value == A, "");
+}
+
+class Class
+{
+public:
+ ~Class();
+};
+
+int main()
+{
+ test_alignment_of<int&, sizeof(long) == 4 ? 4 : 8>();
+ test_alignment_of<Class, 1>();
+ test_alignment_of<int*, sizeof(long) == 4 ? 4 : 8>();
+ test_alignment_of<const int*, sizeof(long) == 4 ? 4 : 8>();
+ test_alignment_of<char[3], 1>();
+ test_alignment_of<int, 4>();
+ test_alignment_of<double, sizeof(long) == 4 ? 4 : 8>();
+ test_alignment_of<bool, 1>();
+ test_alignment_of<unsigned, 4>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/extent.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/extent.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/extent.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/extent.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,60 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// extent
#include <type_traits>
template <class T, unsigned A>
void test_extent()
{
static_assert((std::extent<T>::value == A), "");
static_assert((std::extent<const T>::value == A), "");
static_assert((std::extent<volatile T>::value == A), "");
static_assert((std::extent<const volatile T>::value == A), "");
}
template <class T, unsigned A>
void test_extent1()
{
static_assert((std::extent<T, 1>::value == A), "");
static_assert((std::extent<const T, 1>::value == A), "");
static_assert((std::extent<volatile T, 1>::value == A), "");
static_assert((std::extent<const volatile T, 1>::value == A
), "");
}
class Class
{
public:
~Class();
};
int main()
{
test_extent<void, 0>();
test_extent<int&, 0>();
test_extent<Class, 0>();
test_extent<int*, 0>();
test_extent<const int*, 0>();
test_extent<int, 0>();
test_extent<double, 0>();
test_extent<bool, 0>();
test_extent<unsigned, 0>();
test_extent<int[2], 2>();
test_extent<int[2][4], 2>();
test_extent<int[][4], 0>();
test_extent1<int, 0>();
test_extent1<int[2], 0>();
test_extent1<int[2][4], 4>();
test_extent1<int[][4], 4>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// extent
+
+#include <type_traits>
+
+template <class T, unsigned A>
+void test_extent()
+{
+ static_assert((std::extent<T>::value == A), "");
+ static_assert((std::extent<const T>::value == A), "");
+ static_assert((std::extent<volatile T>::value == A), "");
+ static_assert((std::extent<const volatile T>::value == A), "");
+}
+
+template <class T, unsigned A>
+void test_extent1()
+{
+ static_assert((std::extent<T, 1>::value == A), "");
+ static_assert((std::extent<const T, 1>::value == A), "");
+ static_assert((std::extent<volatile T, 1>::value == A), "");
+ static_assert((std::extent<const volatile T, 1>::value == A), "");
+}
+
+class Class
+{
+public:
+ ~Class();
+};
+
+int main()
+{
+ test_extent<void, 0>();
+ test_extent<int&, 0>();
+ test_extent<Class, 0>();
+ test_extent<int*, 0>();
+ test_extent<const int*, 0>();
+ test_extent<int, 0>();
+ test_extent<double, 0>();
+ test_extent<bool, 0>();
+ test_extent<unsigned, 0>();
+
+ test_extent<int[2], 2>();
+ test_extent<int[2][4], 2>();
+ test_extent<int[][4], 0>();
+
+ test_extent1<int, 0>();
+ test_extent1<int[2], 0>();
+ test_extent1<int[2][4], 4>();
+ test_extent1<int[][4], 4>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,77 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_nothrow_copy_assign
#include <type_traits>
template <class T>
void test_has_nothrow_assign()
{
static_assert( std::has_nothrow_copy_assign<T>::value, "");
static_assert(!std::has_nothrow_copy_assign<const T>::value, "");
static_assert( std::has_nothrow_copy_assign<volatile T>::value, "");
static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, "");
}
template <class T>
void test_has_not_nothrow_assign()
{
static_assert(!std::has_nothrow_copy_assign<T>::value, "");
static_assert(!std::has_nothrow_copy_assign<const T>::value, "");
static_assert(!std::has_nothrow_copy_assign<
volatile T>::value, "");
static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A& operator=(const A&);
};
int main()
{
test_has_not_nothrow_assign<void>();
test_has_not_nothrow_assign<A>();
test_has_not_nothrow_assign<int&>();
test_has_nothrow_assign<Union>();
test_has_nothrow_assign<Abstract>();
test_has_nothrow_assign<Empty>();
test_has_nothrow_assign<int>();
test_has_nothrow_assign<double>();
test_has_nothrow_assign<int*>();
test_has_nothrow_assign<const int*>();
test_has_nothrow_assign<char[3]>();
test_has_nothrow_assign<char[3]>();
test_has_nothrow_assign<NotEmpty>();
test_has_nothrow_assign<bit_zero>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// has_nothrow_copy_assign
+
+#include <type_traits>
+
+template <class T>
+void test_has_nothrow_assign()
+{
+ static_assert( std::has_nothrow_copy_assign<T>::value, "");
+ static_assert(!std::has_nothrow_copy_assign<const T>::value, "");
+ static_assert( std::has_nothrow_copy_assign<volatile T>::value, "");
+ static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, "");
+}
+
+template <class T>
+void test_has_not_nothrow_assign()
+{
+ static_assert(!std::has_nothrow_copy_assign<T>::value, "");
+ static_assert(!std::has_nothrow_copy_assign<const T>::value, "");
+ static_assert(!std::has_nothrow_copy_assign<volatile T>::value, "");
+ static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, "");
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+struct A
+{
+ A& operator=(const A&);
+};
+
+int main()
+{
+ test_has_not_nothrow_assign<void>();
+ test_has_not_nothrow_assign<A>();
+ test_has_not_nothrow_assign<int&>();
+
+ test_has_nothrow_assign<Union>();
+ test_has_nothrow_assign<Abstract>();
+ test_has_nothrow_assign<Empty>();
+ test_has_nothrow_assign<int>();
+ test_has_nothrow_assign<double>();
+ test_has_nothrow_assign<int*>();
+ test_has_nothrow_assign<const int*>();
+ test_has_nothrow_assign<char[3]>();
+ test_has_nothrow_assign<char[3]>();
+ test_has_nothrow_assign<NotEmpty>();
+ test_has_nothrow_assign<bit_zero>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,77 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_nothrow_copy_constructor
#include <type_traits>
template <class T>
void test_has_nothrow_copy_constructor()
{
static_assert( std::has_nothrow_copy_constructor<T>::value, "");
static_assert( std::has_nothrow_copy_constructor<const T>::value, "");
static_assert( std::has_nothrow_copy_constructor<volatile T>::value, "");
static_assert( std::has_nothrow_copy_constructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_nothrow_copy_constructor()
{
static_assert(!std::has_nothrow_copy_constructor<T>::value, "");
static_assert(!std::has_nothrow_copy_constructor<const T>::value
, "");
static_assert(!std::has_nothrow_copy_constructor<volatile T>::value, "");
static_assert(!std::has_nothrow_copy_constructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A(const A&);
};
int main()
{
test_has_not_nothrow_copy_constructor<void>();
test_has_not_nothrow_copy_constructor<A>();
test_has_not_nothrow_copy_constructor<int&>();
test_has_nothrow_copy_constructor<Union>();
test_has_nothrow_copy_constructor<Abstract>();
test_has_nothrow_copy_constructor<Empty>();
test_has_nothrow_copy_constructor<int>();
test_has_nothrow_copy_constructor<double>();
test_has_nothrow_copy_constructor<int*>();
test_has_nothrow_copy_constructor<const int*>();
test_has_nothrow_copy_constructor<char[3]>();
test_has_nothrow_copy_constructor<char[3]>();
test_has
_nothrow_copy_constructor<NotEmpty>();
test_has_nothrow_copy_constructor<bit_zero>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// has_nothrow_copy_constructor
+
+#include <type_traits>
+
+template <class T>
+void test_has_nothrow_copy_constructor()
+{
+ static_assert( std::has_nothrow_copy_constructor<T>::value, "");
+ static_assert( std::has_nothrow_copy_constructor<const T>::value, "");
+ static_assert( std::has_nothrow_copy_constructor<volatile T>::value, "");
+ static_assert( std::has_nothrow_copy_constructor<const volatile T>::value, "");
+}
+
+template <class T>
+void test_has_not_nothrow_copy_constructor()
+{
+ static_assert(!std::has_nothrow_copy_constructor<T>::value, "");
+ static_assert(!std::has_nothrow_copy_constructor<const T>::value, "");
+ static_assert(!std::has_nothrow_copy_constructor<volatile T>::value, "");
+ static_assert(!std::has_nothrow_copy_constructor<const volatile T>::value, "");
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+struct A
+{
+ A(const A&);
+};
+
+int main()
+{
+ test_has_not_nothrow_copy_constructor<void>();
+ test_has_not_nothrow_copy_constructor<A>();
+ test_has_not_nothrow_copy_constructor<int&>();
+
+ test_has_nothrow_copy_constructor<Union>();
+ test_has_nothrow_copy_constructor<Abstract>();
+ test_has_nothrow_copy_constructor<Empty>();
+ test_has_nothrow_copy_constructor<int>();
+ test_has_nothrow_copy_constructor<double>();
+ test_has_nothrow_copy_constructor<int*>();
+ test_has_nothrow_copy_constructor<const int*>();
+ test_has_nothrow_copy_constructor<char[3]>();
+ test_has_nothrow_copy_constructor<char[3]>();
+ test_has_nothrow_copy_constructor<NotEmpty>();
+ test_has_nothrow_copy_constructor<bit_zero>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,77 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_nothrow_default_constructor
#include <type_traits>
template <class T>
void test_has_nothrow_default_constructor()
{
static_assert( std::has_nothrow_default_constructor<T>::value, "");
static_assert( std::has_nothrow_default_constructor<const T>::value, "");
static_assert( std::has_nothrow_default_constructor<volatile T>::value, "");
static_assert( std::has_nothrow_default_constructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_nothrow_default_constructor()
{
static_assert(!std::has_nothrow_default_constructor<T>::value, "");
static_assert(!std::has_nothrow_default_
constructor<const T>::value, "");
static_assert(!std::has_nothrow_default_constructor<volatile T>::value, "");
static_assert(!std::has_nothrow_default_constructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A();
};
int main()
{
test_has_not_nothrow_default_constructor<void>();
test_has_not_nothrow_default_constructor<int&>();
test_has_not_nothrow_default_constructor<A>();
test_has_nothrow_default_constructor<Union>();
test_has_nothrow_default_constructor<Abstract>();
test_has_nothrow_default_constructor<Empty>();
test_has_nothrow_default_constructor<int>();
test_has_nothrow_default_constructor<double>();
test_has_nothrow_default_constructor<int*>();
test_has_nothrow_default_constructor<const int*>();
test_has_nothrow_default_constructor<char[3]>();
test_has_nothrow_default_constructor<char[3]>();
test_has_nothrow_default_constructor<NotEmpty>();
test_has_nothrow_default_constructor<bit_zero>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// has_nothrow_default_constructor
+
+#include <type_traits>
+
+template <class T>
+void test_has_nothrow_default_constructor()
+{
+ static_assert( std::has_nothrow_default_constructor<T>::value, "");
+ static_assert( std::has_nothrow_default_constructor<const T>::value, "");
+ static_assert( std::has_nothrow_default_constructor<volatile T>::value, "");
+ static_assert( std::has_nothrow_default_constructor<const volatile T>::value, "");
+}
+
+template <class T>
+void test_has_not_nothrow_default_constructor()
+{
+ static_assert(!std::has_nothrow_default_constructor<T>::value, "");
+ static_assert(!std::has_nothrow_default_constructor<const T>::value, "");
+ static_assert(!std::has_nothrow_default_constructor<volatile T>::value, "");
+ static_assert(!std::has_nothrow_default_constructor<const volatile T>::value, "");
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+struct A
+{
+ A();
+};
+
+int main()
+{
+ test_has_not_nothrow_default_constructor<void>();
+ test_has_not_nothrow_default_constructor<int&>();
+ test_has_not_nothrow_default_constructor<A>();
+
+ test_has_nothrow_default_constructor<Union>();
+ test_has_nothrow_default_constructor<Abstract>();
+ test_has_nothrow_default_constructor<Empty>();
+ test_has_nothrow_default_constructor<int>();
+ test_has_nothrow_default_constructor<double>();
+ test_has_nothrow_default_constructor<int*>();
+ test_has_nothrow_default_constructor<const int*>();
+ test_has_nothrow_default_constructor<char[3]>();
+ test_has_nothrow_default_constructor<char[3]>();
+ test_has_nothrow_default_constructor<NotEmpty>();
+ test_has_nothrow_default_constructor<bit_zero>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,77 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_trivial_copy_assign
#include <type_traits>
template <class T>
void test_has_trivial_assign()
{
static_assert( std::has_trivial_copy_assign<T>::value, "");
static_assert(!std::has_trivial_copy_assign<const T>::value, "");
static_assert( std::has_trivial_copy_assign<volatile T>::value, "");
static_assert(!std::has_trivial_copy_assign<const volatile T>::value, "");
}
template <class T>
void test_has_not_trivial_assign()
{
static_assert(!std::has_trivial_copy_assign<T>::value, "");
static_assert(!std::has_trivial_copy_assign<const T>::value, "");
static_assert(!std::has_trivial_copy_assign<
volatile T>::value, "");
static_assert(!std::has_trivial_copy_assign<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A& operator=(const A&);
};
int main()
{
test_has_not_trivial_assign<void>();
test_has_not_trivial_assign<A>();
test_has_not_trivial_assign<int&>();
test_has_trivial_assign<Union>();
test_has_trivial_assign<Abstract>();
test_has_trivial_assign<Empty>();
test_has_trivial_assign<int>();
test_has_trivial_assign<double>();
test_has_trivial_assign<int*>();
test_has_trivial_assign<const int*>();
test_has_trivial_assign<char[3]>();
test_has_trivial_assign<char[3]>();
test_has_trivial_assign<NotEmpty>();
test_has_trivial_assign<bit_zero>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// has_trivial_copy_assign
+
+#include <type_traits>
+
+template <class T>
+void test_has_trivial_assign()
+{
+ static_assert( std::has_trivial_copy_assign<T>::value, "");
+ static_assert(!std::has_trivial_copy_assign<const T>::value, "");
+ static_assert( std::has_trivial_copy_assign<volatile T>::value, "");
+ static_assert(!std::has_trivial_copy_assign<const volatile T>::value, "");
+}
+
+template <class T>
+void test_has_not_trivial_assign()
+{
+ static_assert(!std::has_trivial_copy_assign<T>::value, "");
+ static_assert(!std::has_trivial_copy_assign<const T>::value, "");
+ static_assert(!std::has_trivial_copy_assign<volatile T>::value, "");
+ static_assert(!std::has_trivial_copy_assign<const volatile T>::value, "");
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+struct A
+{
+ A& operator=(const A&);
+};
+
+int main()
+{
+ test_has_not_trivial_assign<void>();
+ test_has_not_trivial_assign<A>();
+ test_has_not_trivial_assign<int&>();
+
+ test_has_trivial_assign<Union>();
+ test_has_trivial_assign<Abstract>();
+ test_has_trivial_assign<Empty>();
+ test_has_trivial_assign<int>();
+ test_has_trivial_assign<double>();
+ test_has_trivial_assign<int*>();
+ test_has_trivial_assign<const int*>();
+ test_has_trivial_assign<char[3]>();
+ test_has_trivial_assign<char[3]>();
+ test_has_trivial_assign<NotEmpty>();
+ test_has_trivial_assign<bit_zero>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,77 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_trivial_copy_constructor
#include <type_traits>
template <class T>
void test_has_trivial_copy_constructor()
{
static_assert( std::has_trivial_copy_constructor<T>::value, "");
static_assert( std::has_trivial_copy_constructor<const T>::value, "");
static_assert( std::has_trivial_copy_constructor<volatile T>::value, "");
static_assert( std::has_trivial_copy_constructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_trivial_copy_constructor()
{
static_assert(!std::has_trivial_copy_constructor<T>::value, "");
static_assert(!std::has_trivial_copy_constructor<const T>::value
, "");
static_assert(!std::has_trivial_copy_constructor<volatile T>::value, "");
static_assert(!std::has_trivial_copy_constructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A(const A&);
};
int main()
{
test_has_not_trivial_copy_constructor<void>();
test_has_not_trivial_copy_constructor<A>();
test_has_not_trivial_copy_constructor<int&>();
test_has_trivial_copy_constructor<Union>();
test_has_trivial_copy_constructor<Abstract>();
test_has_trivial_copy_constructor<Empty>();
test_has_trivial_copy_constructor<int>();
test_has_trivial_copy_constructor<double>();
test_has_trivial_copy_constructor<int*>();
test_has_trivial_copy_constructor<const int*>();
test_has_trivial_copy_constructor<char[3]>();
test_has_trivial_copy_constructor<char[3]>();
test_has
_trivial_copy_constructor<NotEmpty>();
test_has_trivial_copy_constructor<bit_zero>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// has_trivial_copy_constructor
+
+#include <type_traits>
+
+template <class T>
+void test_has_trivial_copy_constructor()
+{
+ static_assert( std::has_trivial_copy_constructor<T>::value, "");
+ static_assert( std::has_trivial_copy_constructor<const T>::value, "");
+ static_assert( std::has_trivial_copy_constructor<volatile T>::value, "");
+ static_assert( std::has_trivial_copy_constructor<const volatile T>::value, "");
+}
+
+template <class T>
+void test_has_not_trivial_copy_constructor()
+{
+ static_assert(!std::has_trivial_copy_constructor<T>::value, "");
+ static_assert(!std::has_trivial_copy_constructor<const T>::value, "");
+ static_assert(!std::has_trivial_copy_constructor<volatile T>::value, "");
+ static_assert(!std::has_trivial_copy_constructor<const volatile T>::value, "");
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+struct A
+{
+ A(const A&);
+};
+
+int main()
+{
+ test_has_not_trivial_copy_constructor<void>();
+ test_has_not_trivial_copy_constructor<A>();
+ test_has_not_trivial_copy_constructor<int&>();
+
+ test_has_trivial_copy_constructor<Union>();
+ test_has_trivial_copy_constructor<Abstract>();
+ test_has_trivial_copy_constructor<Empty>();
+ test_has_trivial_copy_constructor<int>();
+ test_has_trivial_copy_constructor<double>();
+ test_has_trivial_copy_constructor<int*>();
+ test_has_trivial_copy_constructor<const int*>();
+ test_has_trivial_copy_constructor<char[3]>();
+ test_has_trivial_copy_constructor<char[3]>();
+ test_has_trivial_copy_constructor<NotEmpty>();
+ test_has_trivial_copy_constructor<bit_zero>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,77 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_trivial_default_constructor
#include <type_traits>
template <class T>
void test_has_trivial_default_constructor()
{
static_assert( std::has_trivial_default_constructor<T>::value, "");
static_assert( std::has_trivial_default_constructor<const T>::value, "");
static_assert( std::has_trivial_default_constructor<volatile T>::value, "");
static_assert( std::has_trivial_default_constructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_trivial_default_constructor()
{
static_assert(!std::has_trivial_default_constructor<T>::value, "");
static_assert(!std::has_trivial_default_
constructor<const T>::value, "");
static_assert(!std::has_trivial_default_constructor<volatile T>::value, "");
static_assert(!std::has_trivial_default_constructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A();
};
int main()
{
test_has_not_trivial_default_constructor<void>();
test_has_not_trivial_default_constructor<int&>();
test_has_not_trivial_default_constructor<A>();
test_has_trivial_default_constructor<Union>();
test_has_trivial_default_constructor<Abstract>();
test_has_trivial_default_constructor<Empty>();
test_has_trivial_default_constructor<int>();
test_has_trivial_default_constructor<double>();
test_has_trivial_default_constructor<int*>();
test_has_trivial_default_constructor<const int*>();
test_has_trivial_default_constructor<char[3]>();
test_has_trivial_default_constructor<char[3]>();
test_has_trivial_default_constructor<NotEmpty>();
test_has_trivial_default_constructor<bit_zero>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// has_trivial_default_constructor
+
+#include <type_traits>
+
+template <class T>
+void test_has_trivial_default_constructor()
+{
+ static_assert( std::has_trivial_default_constructor<T>::value, "");
+ static_assert( std::has_trivial_default_constructor<const T>::value, "");
+ static_assert( std::has_trivial_default_constructor<volatile T>::value, "");
+ static_assert( std::has_trivial_default_constructor<const volatile T>::value, "");
+}
+
+template <class T>
+void test_has_not_trivial_default_constructor()
+{
+ static_assert(!std::has_trivial_default_constructor<T>::value, "");
+ static_assert(!std::has_trivial_default_constructor<const T>::value, "");
+ static_assert(!std::has_trivial_default_constructor<volatile T>::value, "");
+ static_assert(!std::has_trivial_default_constructor<const volatile T>::value, "");
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+struct A
+{
+ A();
+};
+
+int main()
+{
+ test_has_not_trivial_default_constructor<void>();
+ test_has_not_trivial_default_constructor<int&>();
+ test_has_not_trivial_default_constructor<A>();
+
+ test_has_trivial_default_constructor<Union>();
+ test_has_trivial_default_constructor<Abstract>();
+ test_has_trivial_default_constructor<Empty>();
+ test_has_trivial_default_constructor<int>();
+ test_has_trivial_default_constructor<double>();
+ test_has_trivial_default_constructor<int*>();
+ test_has_trivial_default_constructor<const int*>();
+ test_has_trivial_default_constructor<char[3]>();
+ test_has_trivial_default_constructor<char[3]>();
+ test_has_trivial_default_constructor<NotEmpty>();
+ test_has_trivial_default_constructor<bit_zero>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,77 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_trivial_destructor
#include <type_traits>
template <class T>
void test_has_trivial_destructor()
{
static_assert( std::has_trivial_destructor<T>::value, "");
static_assert( std::has_trivial_destructor<const T>::value, "");
static_assert( std::has_trivial_destructor<volatile T>::value, "");
static_assert( std::has_trivial_destructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_trivial_destructor()
{
static_assert(!std::has_trivial_destructor<T>::value, "");
static_assert(!std::has_trivial_destructor<const T>::value, "");
static_assert(!std::has_trivial_destructor<
volatile T>::value, "");
static_assert(!std::has_trivial_destructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
~A();
};
int main()
{
test_has_not_trivial_destructor<void>();
test_has_not_trivial_destructor<A>();
test_has_not_trivial_destructor<Abstract>();
test_has_not_trivial_destructor<NotEmpty>();
test_has_trivial_destructor<int&>();
test_has_trivial_destructor<Union>();
test_has_trivial_destructor<Empty>();
test_has_trivial_destructor<int>();
test_has_trivial_destructor<double>();
test_has_trivial_destructor<int*>();
test_has_trivial_destructor<const int*>();
test_has_trivial_destructor<char[3]>();
test_has_trivial_destructor<char[3]>();
test_has_trivial_destructor<bit_zero>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// has_trivial_destructor
+
+#include <type_traits>
+
+template <class T>
+void test_has_trivial_destructor()
+{
+ static_assert( std::has_trivial_destructor<T>::value, "");
+ static_assert( std::has_trivial_destructor<const T>::value, "");
+ static_assert( std::has_trivial_destructor<volatile T>::value, "");
+ static_assert( std::has_trivial_destructor<const volatile T>::value, "");
+}
+
+template <class T>
+void test_has_not_trivial_destructor()
+{
+ static_assert(!std::has_trivial_destructor<T>::value, "");
+ static_assert(!std::has_trivial_destructor<const T>::value, "");
+ static_assert(!std::has_trivial_destructor<volatile T>::value, "");
+ static_assert(!std::has_trivial_destructor<const volatile T>::value, "");
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+struct A
+{
+ ~A();
+};
+
+int main()
+{
+ test_has_not_trivial_destructor<void>();
+ test_has_not_trivial_destructor<A>();
+ test_has_not_trivial_destructor<Abstract>();
+ test_has_not_trivial_destructor<NotEmpty>();
+
+ test_has_trivial_destructor<int&>();
+ test_has_trivial_destructor<Union>();
+ test_has_trivial_destructor<Empty>();
+ test_has_trivial_destructor<int>();
+ test_has_trivial_destructor<double>();
+ test_has_trivial_destructor<int*>();
+ test_has_trivial_destructor<const int*>();
+ test_has_trivial_destructor<char[3]>();
+ test_has_trivial_destructor<char[3]>();
+ test_has_trivial_destructor<bit_zero>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,77 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_virtual_destructor
#include <type_traits>
template <class T>
void test_has_virtual_destructor()
{
static_assert( std::has_virtual_destructor<T>::value, "");
static_assert( std::has_virtual_destructor<const T>::value, "");
static_assert( std::has_virtual_destructor<volatile T>::value, "");
static_assert( std::has_virtual_destructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_virtual_destructor()
{
static_assert(!std::has_virtual_destructor<T>::value, "");
static_assert(!std::has_virtual_destructor<const T>::value, "");
static_assert(!std::has_virtual_destructor<
volatile T>::value, "");
static_assert(!std::has_virtual_destructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
~A();
};
int main()
{
test_has_not_virtual_destructor<void>();
test_has_not_virtual_destructor<A>();
test_has_not_virtual_destructor<int&>();
test_has_not_virtual_destructor<Union>();
test_has_not_virtual_destructor<Empty>();
test_has_not_virtual_destructor<int>();
test_has_not_virtual_destructor<double>();
test_has_not_virtual_destructor<int*>();
test_has_not_virtual_destructor<const int*>();
test_has_not_virtual_destructor<char[3]>();
test_has_not_virtual_destructor<char[3]>();
test_has_not_virtual_destructor<bit_zero>();
test_has_virtual_destructor<Abstract>();
test_has_virtual_destructor<NotEmpty>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// has_virtual_destructor
+
+#include <type_traits>
+
+template <class T>
+void test_has_virtual_destructor()
+{
+ static_assert( std::has_virtual_destructor<T>::value, "");
+ static_assert( std::has_virtual_destructor<const T>::value, "");
+ static_assert( std::has_virtual_destructor<volatile T>::value, "");
+ static_assert( std::has_virtual_destructor<const volatile T>::value, "");
+}
+
+template <class T>
+void test_has_not_virtual_destructor()
+{
+ static_assert(!std::has_virtual_destructor<T>::value, "");
+ static_assert(!std::has_virtual_destructor<const T>::value, "");
+ static_assert(!std::has_virtual_destructor<volatile T>::value, "");
+ static_assert(!std::has_virtual_destructor<const volatile T>::value, "");
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+struct A
+{
+ ~A();
+};
+
+int main()
+{
+ test_has_not_virtual_destructor<void>();
+ test_has_not_virtual_destructor<A>();
+ test_has_not_virtual_destructor<int&>();
+ test_has_not_virtual_destructor<Union>();
+ test_has_not_virtual_destructor<Empty>();
+ test_has_not_virtual_destructor<int>();
+ test_has_not_virtual_destructor<double>();
+ test_has_not_virtual_destructor<int*>();
+ test_has_not_virtual_destructor<const int*>();
+ test_has_not_virtual_destructor<char[3]>();
+ test_has_not_virtual_destructor<char[3]>();
+ test_has_not_virtual_destructor<bit_zero>();
+
+ test_has_virtual_destructor<Abstract>();
+ test_has_virtual_destructor<NotEmpty>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,71 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_abstract
#include <type_traits>
template <class T>
void test_is_abstract()
{
static_assert( std::is_abstract<T>::value, "");
static_assert( std::is_abstract<const T>::value, "");
static_assert( std::is_abstract<volatile T>::value, "");
static_assert( std::is_abstract<const volatile T>::value, "");
}
template <class T>
void test_is_not_abstract()
{
static_assert(!std::is_abstract<T>::value, "");
static_assert(!std::is_abstract<const T>::value, "");
static_assert(!std::is_abstract<volatile T>::value, "");
static_assert(!std::is_abstract<const volatile T>::value, "");
}
class Empty
{
}
;
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
int main()
{
test_is_not_abstract<void>();
test_is_not_abstract<int&>();
test_is_not_abstract<int>();
test_is_not_abstract<double>();
test_is_not_abstract<int*>();
test_is_not_abstract<const int*>();
test_is_not_abstract<char[3]>();
test_is_not_abstract<char[3]>();
test_is_not_abstract<Union>();
test_is_not_abstract<Empty>();
test_is_not_abstract<bit_zero>();
test_is_not_abstract<NotEmpty>();
test_is_abstract<Abstract>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_abstract
+
+#include <type_traits>
+
+template <class T>
+void test_is_abstract()
+{
+ static_assert( std::is_abstract<T>::value, "");
+ static_assert( std::is_abstract<const T>::value, "");
+ static_assert( std::is_abstract<volatile T>::value, "");
+ static_assert( std::is_abstract<const volatile T>::value, "");
+}
+
+template <class T>
+void test_is_not_abstract()
+{
+ static_assert(!std::is_abstract<T>::value, "");
+ static_assert(!std::is_abstract<const T>::value, "");
+ static_assert(!std::is_abstract<volatile T>::value, "");
+ static_assert(!std::is_abstract<const volatile T>::value, "");
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+int main()
+{
+ test_is_not_abstract<void>();
+ test_is_not_abstract<int&>();
+ test_is_not_abstract<int>();
+ test_is_not_abstract<double>();
+ test_is_not_abstract<int*>();
+ test_is_not_abstract<const int*>();
+ test_is_not_abstract<char[3]>();
+ test_is_not_abstract<char[3]>();
+ test_is_not_abstract<Union>();
+ test_is_not_abstract<Empty>();
+ test_is_not_abstract<bit_zero>();
+ test_is_not_abstract<NotEmpty>();
+
+ test_is_abstract<Abstract>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,37 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_const
#include <type_traits>
template <class T>
void test_is_const()
{
static_assert(!std::is_const<T>::value, "");
static_assert( std::is_const<const T>::value, "");
static_assert(!std::is_const<volatile T>::value, "");
static_assert( std::is_const<const volatile T>::value, "");
}
int main()
{
test_is_const<void>();
test_is_const<int>();
test_is_const<double>();
test_is_const<int*>();
test_is_const<const int*>();
test_is_const<char[3]>();
test_is_const<char[3]>();
static_assert(!std::is_const<int&>::value, "");
static_assert(!std::is_const<const int&>::value, ""
);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_const
+
+#include <type_traits>
+
+template <class T>
+void test_is_const()
+{
+ static_assert(!std::is_const<T>::value, "");
+ static_assert( std::is_const<const T>::value, "");
+ static_assert(!std::is_const<volatile T>::value, "");
+ static_assert( std::is_const<const volatile T>::value, "");
+}
+
+int main()
+{
+ test_is_const<void>();
+ test_is_const<int>();
+ test_is_const<double>();
+ test_is_const<int*>();
+ test_is_const<const int*>();
+ test_is_const<char[3]>();
+ test_is_const<char[3]>();
+
+ static_assert(!std::is_const<int&>::value, "");
+ static_assert(!std::is_const<const int&>::value, "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,38 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// template <class T, class... Args>
// struct is_constructible;
#include <type_traits>
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
struct A
{
explicit A(int);
A(int, double);
};
#endif
int main()
{
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
static_assert((std::is_constructible<int>::value), "");
static_assert((std::is_constructible<int, const int>::value), "");
static_assert((std::is_constructible<A, int>::value), "");
static_assert((std::is_constructible<A, int, double>::value), "");
static_assert((!std::is_constructible<A>::value), "");
#endif
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// template <class T, class... Args>
+// struct is_constructible;
+
+#include <type_traits>
+
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+
+struct A
+{
+ explicit A(int);
+ A(int, double);
+};
+
+#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+
+ static_assert((std::is_constructible<int>::value), "");
+ static_assert((std::is_constructible<int, const int>::value), "");
+ static_assert((std::is_constructible<A, int>::value), "");
+ static_assert((std::is_constructible<A, int, double>::value), "");
+ static_assert((!std::is_constructible<A>::value), "");
+
+#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,65 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_empty
#include <type_traits>
template <class T>
void test_is_empty()
{
static_assert( std::is_empty<T>::value, "");
static_assert( std::is_empty<const T>::value, "");
static_assert( std::is_empty<volatile T>::value, "");
static_assert( std::is_empty<const volatile T>::value, "");
}
template <class T>
void test_is_not_empty()
{
static_assert(!std::is_empty<T>::value, "");
static_assert(!std::is_empty<const T>::value, "");
static_assert(!std::is_empty<volatile T>::value, "");
static_assert(!std::is_empty<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~
NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
int main()
{
test_is_not_empty<void>();
test_is_not_empty<int&>();
test_is_not_empty<int>();
test_is_not_empty<double>();
test_is_not_empty<int*>();
test_is_not_empty<const int*>();
test_is_not_empty<char[3]>();
test_is_not_empty<char[3]>();
test_is_not_empty<Union>();
test_is_not_empty<NotEmpty>();
test_is_empty<Empty>();
test_is_empty<bit_zero>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_empty
+
+#include <type_traits>
+
+template <class T>
+void test_is_empty()
+{
+ static_assert( std::is_empty<T>::value, "");
+ static_assert( std::is_empty<const T>::value, "");
+ static_assert( std::is_empty<volatile T>::value, "");
+ static_assert( std::is_empty<const volatile T>::value, "");
+}
+
+template <class T>
+void test_is_not_empty()
+{
+ static_assert(!std::is_empty<T>::value, "");
+ static_assert(!std::is_empty<const T>::value, "");
+ static_assert(!std::is_empty<volatile T>::value, "");
+ static_assert(!std::is_empty<const volatile T>::value, "");
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+int main()
+{
+ test_is_not_empty<void>();
+ test_is_not_empty<int&>();
+ test_is_not_empty<int>();
+ test_is_not_empty<double>();
+ test_is_not_empty<int*>();
+ test_is_not_empty<const int*>();
+ test_is_not_empty<char[3]>();
+ test_is_not_empty<char[3]>();
+ test_is_not_empty<Union>();
+ test_is_not_empty<NotEmpty>();
+
+ test_is_empty<Empty>();
+ test_is_empty<bit_zero>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,22 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_literal_type
#include <type_traits>
int main()
{
static_assert( std::is_literal_type<int>::value, "");
static_assert( std::is_literal_type<const int>::value, "");
static_assert(!std::is_literal_type<int&>::value, "");
static_assert(!std::is_literal_type<volatile int&>::value, "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_literal_type
+
+#include <type_traits>
+
+int main()
+{
+ static_assert( std::is_literal_type<int>::value, "");
+ static_assert( std::is_literal_type<const int>::value, "");
+ static_assert(!std::is_literal_type<int&>::value, "");
+ static_assert(!std::is_literal_type<volatile int&>::value, "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,52 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// template <class T, class... Args>
// struct is_nothrow_constructible;
#include <type_traits>
#ifndef _LIBCPP_HAS_NO_VARIADICS
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A(const A&);
};
#endif
int main()
{
#ifndef _LIBCPP_HAS_NO_VARIADICS
static_assert((std::is_nothrow_constructible<int, const int>::value), "");
#endif
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// template <class T, class... Args>
+// struct is_nothrow_constructible;
+
+#include <type_traits>
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+struct A
+{
+ A(const A&);
+};
+
+#endif // _LIBCPP_HAS_NO_VARIADICS
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+ static_assert((std::is_nothrow_constructible<int, const int>::value), "");
+#endif
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,52 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_pod
#include <type_traits>
template <class T>
void test_is_pod()
{
static_assert( std::is_pod<T>::value, "");
static_assert( std::is_pod<const T>::value, "");
static_assert( std::is_pod<volatile T>::value, "");
static_assert( std::is_pod<const volatile T>::value, "");
}
template <class T>
void test_is_not_pod()
{
static_assert(!std::is_pod<T>::value, "");
static_assert(!std::is_pod<const T>::value, "");
static_assert(!std::is_pod<volatile T>::value, "");
static_assert(!std::is_pod<const volatile T>::value, "");
}
class Class
{
public:
~Class();
};
int main()
{
test_is_not_p
od<void>();
test_is_not_pod<int&>();
test_is_not_pod<Class>();
test_is_pod<int>();
test_is_pod<double>();
test_is_pod<int*>();
test_is_pod<const int*>();
test_is_pod<char[3]>();
test_is_pod<char[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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_pod
+
+#include <type_traits>
+
+template <class T>
+void test_is_pod()
+{
+ static_assert( std::is_pod<T>::value, "");
+ static_assert( std::is_pod<const T>::value, "");
+ static_assert( std::is_pod<volatile T>::value, "");
+ static_assert( std::is_pod<const volatile T>::value, "");
+}
+
+template <class T>
+void test_is_not_pod()
+{
+ static_assert(!std::is_pod<T>::value, "");
+ static_assert(!std::is_pod<const T>::value, "");
+ static_assert(!std::is_pod<volatile T>::value, "");
+ static_assert(!std::is_pod<const volatile T>::value, "");
+}
+
+class Class
+{
+public:
+ ~Class();
+};
+
+int main()
+{
+ test_is_not_pod<void>();
+ test_is_not_pod<int&>();
+ test_is_not_pod<Class>();
+
+ test_is_pod<int>();
+ test_is_pod<double>();
+ test_is_pod<int*>();
+ test_is_pod<const int*>();
+ test_is_pod<char[3]>();
+ test_is_pod<char[3]>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,71 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_polymorphic
#include <type_traits>
template <class T>
void test_is_polymorphic()
{
static_assert( std::is_polymorphic<T>::value, "");
static_assert( std::is_polymorphic<const T>::value, "");
static_assert( std::is_polymorphic<volatile T>::value, "");
static_assert( std::is_polymorphic<const volatile T>::value, "");
}
template <class T>
void test_is_not_polymorphic()
{
static_assert(!std::is_polymorphic<T>::value, "");
static_assert(!std::is_polymorphic<const T>::value, "");
static_assert(!std::is_polymorphic<volatile T>::value, "");
static_assert(!std::is_polymorphic<const volatile T
>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
int main()
{
test_is_not_polymorphic<void>();
test_is_not_polymorphic<int&>();
test_is_not_polymorphic<int>();
test_is_not_polymorphic<double>();
test_is_not_polymorphic<int*>();
test_is_not_polymorphic<const int*>();
test_is_not_polymorphic<char[3]>();
test_is_not_polymorphic<char[3]>();
test_is_not_polymorphic<Union>();
test_is_not_polymorphic<Empty>();
test_is_not_polymorphic<bit_zero>();
test_is_polymorphic<NotEmpty>();
test_is_polymorphic<Abstract>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_polymorphic
+
+#include <type_traits>
+
+template <class T>
+void test_is_polymorphic()
+{
+ static_assert( std::is_polymorphic<T>::value, "");
+ static_assert( std::is_polymorphic<const T>::value, "");
+ static_assert( std::is_polymorphic<volatile T>::value, "");
+ static_assert( std::is_polymorphic<const volatile T>::value, "");
+}
+
+template <class T>
+void test_is_not_polymorphic()
+{
+ static_assert(!std::is_polymorphic<T>::value, "");
+ static_assert(!std::is_polymorphic<const T>::value, "");
+ static_assert(!std::is_polymorphic<volatile T>::value, "");
+ static_assert(!std::is_polymorphic<const volatile T>::value, "");
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+int main()
+{
+ test_is_not_polymorphic<void>();
+ test_is_not_polymorphic<int&>();
+ test_is_not_polymorphic<int>();
+ test_is_not_polymorphic<double>();
+ test_is_not_polymorphic<int*>();
+ test_is_not_polymorphic<const int*>();
+ test_is_not_polymorphic<char[3]>();
+ test_is_not_polymorphic<char[3]>();
+ test_is_not_polymorphic<Union>();
+ test_is_not_polymorphic<Empty>();
+ test_is_not_polymorphic<bit_zero>();
+
+ test_is_polymorphic<NotEmpty>();
+ test_is_polymorphic<Abstract>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,54 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_signed
#include <type_traits>
template <class T>
void test_is_signed()
{
static_assert( std::is_signed<T>::value, "");
static_assert( std::is_signed<const T>::value, "");
static_assert( std::is_signed<volatile T>::value, "");
static_assert( std::is_signed<const volatile T>::value, "");
}
template <class T>
void test_is_not_signed()
{
static_assert(!std::is_signed<T>::value, "");
static_assert(!std::is_signed<const T>::value, "");
static_assert(!std::is_signed<volatile T>::value, "");
static_assert(!std::is_signed<const volatile T>::value, "");
}
class Class
{
public:
~Class();
}
;
int main()
{
test_is_not_signed<void>();
test_is_not_signed<int&>();
test_is_not_signed<Class>();
test_is_not_signed<int*>();
test_is_not_signed<const int*>();
test_is_not_signed<char[3]>();
test_is_not_signed<char[3]>();
test_is_not_signed<bool>();
test_is_not_signed<unsigned>();
test_is_signed<int>();
test_is_signed<double>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_signed
+
+#include <type_traits>
+
+template <class T>
+void test_is_signed()
+{
+ static_assert( std::is_signed<T>::value, "");
+ static_assert( std::is_signed<const T>::value, "");
+ static_assert( std::is_signed<volatile T>::value, "");
+ static_assert( std::is_signed<const volatile T>::value, "");
+}
+
+template <class T>
+void test_is_not_signed()
+{
+ static_assert(!std::is_signed<T>::value, "");
+ static_assert(!std::is_signed<const T>::value, "");
+ static_assert(!std::is_signed<volatile T>::value, "");
+ static_assert(!std::is_signed<const volatile T>::value, "");
+}
+
+class Class
+{
+public:
+ ~Class();
+};
+
+int main()
+{
+ test_is_not_signed<void>();
+ test_is_not_signed<int&>();
+ test_is_not_signed<Class>();
+ test_is_not_signed<int*>();
+ test_is_not_signed<const int*>();
+ test_is_not_signed<char[3]>();
+ test_is_not_signed<char[3]>();
+ test_is_not_signed<bool>();
+ test_is_not_signed<unsigned>();
+
+ test_is_signed<int>();
+ test_is_signed<double>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,21 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_standard_layout
#include <type_traits>
int main()
{
static_assert( std::is_standard_layout<int>::value, "");
static_assert(!std::is_standard_layout<int&>::value, "");
static_assert(!std::is_standard_layout<volatile int&>::value, "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_standard_layout
+
+#include <type_traits>
+
+int main()
+{
+ static_assert( std::is_standard_layout<int>::value, "");
+ static_assert(!std::is_standard_layout<int&>::value, "");
+ static_assert(!std::is_standard_layout<volatile int&>::value, "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,21 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_trivial
#include <type_traits>
int main()
{
static_assert( std::is_trivial<int>::value, "");
static_assert(!std::is_trivial<int&>::value, "");
static_assert(!std::is_trivial<volatile int&>::value, "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_trivial
+
+#include <type_traits>
+
+int main()
+{
+ static_assert( std::is_trivial<int>::value, "");
+ static_assert(!std::is_trivial<int&>::value, "");
+ static_assert(!std::is_trivial<volatile int&>::value, "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_trivialially_copyable.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_trivialially_copyable.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_trivialially_copyable.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_trivialially_copyable.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,37 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_trivially_copyable
#include <type_traits>
#include <cassert>
struct A
{
int i_;
};
struct B
{
int i_;
~B() {assert(i_ == 0);}
};
int main()
{
static_assert( std::is_trivially_copyable<int>::value, "");
static_assert( std::is_trivially_copyable<const int>::value, "");
static_assert(!std::is_trivially_copyable<int&>::value, "");
static_assert( std::is_trivially_copyable<A>::value, "");
static_assert( std::is_trivially_copyable<const A>::value, "");
static_assert(!std::is_trivially_copyable<const A&>::value, "");
static_assert(!std::is_trivially_copyable<B>::value, "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_trivially_copyable
+
+#include <type_traits>
+#include <cassert>
+
+struct A
+{
+ int i_;
+};
+
+struct B
+{
+ int i_;
+ ~B() {assert(i_ == 0);}
+};
+
+int main()
+{
+ static_assert( std::is_trivially_copyable<int>::value, "");
+ static_assert( std::is_trivially_copyable<const int>::value, "");
+ static_assert(!std::is_trivially_copyable<int&>::value, "");
+ static_assert( std::is_trivially_copyable<A>::value, "");
+ static_assert( std::is_trivially_copyable<const A>::value, "");
+ static_assert(!std::is_trivially_copyable<const A&>::value, "");
+ static_assert(!std::is_trivially_copyable<B>::value, "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,54 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_unsigned
#include <type_traits>
template <class T>
void test_is_unsigned()
{
static_assert( std::is_unsigned<T>::value, "");
static_assert( std::is_unsigned<const T>::value, "");
static_assert( std::is_unsigned<volatile T>::value, "");
static_assert( std::is_unsigned<const volatile T>::value, "");
}
template <class T>
void test_is_not_unsigned()
{
static_assert(!std::is_unsigned<T>::value, "");
static_assert(!std::is_unsigned<const T>::value, "");
static_assert(!std::is_unsigned<volatile T>::value, "");
static_assert(!std::is_unsigned<const volatile T>::value, "");
}
class Class
{
p
ublic:
~Class();
};
int main()
{
test_is_not_unsigned<void>();
test_is_not_unsigned<int&>();
test_is_not_unsigned<Class>();
test_is_not_unsigned<int*>();
test_is_not_unsigned<const int*>();
test_is_not_unsigned<char[3]>();
test_is_not_unsigned<char[3]>();
test_is_not_unsigned<int>();
test_is_not_unsigned<double>();
test_is_unsigned<bool>();
test_is_unsigned<unsigned>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_unsigned
+
+#include <type_traits>
+
+template <class T>
+void test_is_unsigned()
+{
+ static_assert( std::is_unsigned<T>::value, "");
+ static_assert( std::is_unsigned<const T>::value, "");
+ static_assert( std::is_unsigned<volatile T>::value, "");
+ static_assert( std::is_unsigned<const volatile T>::value, "");
+}
+
+template <class T>
+void test_is_not_unsigned()
+{
+ static_assert(!std::is_unsigned<T>::value, "");
+ static_assert(!std::is_unsigned<const T>::value, "");
+ static_assert(!std::is_unsigned<volatile T>::value, "");
+ static_assert(!std::is_unsigned<const volatile T>::value, "");
+}
+
+class Class
+{
+public:
+ ~Class();
+};
+
+int main()
+{
+ test_is_not_unsigned<void>();
+ test_is_not_unsigned<int&>();
+ test_is_not_unsigned<Class>();
+ test_is_not_unsigned<int*>();
+ test_is_not_unsigned<const int*>();
+ test_is_not_unsigned<char[3]>();
+ test_is_not_unsigned<char[3]>();
+ test_is_not_unsigned<int>();
+ test_is_not_unsigned<double>();
+
+ test_is_unsigned<bool>();
+ test_is_unsigned<unsigned>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,37 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_volatile
#include <type_traits>
template <class T>
void test_is_volatile()
{
static_assert(!std::is_volatile<T>::value, "");
static_assert(!std::is_volatile<const T>::value, "");
static_assert( std::is_volatile<volatile T>::value, "");
static_assert( std::is_volatile<const volatile T>::value, "");
}
int main()
{
test_is_volatile<void>();
test_is_volatile<int>();
test_is_volatile<double>();
test_is_volatile<int*>();
test_is_volatile<const int*>();
test_is_volatile<char[3]>();
test_is_volatile<char[3]>();
static_assert(!std::is_volatile<int&>::value, "");
static_as
sert(!std::is_volatile<volatile int&>::value, "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_volatile
+
+#include <type_traits>
+
+template <class T>
+void test_is_volatile()
+{
+ static_assert(!std::is_volatile<T>::value, "");
+ static_assert(!std::is_volatile<const T>::value, "");
+ static_assert( std::is_volatile<volatile T>::value, "");
+ static_assert( std::is_volatile<const volatile T>::value, "");
+}
+
+int main()
+{
+ test_is_volatile<void>();
+ test_is_volatile<int>();
+ test_is_volatile<double>();
+ test_is_volatile<int*>();
+ test_is_volatile<const int*>();
+ test_is_volatile<char[3]>();
+ test_is_volatile<char[3]>();
+
+ static_assert(!std::is_volatile<int&>::value, "");
+ static_assert(!std::is_volatile<volatile int&>::value, "");
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/rank.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/rank.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/rank.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/rank.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// rank
#include <type_traits>
template <class T, unsigned A>
void test_rank()
{
static_assert( std::rank<T>::value == A, "");
static_assert( std::rank<const T>::value == A, "");
static_assert( std::rank<volatile T>::value == A, "");
static_assert( std::rank<const volatile T>::value == A, "");
}
class Class
{
public:
~Class();
};
int main()
{
test_rank<void, 0>();
test_rank<int&, 0>();
test_rank<Class, 0>();
test_rank<int*, 0>();
test_rank<const int*, 0>();
test_rank<int, 0>();
test_rank<double, 0>();
test_rank<bool, 0>();
test_rank<unsigned, 0>();
test_rank<c
har[3], 1>();
test_rank<char[][3], 2>();
test_rank<char[][4][3], 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// rank
+
+#include <type_traits>
+
+template <class T, unsigned A>
+void test_rank()
+{
+ static_assert( std::rank<T>::value == A, "");
+ static_assert( std::rank<const T>::value == A, "");
+ static_assert( std::rank<volatile T>::value == A, "");
+ static_assert( std::rank<const volatile T>::value == A, "");
+}
+
+class Class
+{
+public:
+ ~Class();
+};
+
+int main()
+{
+ test_rank<void, 0>();
+ test_rank<int&, 0>();
+ test_rank<Class, 0>();
+ test_rank<int*, 0>();
+ test_rank<const int*, 0>();
+ test_rank<int, 0>();
+ test_rank<double, 0>();
+ test_rank<bool, 0>();
+ test_rank<unsigned, 0>();
+
+ test_rank<char[3], 1>();
+ test_rank<char[][3], 2>();
+ test_rank<char[][4][3], 3>();
+}
Modified: libcxx/trunk/test/utilities/meta/meta.unary/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/meta/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/version.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/version.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/version.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,20 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <type_traits>
#include <type_traits>
#ifndef _LIBCPP_VERSION
#error _LIBCPP_VERSION not defined
#endif
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <type_traits>
+
+#include <type_traits>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_add.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_add.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_add.fail.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_add.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,19 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_add
#include <ratio>
int main()
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_add<R1, R2>::type R;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_add
+
+#include <ratio>
+
+int main()
+{
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_add<R1, R2>::type R;
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_add.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_add.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_add.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_add.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_add
#include <ratio>
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_add<R1, R2>::type R;
static_assert(R::num == 2 && R::den == 1, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_add<R1, R2>::type R;
static_assert(R::num == 3 && R::den == 2, "");
}
{
typedef std::ratio<-1, 2> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_add<R1, R2>::type R;
static_assert(R::num == 1 && R::den == 2, "");
}
{
typedef std::ratio<1, -2> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_add<R1, R2>::type R;
static_assert(R::num == 1 && R::den == 2, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<-1, 1> R2;
typedef std::ratio_add<R1, R2>::type R;
static_assert(R::num == -1 && R::den == 2, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<1, -1> R2;
typedef std::ratio_add<R1, R2>::type R;
static_assert(R::num == -1 && R::den == 2, "");
}
{
typedef std::ratio<56987354, 467584654> R1;
typedef std::ratio<544668, 22145> R2;
typedef std::ratio_add<R1, R2>::type R;
static_assert(R::num == 127970191639601LL && R::den == 5177331081415LL, "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_add
+
+#include <ratio>
+
+int main()
+{
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_add<R1, R2>::type R;
+ static_assert(R::num == 2 && R::den == 1, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_add<R1, R2>::type R;
+ static_assert(R::num == 3 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<-1, 2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_add<R1, R2>::type R;
+ static_assert(R::num == 1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, -2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_add<R1, R2>::type R;
+ static_assert(R::num == 1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<-1, 1> R2;
+ typedef std::ratio_add<R1, R2>::type R;
+ static_assert(R::num == -1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<1, -1> R2;
+ typedef std::ratio_add<R1, R2>::type R;
+ static_assert(R::num == -1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<56987354, 467584654> R1;
+ typedef std::ratio<544668, 22145> R2;
+ typedef std::ratio_add<R1, R2>::type R;
+ static_assert(R::num == 127970191639601LL && R::den == 5177331081415LL, "");
+ }
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_divide.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_divide.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_divide.fail.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_divide.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,19 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_divide
#include <ratio>
int main()
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<1, 2> R2;
typedef std::ratio_divide<R1, R2>::type R;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_divide
+
+#include <ratio>
+
+int main()
+{
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<1, 2> R2;
+ typedef std::ratio_divide<R1, R2>::type R;
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_divide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_divide.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_divide.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_divide.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_divide
#include <ratio>
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_divide<R1, R2>::type R;
static_assert(R::num == 1 && R::den == 1, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_divide<R1, R2>::type R;
static_assert(R::num == 1 && R::den == 2, "");
}
{
typedef std::ratio<-1, 2> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_divide<R1, R2>::type R;
static_assert(R::num == -1 && R::den == 2, "");
}
{
typedef std::ratio<1, -2> R1;
typedef std::ratio<1
, 1> R2;
typedef std::ratio_divide<R1, R2>::type R;
static_assert(R::num == -1 && R::den == 2, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<-1, 1> R2;
typedef std::ratio_divide<R1, R2>::type R;
static_assert(R::num == -1 && R::den == 2, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<1, -1> R2;
typedef std::ratio_divide<R1, R2>::type R;
static_assert(R::num == -1 && R::den == 2, "");
}
{
typedef std::ratio<56987354, 467584654> R1;
typedef std::ratio<544668, 22145> R2;
typedef std::ratio_divide<R1, R2>::type R;
static_assert(R::num == 630992477165LL && R::den == 127339199162436LL, "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_divide
+
+#include <ratio>
+
+int main()
+{
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_divide<R1, R2>::type R;
+ static_assert(R::num == 1 && R::den == 1, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_divide<R1, R2>::type R;
+ static_assert(R::num == 1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<-1, 2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_divide<R1, R2>::type R;
+ static_assert(R::num == -1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, -2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_divide<R1, R2>::type R;
+ static_assert(R::num == -1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<-1, 1> R2;
+ typedef std::ratio_divide<R1, R2>::type R;
+ static_assert(R::num == -1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<1, -1> R2;
+ typedef std::ratio_divide<R1, R2>::type R;
+ static_assert(R::num == -1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<56987354, 467584654> R1;
+ typedef std::ratio<544668, 22145> R2;
+ typedef std::ratio_divide<R1, R2>::type R;
+ static_assert(R::num == 630992477165LL && R::den == 127339199162436LL, "");
+ }
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_multiply.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_multiply.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_multiply.fail.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_multiply.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,19 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_multiply
#include <ratio>
int main()
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<2, 1> R2;
typedef std::ratio_multiply<R1, R2>::type R;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_multiply
+
+#include <ratio>
+
+int main()
+{
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<2, 1> R2;
+ typedef std::ratio_multiply<R1, R2>::type R;
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_multiply.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_multiply.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_multiply.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_multiply.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_multiply
#include <ratio>
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_multiply<R1, R2>::type R;
static_assert(R::num == 1 && R::den == 1, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_multiply<R1, R2>::type R;
static_assert(R::num == 1 && R::den == 2, "");
}
{
typedef std::ratio<-1, 2> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_multiply<R1, R2>::type R;
static_assert(R::num == -1 && R::den == 2, "");
}
{
typedef std::ratio<1, -2> R1;
typedef std:
:ratio<1, 1> R2;
typedef std::ratio_multiply<R1, R2>::type R;
static_assert(R::num == -1 && R::den == 2, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<-1, 1> R2;
typedef std::ratio_multiply<R1, R2>::type R;
static_assert(R::num == -1 && R::den == 2, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<1, -1> R2;
typedef std::ratio_multiply<R1, R2>::type R;
static_assert(R::num == -1 && R::den == 2, "");
}
{
typedef std::ratio<56987354, 467584654> R1;
typedef std::ratio<544668, 22145> R2;
typedef std::ratio_multiply<R1, R2>::type R;
static_assert(R::num == 15519594064236LL && R::den == 5177331081415LL, "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_multiply
+
+#include <ratio>
+
+int main()
+{
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_multiply<R1, R2>::type R;
+ static_assert(R::num == 1 && R::den == 1, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_multiply<R1, R2>::type R;
+ static_assert(R::num == 1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<-1, 2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_multiply<R1, R2>::type R;
+ static_assert(R::num == -1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, -2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_multiply<R1, R2>::type R;
+ static_assert(R::num == -1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<-1, 1> R2;
+ typedef std::ratio_multiply<R1, R2>::type R;
+ static_assert(R::num == -1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<1, -1> R2;
+ typedef std::ratio_multiply<R1, R2>::type R;
+ static_assert(R::num == -1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<56987354, 467584654> R1;
+ typedef std::ratio<544668, 22145> R2;
+ typedef std::ratio_multiply<R1, R2>::type R;
+ static_assert(R::num == 15519594064236LL && R::den == 5177331081415LL, "");
+ }
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_subtract.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_subtract.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_subtract.fail.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_subtract.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,19 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_subtract
#include <ratio>
int main()
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_subtract<R1, R2>::type R;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_subtract
+
+#include <ratio>
+
+int main()
+{
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_subtract<R1, R2>::type R;
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_subtract.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_subtract.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_subtract.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_subtract.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_subtract
#include <ratio>
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_subtract<R1, R2>::type R;
static_assert(R::num == 0 && R::den == 1, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_subtract<R1, R2>::type R;
static_assert(R::num == -1 && R::den == 2, "");
}
{
typedef std::ratio<-1, 2> R1;
typedef std::ratio<1, 1> R2;
typedef std::ratio_subtract<R1, R2>::type R;
static_assert(R::num == -3 && R::den == 2, "");
}
{
typedef std::ratio<1, -2> R1;
typedef std
::ratio<1, 1> R2;
typedef std::ratio_subtract<R1, R2>::type R;
static_assert(R::num == -3 && R::den == 2, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<-1, 1> R2;
typedef std::ratio_subtract<R1, R2>::type R;
static_assert(R::num == 3 && R::den == 2, "");
}
{
typedef std::ratio<1, 2> R1;
typedef std::ratio<1, -1> R2;
typedef std::ratio_subtract<R1, R2>::type R;
static_assert(R::num == 3 && R::den == 2, "");
}
{
typedef std::ratio<56987354, 467584654> R1;
typedef std::ratio<544668, 22145> R2;
typedef std::ratio_subtract<R1, R2>::type R;
static_assert(R::num == -126708206685271LL && R::den == 5177331081415LL, "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_subtract
+
+#include <ratio>
+
+int main()
+{
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_subtract<R1, R2>::type R;
+ static_assert(R::num == 0 && R::den == 1, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_subtract<R1, R2>::type R;
+ static_assert(R::num == -1 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<-1, 2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_subtract<R1, R2>::type R;
+ static_assert(R::num == -3 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, -2> R1;
+ typedef std::ratio<1, 1> R2;
+ typedef std::ratio_subtract<R1, R2>::type R;
+ static_assert(R::num == -3 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<-1, 1> R2;
+ typedef std::ratio_subtract<R1, R2>::type R;
+ static_assert(R::num == 3 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<1, 2> R1;
+ typedef std::ratio<1, -1> R2;
+ typedef std::ratio_subtract<R1, R2>::type R;
+ static_assert(R::num == 3 && R::den == 2, "");
+ }
+ {
+ typedef std::ratio<56987354, 467584654> R1;
+ typedef std::ratio<544668, 22145> R2;
+ typedef std::ratio_subtract<R1, R2>::type R;
+ static_assert(R::num == -126708206685271LL && R::den == 5177331081415LL, "");
+ }
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_equal
#include <ratio>
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
static_assert((std::ratio_equal<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_equal<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
static_assert((std::ratio_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
static_assert((!std::ratio_equal<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_equal<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
static_assert((!std::ratio_equal<R1, R2>::value), "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_equal
+
+#include <ratio>
+
+int main()
+{
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ static_assert((std::ratio_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((std::ratio_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, -1> R2;
+ static_assert((!std::ratio_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((!std::ratio_equal<R1, R2>::value), "");
+ }
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_greater
#include <ratio>
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
static_assert((!std::ratio_greater<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_greater<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_greater<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFF
FFFFLL> R2;
static_assert((!std::ratio_greater<R1, R2>::value), "");
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
static_assert((std::ratio_greater<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_greater<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_greater<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
static_assert((std::ratio_greater<R1, R2>::value), "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_greater
+
+#include <ratio>
+
+int main()
+{
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ static_assert((!std::ratio_greater<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_greater<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_greater<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((!std::ratio_greater<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, -1> R2;
+ static_assert((std::ratio_greater<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_greater<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_greater<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((std::ratio_greater<R1, R2>::value), "");
+ }
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_greater_equal
#include <ratio>
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ra
tio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_greater_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_greater_equal
+
+#include <ratio>
+
+int main()
+{
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, -1> R2;
+ static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_greater_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ }
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_less.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_less.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_less.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_less.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,86 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_less
#include <ratio>
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
static_assert((!std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
static_assert((!std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
static_assert((!std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
static_assert((!std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R2;
static_assert((std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x
7FFFFFFFFFFFFFFCLL> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
static_assert((!std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
static_assert((std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFELL, 0x7FFFFFFFFFFFFFFDLL> R2;
static_assert((std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<641981, 1339063> R1;
typedef std::ratio<1291640, 2694141LL> R2;
static_assert((!std::ratio_less<R1, R2>::value), "");
}
{
typedef std::ratio<1291640, 2694141LL> R1;
typedef std::ratio<641981, 1339063> R2;
static_assert((std::ratio_less<R1, R2>::value), "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_less
+
+#include <ratio>
+
+int main()
+{
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ static_assert((!std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((!std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, -1> R2;
+ static_assert((!std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((!std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R2;
+ static_assert((std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
+ static_assert((!std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
+ static_assert((std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFELL, 0x7FFFFFFFFFFFFFFDLL> R2;
+ static_assert((std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<641981, 1339063> R1;
+ typedef std::ratio<1291640, 2694141LL> R2;
+ static_assert((!std::ratio_less<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1291640, 2694141LL> R1;
+ typedef std::ratio<641981, 1339063> R2;
+ static_assert((std::ratio_less<R1, R2>::value), "");
+ }
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_less_equal
#include <ratio>
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
static_assert((std::ratio_less_equal<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_less_equal<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_less_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FF
FFFFFFFFFFFFFLL> R2;
static_assert((std::ratio_less_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
static_assert((!std::ratio_less_equal<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_less_equal<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_less_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
static_assert((!std::ratio_less_equal<R1, R2>::value), "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_less_equal
+
+#include <ratio>
+
+int main()
+{
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ static_assert((std::ratio_less_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_less_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_less_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((std::ratio_less_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, -1> R2;
+ static_assert((!std::ratio_less_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_less_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_less_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((!std::ratio_less_equal<R1, R2>::value), "");
+ }
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio_not_equal
#include <ratio>
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
static_assert((!std::ratio_not_equal<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_not_equal<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((!std::ratio_not_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFF
FFFFFFFFFFFFLL> R2;
static_assert((!std::ratio_not_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
static_assert((std::ratio_not_equal<R1, R2>::value), "");
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_not_equal<R1, R2>::value), "");
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
static_assert((std::ratio_not_equal<R1, R2>::value), "");
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
static_assert((std::ratio_not_equal<R1, R2>::value), "");
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_not_equal
+
+#include <ratio>
+
+int main()
+{
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, 1> R2;
+ static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 1> R1;
+ typedef std::ratio<1, -1> R2;
+ static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
+ typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
+ static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ }
+ {
+ typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
+ typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
+ static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ }
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,44 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio: The static data members num and den shall have thcommon
// divisor of the absolute values of N and D:
#include <ratio>
template <long long N, long long D, long long eN, long long eD>
void test()
{
static_assert((std::ratio<N, D>::num == eN), "");
static_assert((std::ratio<N, D>::den == eD), "");
}
int main()
{
test<1, 1, 1, 1>();
test<1, 10, 1, 10>();
test<10, 10, 1, 1>();
test<10, 1, 10, 1>();
test<12, 4, 3, 1>();
test<12, -4, -3, 1>();
test<-12, 4, -3, 1>();
test<-12, -4, 3, 1>();
test<4, 12, 1, 3>();
test<4, -12, -1, 3>();
test<-4, 12, -1, 3>();
test<-4, -12,
1, 3>();
test<222, 333, 2, 3>();
test<222, -333, -2, 3>();
test<-222, 333, -2, 3>();
test<-222, -333, 2, 3>();
test<0x7FFFFFFFFFFFFFFFLL, 127, 72624976668147841LL, 1>();
test<-0x7FFFFFFFFFFFFFFFLL, 127, -72624976668147841LL, 1>();
test<0x7FFFFFFFFFFFFFFFLL, -127, -72624976668147841LL, 1>();
test<-0x7FFFFFFFFFFFFFFFLL, -127, 72624976668147841LL, 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio: The static data members num and den shall have thcommon
+// divisor of the absolute values of N and D:
+
+#include <ratio>
+
+template <long long N, long long D, long long eN, long long eD>
+void test()
+{
+ static_assert((std::ratio<N, D>::num == eN), "");
+ static_assert((std::ratio<N, D>::den == eD), "");
+}
+
+int main()
+{
+ test<1, 1, 1, 1>();
+ test<1, 10, 1, 10>();
+ test<10, 10, 1, 1>();
+ test<10, 1, 10, 1>();
+ test<12, 4, 3, 1>();
+ test<12, -4, -3, 1>();
+ test<-12, 4, -3, 1>();
+ test<-12, -4, 3, 1>();
+ test<4, 12, 1, 3>();
+ test<4, -12, -1, 3>();
+ test<-4, 12, -1, 3>();
+ test<-4, -12, 1, 3>();
+ test<222, 333, 2, 3>();
+ test<222, -333, -2, 3>();
+ test<-222, 333, -2, 3>();
+ test<-222, -333, 2, 3>();
+ test<0x7FFFFFFFFFFFFFFFLL, 127, 72624976668147841LL, 1>();
+ test<-0x7FFFFFFFFFFFFFFFLL, 127, -72624976668147841LL, 1>();
+ test<0x7FFFFFFFFFFFFFFFLL, -127, -72624976668147841LL, 1>();
+ test<-0x7FFFFFFFFFFFFFFFLL, -127, 72624976668147841LL, 1>();
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio1.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio1.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio1.fail.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio1.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,18 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio: The template argument D shall not be zero
#include <ratio>
#include <cstdint>
int main()
{
const std::intmax_t t1 = std::ratio<1, 0>::num;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio: The template argument D shall not be zero
+
+#include <ratio>
+#include <cstdint>
+
+int main()
+{
+ const std::intmax_t t1 = std::ratio<1, 0>::num;
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio2.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio2.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio2.fail.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio2.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,19 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio: the absolute values of the template arguments N and D
// shall be representable by type intmax_t.
#include <ratio>
#include <cstdint>
int main()
{
const std::intmax_t t1 = std::ratio<0x8000000000000000ULL, 1>::num;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio: the absolute values of the template arguments N and D
+// shall be representable by type intmax_t.
+
+#include <ratio>
+#include <cstdint>
+
+int main()
+{
+ const std::intmax_t t1 = std::ratio<0x8000000000000000ULL, 1>::num;
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio3.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio3.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio3.fail.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio3.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,19 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio: the absolute values of the template arguments N and D
// shall be representable by type intmax_t.
#include <ratio>
#include <cstdint>
int main()
{
const std::intmax_t t1 = std::ratio<1, 0x8000000000000000ULL>::num;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio: the absolute values of the template arguments N and D
+// shall be representable by type intmax_t.
+
+#include <ratio>
+#include <cstdint>
+
+int main()
+{
+ const std::intmax_t t1 = std::ratio<1, 0x8000000000000000ULL>::num;
+}
Modified: libcxx/trunk/test/utilities/ratio/ratio.si/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/ratio.si/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/ratio.si/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/ratio.si/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/ratio/typedefs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/typedefs.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/typedefs.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/typedefs.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,32 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test ratio typedef's
#include <ratio>
int main()
{
static_assert(std::atto::num == 1 && std::atto::den == 1000000000000000000ULL, "");
static_assert(std::femto::num == 1 && std::femto::den == 1000000000000000ULL, "");
static_assert(std::pico::num == 1 && std::pico::den == 1000000000000ULL, "");
static_assert(std::nano::num == 1 && std::nano::den == 1000000000ULL, "");
static_assert(std::micro::num == 1 && std::micro::den == 1000000ULL, "");
static_assert(std::milli::num == 1 && std::milli::den == 1000ULL, "");
static_assert(std::centi::num == 1 && std::centi::den == 100ULL, "");
static_assert(std::deci:
:num == 1 && std::deci::den == 10ULL, "");
static_assert(std::deca::num == 10ULL && std::deca::den == 1, "");
static_assert(std::hecto::num == 100ULL && std::hecto::den == 1, "");
static_assert(std::kilo::num == 1000ULL && std::kilo::den == 1, "");
static_assert(std::mega::num == 1000000ULL && std::mega::den == 1, "");
static_assert(std::giga::num == 1000000000ULL && std::giga::den == 1, "");
static_assert(std::tera::num == 1000000000000ULL && std::tera::den == 1, "");
static_assert(std::peta::num == 1000000000000000ULL && std::peta::den == 1, "");
static_assert(std::exa::num == 1000000000000000000ULL && std::exa::den == 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio typedef's
+
+#include <ratio>
+
+int main()
+{
+ static_assert(std::atto::num == 1 && std::atto::den == 1000000000000000000ULL, "");
+ static_assert(std::femto::num == 1 && std::femto::den == 1000000000000000ULL, "");
+ static_assert(std::pico::num == 1 && std::pico::den == 1000000000000ULL, "");
+ static_assert(std::nano::num == 1 && std::nano::den == 1000000000ULL, "");
+ static_assert(std::micro::num == 1 && std::micro::den == 1000000ULL, "");
+ static_assert(std::milli::num == 1 && std::milli::den == 1000ULL, "");
+ static_assert(std::centi::num == 1 && std::centi::den == 100ULL, "");
+ static_assert(std::deci::num == 1 && std::deci::den == 10ULL, "");
+ static_assert(std::deca::num == 10ULL && std::deca::den == 1, "");
+ static_assert(std::hecto::num == 100ULL && std::hecto::den == 1, "");
+ static_assert(std::kilo::num == 1000ULL && std::kilo::den == 1, "");
+ static_assert(std::mega::num == 1000000ULL && std::mega::den == 1, "");
+ static_assert(std::giga::num == 1000000000ULL && std::giga::den == 1, "");
+ static_assert(std::tera::num == 1000000000000ULL && std::tera::den == 1, "");
+ static_assert(std::peta::num == 1000000000000000ULL && std::peta::den == 1, "");
+ static_assert(std::exa::num == 1000000000000000000ULL && std::exa::den == 1, "");
+}
Modified: libcxx/trunk/test/utilities/ratio/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/ratio/version.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/ratio/version.pass.cpp (original)
+++ libcxx/trunk/test/utilities/ratio/version.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,20 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <ratio>
#include <ratio>
#ifndef _LIBCPP_VERSION
#error _LIBCPP_VERSION not defined
#endif
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ratio>
+
+#include <ratio>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,51 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset(const char *str);
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_char_pointer_ctor()
{
{
try
{
std::bitset<N> v("xxx1010101010xxxx");
assert(false);
}
catch (std::invalid_argument&)
{
}
}
{
const char str[] ="1010101010";
std::bitset<N> v(str);
std::size_t M = std::min<std::size_t>(N, 10);
for (std::size_t i = 0; i < M; ++i)
assert(v[i] == (str[M - 1 - i] == '1'));
for (std::size_t i = 10; i < N; ++i)
assert(v[i] == false);
}
}
int main()
{
test_char_pointer_ctor<0>();
test_char_pointer_ctor<1>();
test_char_pointer_ctor<31>();
test_char_pointer_ctor<32>();
test_char_pointer_ctor<33>();
test_char_pointer_ctor<63>();
test_char_pointer_ctor<64>();
test_char_pointer_ctor<65>();
test_char_pointer_ctor<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset(const char *str);
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_char_pointer_ctor()
+{
+ {
+ try
+ {
+ std::bitset<N> v("xxx1010101010xxxx");
+ assert(false);
+ }
+ catch (std::invalid_argument&)
+ {
+ }
+ }
+
+ {
+ const char str[] ="1010101010";
+ std::bitset<N> v(str);
+ std::size_t M = std::min<std::size_t>(N, 10);
+ for (std::size_t i = 0; i < M; ++i)
+ assert(v[i] == (str[M - 1 - i] == '1'));
+ for (std::size_t i = 10; i < N; ++i)
+ assert(v[i] == false);
+ }
+}
+
+int main()
+{
+ test_char_pointer_ctor<0>();
+ test_char_pointer_ctor<1>();
+ test_char_pointer_ctor<31>();
+ test_char_pointer_ctor<32>();
+ test_char_pointer_ctor<33>();
+ test_char_pointer_ctor<63>();
+ test_char_pointer_ctor<64>();
+ test_char_pointer_ctor<65>();
+ test_char_pointer_ctor<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.cons/default.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.cons/default.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,37 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test default ctor
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_default_ctor()
{
{
std::bitset<N> v1;
assert(v1.size() == N);
for (std::size_t i = 0; i < N; ++i)
assert(v1[i] == false);
}
}
int main()
{
test_default_ctor<0>();
test_default_ctor<1>();
test_default_ctor<31>();
test_default_ctor<32>();
test_default_ctor<33>();
test_default_ctor<63>();
test_default_ctor<64>();
test_default_ctor<65>();
test_default_ctor<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test default ctor
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_default_ctor()
+{
+ {
+ std::bitset<N> v1;
+ assert(v1.size() == N);
+ for (std::size_t i = 0; i < N; ++i)
+ assert(v1[i] == false);
+ }
+}
+
+int main()
+{
+ test_default_ctor<0>();
+ test_default_ctor<1>();
+ test_default_ctor<31>();
+ test_default_ctor<32>();
+ test_default_ctor<33>();
+ test_default_ctor<63>();
+ test_default_ctor<64>();
+ test_default_ctor<65>();
+ test_default_ctor<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,86 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset(string, pos, n, zero, one);
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_string_ctor()
{
{
try
{
std::string str("xxx1010101010xxxx");
std::bitset<N> v(str, str.size()+1, 10);
assert(false);
}
catch (std::out_of_range&)
{
}
}
{
try
{
std::string str("xxx1010101010xxxx");
std::bitset<N> v(str, 2, 10);
assert(false);
}
catch (std::invalid_argument&)
{
}
}
{
std::string str("xxx1010101010xxxx");
std::bitset<N> v(str, 3, 10);
std::size_t M = std::min<std::size_t>(N, 10);
for (std::size_t i = 0; i < M; ++i)
assert(v[i] == (str[3 + M - 1 - i] == '1'));
for (std::size_t i = 10; i < N; ++i)
assert(v[i] == false);
}
{
try
{
std::string str("xxxbababababaxxxx");
std::bitset<N> v(str, 2, 10, 'a', 'b');
assert(false);
}
catch (std::invalid_argument&)
{
}
}
{
std::string str("xxxbababababaxxxx");
std::bitset<N> v(str, 3, 10, 'a', 'b');
std::size_t M = std::min<std::size_t>(N, 10);
for (std::size_t i = 0; i < M; ++i)
assert(v[i] == (str[3 + M - 1 - i] == 'b'));
for (std::size_t i = 10; i < N; ++i)
assert(v[i] == false);
}
}
int main()
{
test_string_ctor<0>();
test_string_ctor<1>();
test_string_ctor<31>();
test_string_ctor<32>();
test_string_ctor<33>();
test_string_ctor<63>();
test_string_ctor<64>();
test_string_ctor<65>();
test_string_ctor<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset(string, pos, n, zero, one);
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_string_ctor()
+{
+ {
+ try
+ {
+ std::string str("xxx1010101010xxxx");
+ std::bitset<N> v(str, str.size()+1, 10);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+ }
+
+ {
+ try
+ {
+ std::string str("xxx1010101010xxxx");
+ std::bitset<N> v(str, 2, 10);
+ assert(false);
+ }
+ catch (std::invalid_argument&)
+ {
+ }
+ }
+
+ {
+ std::string str("xxx1010101010xxxx");
+ std::bitset<N> v(str, 3, 10);
+ std::size_t M = std::min<std::size_t>(N, 10);
+ for (std::size_t i = 0; i < M; ++i)
+ assert(v[i] == (str[3 + M - 1 - i] == '1'));
+ for (std::size_t i = 10; i < N; ++i)
+ assert(v[i] == false);
+ }
+
+ {
+ try
+ {
+ std::string str("xxxbababababaxxxx");
+ std::bitset<N> v(str, 2, 10, 'a', 'b');
+ assert(false);
+ }
+ catch (std::invalid_argument&)
+ {
+ }
+ }
+
+ {
+ std::string str("xxxbababababaxxxx");
+ std::bitset<N> v(str, 3, 10, 'a', 'b');
+ std::size_t M = std::min<std::size_t>(N, 10);
+ for (std::size_t i = 0; i < M; ++i)
+ assert(v[i] == (str[3 + M - 1 - i] == 'b'));
+ for (std::size_t i = 10; i < N; ++i)
+ assert(v[i] == false);
+ }
+}
+
+int main()
+{
+ test_string_ctor<0>();
+ test_string_ctor<1>();
+ test_string_ctor<31>();
+ test_string_ctor<32>();
+ test_string_ctor<33>();
+ test_string_ctor<63>();
+ test_string_ctor<64>();
+ test_string_ctor<65>();
+ test_string_ctor<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset(unsigned long long val);
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_val_ctor()
{
{
std::bitset<N> v(0xAAAAAAAAAAAAAAAAULL);
assert(v.size() == N);
unsigned M = std::min<std::size_t>(N, 64);
for (std::size_t i = 0; i < M; ++i)
assert(v[i] == (i & 1));
for (std::size_t i = M; i < N; ++i)
assert(v[i] == false);
}
}
int main()
{
test_val_ctor<0>();
test_val_ctor<1>();
test_val_ctor<31>();
test_val_ctor<32>();
test_val_ctor<33>();
test_val_ctor<63>();
test_val_ctor<64>();
test_val_ctor<65>();
test_val_ctor<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset(unsigned long long val);
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_val_ctor()
+{
+ {
+ std::bitset<N> v(0xAAAAAAAAAAAAAAAAULL);
+ assert(v.size() == N);
+ unsigned M = std::min<std::size_t>(N, 64);
+ for (std::size_t i = 0; i < M; ++i)
+ assert(v[i] == (i & 1));
+ for (std::size_t i = M; i < N; ++i)
+ assert(v[i] == false);
+ }
+}
+
+int main()
+{
+ test_val_ctor<0>();
+ test_val_ctor<1>();
+ test_val_ctor<31>();
+ test_val_ctor<32>();
+ test_val_ctor<33>();
+ test_val_ctor<63>();
+ test_val_ctor<64>();
+ test_val_ctor<65>();
+ test_val_ctor<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/all.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/all.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/all.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/all.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,41 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bool all() const;
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_all()
{
std::bitset<N> v;
v.reset();
assert(v.all() == (N == 0));
v.set();
assert(v.all() == true);
if (N > 1)
{
v[N/2] = false;
assert(v.all() == false);
}
}
int main()
{
test_all<0>();
test_all<1>();
test_all<31>();
test_all<32>();
test_all<33>();
test_all<63>();
test_all<64>();
test_all<65>();
test_all<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bool all() const;
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_all()
+{
+ std::bitset<N> v;
+ v.reset();
+ assert(v.all() == (N == 0));
+ v.set();
+ assert(v.all() == true);
+ if (N > 1)
+ {
+ v[N/2] = false;
+ assert(v.all() == false);
+ }
+}
+
+int main()
+{
+ test_all<0>();
+ test_all<1>();
+ test_all<31>();
+ test_all<32>();
+ test_all<33>();
+ test_all<63>();
+ test_all<64>();
+ test_all<65>();
+ test_all<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/any.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/any.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/any.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/any.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,44 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bool any() const;
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_any()
{
std::bitset<N> v;
v.reset();
assert(v.any() == false);
v.set();
assert(v.any() == (N != 0));
if (N > 1)
{
v[N/2] = false;
assert(v.any() == true);
v.reset();
v[N/2] = true;
assert(v.any() == true);
}
}
int main()
{
test_any<0>();
test_any<1>();
test_any<31>();
test_any<32>();
test_any<33>();
test_any<63>();
test_any<64>();
test_any<65>();
test_any<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bool any() const;
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_any()
+{
+ std::bitset<N> v;
+ v.reset();
+ assert(v.any() == false);
+ v.set();
+ assert(v.any() == (N != 0));
+ if (N > 1)
+ {
+ v[N/2] = false;
+ assert(v.any() == true);
+ v.reset();
+ v[N/2] = true;
+ assert(v.any() == true);
+ }
+}
+
+int main()
+{
+ test_any<0>();
+ test_any<1>();
+ test_any<31>();
+ test_any<32>();
+ test_any<33>();
+ test_any<63>();
+ test_any<64>();
+ test_any<65>();
+ test_any<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/count.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/count.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/count.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/count.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,49 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test size_t count() const;
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_count()
{
const std::bitset<N> v = make_bitset<N>();
std::size_t c1 = v.count();
std::size_t c2 = 0;
for (std::size_t i = 0; i < N; ++i)
if (v[i])
++c2;
assert(c1 == c2);
}
int main()
{
test_count<0>();
test_count<1>();
test_count<31>();
test_count<32>();
test_count<33>();
test_count<63>();
test_count<64>();
test_count<65>();
test_count<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test size_t count() const;
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_count()
+{
+ const std::bitset<N> v = make_bitset<N>();
+ std::size_t c1 = v.count();
+ std::size_t c2 = 0;
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ ++c2;
+ assert(c1 == c2);
+}
+
+int main()
+{
+ test_count<0>();
+ test_count<1>();
+ test_count<31>();
+ test_count<32>();
+ test_count<33>();
+ test_count<63>();
+ test_count<64>();
+ test_count<65>();
+ test_count<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/flip_all.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/flip_all.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/flip_all.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/flip_all.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,47 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>& flip();
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_flip_all()
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = v1;
v2.flip();
for (std::size_t i = 0; i < N; ++i)
assert(v2[i] == ~v1[i]);
}
int main()
{
test_flip_all<0>();
test_flip_all<1>();
test_flip_all<31>();
test_flip_all<32>();
test_flip_all<33>();
test_flip_all<63>();
te
st_flip_all<64>();
test_flip_all<65>();
test_flip_all<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>& flip();
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_flip_all()
+{
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = v1;
+ v2.flip();
+ for (std::size_t i = 0; i < N; ++i)
+ assert(v2[i] == ~v1[i]);
+}
+
+int main()
+{
+ test_flip_all<0>();
+ test_flip_all<1>();
+ test_flip_all<31>();
+ test_flip_all<32>();
+ test_flip_all<33>();
+ test_flip_all<63>();
+ test_flip_all<64>();
+ test_flip_all<65>();
+ test_flip_all<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/flip_one.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/flip_one.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/flip_one.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/flip_one.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>& flip(size_t pos);
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_flip_one()
{
std::bitset<N> v = make_bitset<N>();
try
{
v.flip(50);
bool b = v[50];
if (50 >= v.size())
assert(false);
assert(v[50] == b);
v.flip(50);
assert(v[50] != b);
v.flip(50);
assert(v[50] == b);
}
catch (std::out_of_range&)
{
}
}
int main()
{
test_flip_one<0>();
test_flip_one<1>();
test_flip_one<31>();
test_flip_one<32>();
test_flip_one<33>();
test_flip_one<63>();
test_flip_one<64>();
test_flip_one<65>();
test_flip_one<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>& flip(size_t pos);
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_flip_one()
+{
+ std::bitset<N> v = make_bitset<N>();
+ try
+ {
+ v.flip(50);
+ bool b = v[50];
+ if (50 >= v.size())
+ assert(false);
+ assert(v[50] == b);
+ v.flip(50);
+ assert(v[50] != b);
+ v.flip(50);
+ assert(v[50] == b);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+}
+
+int main()
+{
+ test_flip_one<0>();
+ test_flip_one<1>();
+ test_flip_one<31>();
+ test_flip_one<32>();
+ test_flip_one<33>();
+ test_flip_one<63>();
+ test_flip_one<64>();
+ test_flip_one<65>();
+ test_flip_one<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/index.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/index.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/index.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/index.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,65 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>::reference operator[](size_t pos);
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_index_const()
{
std::bitset<N> v1 = make_bitset<N>();
if (N > 0)
{
assert(v1[N/2] == v1.test(N/2));
typename std::bitset<N>::reference r = v1[N/2];
assert(r == v1.test(N/2));
typename std::bitset<N>::reference r2 = v1[N/2];
r = r2;
assert(r == v1.test(N/2
));
r = false;
assert(r == false);
assert(v1.test(N/2) == false);
r = true;
assert(r == true);
assert(v1.test(N/2) == true);
bool b = ~r;
assert(r == true);
assert(v1.test(N/2) == true);
assert(b == false);
r.flip();
assert(r == false);
assert(v1.test(N/2) == false);
}
}
int main()
{
test_index_const<0>();
test_index_const<1>();
test_index_const<31>();
test_index_const<32>();
test_index_const<33>();
test_index_const<63>();
test_index_const<64>();
test_index_const<65>();
test_index_const<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>::reference operator[](size_t pos);
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_index_const()
+{
+ std::bitset<N> v1 = make_bitset<N>();
+ if (N > 0)
+ {
+ assert(v1[N/2] == v1.test(N/2));
+ typename std::bitset<N>::reference r = v1[N/2];
+ assert(r == v1.test(N/2));
+ typename std::bitset<N>::reference r2 = v1[N/2];
+ r = r2;
+ assert(r == v1.test(N/2));
+ r = false;
+ assert(r == false);
+ assert(v1.test(N/2) == false);
+ r = true;
+ assert(r == true);
+ assert(v1.test(N/2) == true);
+ bool b = ~r;
+ assert(r == true);
+ assert(v1.test(N/2) == true);
+ assert(b == false);
+ r.flip();
+ assert(r == false);
+ assert(v1.test(N/2) == false);
+ }
+}
+
+int main()
+{
+ test_index_const<0>();
+ test_index_const<1>();
+ test_index_const<31>();
+ test_index_const<32>();
+ test_index_const<33>();
+ test_index_const<63>();
+ test_index_const<64>();
+ test_index_const<65>();
+ test_index_const<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/index_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/index_const.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/index_const.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/index_const.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,47 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test constexpr bool operator[](size_t pos) const;
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_index_const()
{
const std::bitset<N> v1 = make_bitset<N>();
if (N > 0)
{
assert(v1[N/2] == v1.test(N/2));
}
}
int main()
{
test_index_const<0>();
test_index_const<1>();
test_index_const<31>();
test_index_const<32>();
test_index_const<33>();
test_index_const<63>();
test_index_const<64>();
test_index_const<65>();
test_index_const<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test constexpr bool operator[](size_t pos) const;
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_index_const()
+{
+ const std::bitset<N> v1 = make_bitset<N>();
+ if (N > 0)
+ {
+ assert(v1[N/2] == v1.test(N/2));
+ }
+}
+
+int main()
+{
+ test_index_const<0>();
+ test_index_const<1>();
+ test_index_const<31>();
+ test_index_const<32>();
+ test_index_const<33>();
+ test_index_const<63>();
+ test_index_const<64>();
+ test_index_const<65>();
+ test_index_const<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/left_shift.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/left_shift.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/left_shift.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/left_shift.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N> operator<<(size_t pos) const;
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_left_shift()
{
for (std::size_t s = 0; s <= N+1; ++s)
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = v1;
assert((v1 <<= s) == (v2 << s));
}
}
int main()
{
test_left_shift<0>();
test_left_shift<1>();
test_left_shift<31>();
test_left_shift<32>();
test_
left_shift<33>();
test_left_shift<63>();
test_left_shift<64>();
test_left_shift<65>();
test_left_shift<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N> operator<<(size_t pos) const;
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_left_shift()
+{
+ for (std::size_t s = 0; s <= N+1; ++s)
+ {
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = v1;
+ assert((v1 <<= s) == (v2 << s));
+ }
+}
+
+int main()
+{
+ test_left_shift<0>();
+ test_left_shift<1>();
+ test_left_shift<31>();
+ test_left_shift<32>();
+ test_left_shift<33>();
+ test_left_shift<63>();
+ test_left_shift<64>();
+ test_left_shift<65>();
+ test_left_shift<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,53 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>& operator<<=(size_t pos);
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_left_shift()
{
for (std::size_t s = 0; s <= N+1; ++s)
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = v1;
v1 <<= s;
for (std::size_t i = 0; i < N; ++i)
if (i < s)
assert(v1[i] == 0);
else
assert(v1[i] == v2[i-s]);
}
}
int main()
{
test_left_shift<0>();
test_left_shift<1>();
test_left_shift<31>();
test_left_shift<32>();
test_left_shift<33>();
test_left_shift<63>();
test_left_shift<64>();
test_left_shift<65>();
test_left_shift<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>& operator<<=(size_t pos);
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_left_shift()
+{
+ for (std::size_t s = 0; s <= N+1; ++s)
+ {
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = v1;
+ v1 <<= s;
+ for (std::size_t i = 0; i < N; ++i)
+ if (i < s)
+ assert(v1[i] == 0);
+ else
+ assert(v1[i] == v2[i-s]);
+ }
+}
+
+int main()
+{
+ test_left_shift<0>();
+ test_left_shift<1>();
+ test_left_shift<31>();
+ test_left_shift<32>();
+ test_left_shift<33>();
+ test_left_shift<63>();
+ test_left_shift<64>();
+ test_left_shift<65>();
+ test_left_shift<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/none.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/none.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/none.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/none.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,44 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bool none() const;
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_none()
{
std::bitset<N> v;
v.reset();
assert(v.none() == true);
v.set();
assert(v.none() == (N == 0));
if (N > 1)
{
v[N/2] = false;
assert(v.none() == false);
v.reset();
v[N/2] = true;
assert(v.none() == false);
}
}
int main()
{
test_none<0>();
test_none<1>();
test_none<31>();
test_none<32>();
test_none<33>();
test_none<63>();
test_none<64>();
test_none<65>();
test_none<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bool none() const;
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_none()
+{
+ std::bitset<N> v;
+ v.reset();
+ assert(v.none() == true);
+ v.set();
+ assert(v.none() == (N == 0));
+ if (N > 1)
+ {
+ v[N/2] = false;
+ assert(v.none() == false);
+ v.reset();
+ v[N/2] = true;
+ assert(v.none() == false);
+ }
+}
+
+int main()
+{
+ test_none<0>();
+ test_none<1>();
+ test_none<31>();
+ test_none<32>();
+ test_none<33>();
+ test_none<63>();
+ test_none<64>();
+ test_none<65>();
+ test_none<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/not_all.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/not_all.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/not_all.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/not_all.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N> operator~() const;
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_not_all()
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = ~v1;
for (std::size_t i = 0; i < N; ++i)
assert(v2[i] == ~v1[i]);
}
int main()
{
test_not_all<0>();
test_not_all<1>();
test_not_all<31>();
test_not_all<32>();
test_not_all<33>();
test_not_all<63>();
test_not_all<
64>();
test_not_all<65>();
test_not_all<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N> operator~() const;
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_not_all()
+{
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = ~v1;
+ for (std::size_t i = 0; i < N; ++i)
+ assert(v2[i] == ~v1[i]);
+}
+
+int main()
+{
+ test_not_all<0>();
+ test_not_all<1>();
+ test_not_all<31>();
+ test_not_all<32>();
+ test_not_all<33>();
+ test_not_all<63>();
+ test_not_all<64>();
+ test_not_all<65>();
+ test_not_all<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>& operator&=(const bitset<N>& rhs);
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_op_and_eq()
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = make_bitset<N>();
std::bitset<N> v3 = v1;
v1 &= v2;
for (std::size_t i = 0; i < N; ++i)
assert(v1[i] == (v3[i] && v2[i]));
}
int main()
{
test_op_and_eq<0>();
test_op_and_eq<1>();
test_op_and_eq<31>();
test_op_and_eq<32>();
test_op_and_eq<33>();
test_op_and_eq<63>();
test_op_and_eq<64>();
test_op_and_eq<65>();
test_op_and_eq<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>& operator&=(const bitset<N>& rhs);
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_op_and_eq()
+{
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = make_bitset<N>();
+ std::bitset<N> v3 = v1;
+ v1 &= v2;
+ for (std::size_t i = 0; i < N; ++i)
+ assert(v1[i] == (v3[i] && v2[i]));
+}
+
+int main()
+{
+ test_op_and_eq<0>();
+ test_op_and_eq<1>();
+ test_op_and_eq<31>();
+ test_op_and_eq<32>();
+ test_op_and_eq<33>();
+ test_op_and_eq<63>();
+ test_op_and_eq<64>();
+ test_op_and_eq<65>();
+ test_op_and_eq<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,53 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test:
// bool operator==(const bitset<N>& rhs) const;
// bool operator!=(const bitset<N>& rhs) const;
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_equality()
{
const std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = v1;
assert(v1 == v2);
if (N > 0)
{
v2[N/2].flip();
assert(v1 != v2);
}
}
int main()
{
test_equality<0>();
test_equality<1>();
test_
equality<31>();
test_equality<32>();
test_equality<33>();
test_equality<63>();
test_equality<64>();
test_equality<65>();
test_equality<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test:
+
+// bool operator==(const bitset<N>& rhs) const;
+// bool operator!=(const bitset<N>& rhs) const;
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_equality()
+{
+ const std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = v1;
+ assert(v1 == v2);
+ if (N > 0)
+ {
+ v2[N/2].flip();
+ assert(v1 != v2);
+ }
+}
+
+int main()
+{
+ test_equality<0>();
+ test_equality<1>();
+ test_equality<31>();
+ test_equality<32>();
+ test_equality<33>();
+ test_equality<63>();
+ test_equality<64>();
+ test_equality<65>();
+ test_equality<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>& operator|=(const bitset<N>& rhs);
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_op_or_eq()
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = make_bitset<N>();
std::bitset<N> v3 = v1;
v1 |= v2;
for (std::size_t i = 0; i < N; ++i)
assert(v1[i] == (v3[i] || v2[i]));
}
int main()
{
test_op_or_eq<0>();
test_op_or_eq<1>();
test_op_or_eq<31>();
test_op_or_eq<32>();
test_op_or_eq<33>();
test_op_or_eq<63>();
test_op_or_eq<64>();
test_op_or_eq<65>();
test_op_or_eq<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>& operator|=(const bitset<N>& rhs);
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_op_or_eq()
+{
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = make_bitset<N>();
+ std::bitset<N> v3 = v1;
+ v1 |= v2;
+ for (std::size_t i = 0; i < N; ++i)
+ assert(v1[i] == (v3[i] || v2[i]));
+}
+
+int main()
+{
+ test_op_or_eq<0>();
+ test_op_or_eq<1>();
+ test_op_or_eq<31>();
+ test_op_or_eq<32>();
+ test_op_or_eq<33>();
+ test_op_or_eq<63>();
+ test_op_or_eq<64>();
+ test_op_or_eq<65>();
+ test_op_or_eq<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>& operator^=(const bitset<N>& rhs);
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_op_xor_eq()
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = make_bitset<N>();
std::bitset<N> v3 = v1;
v1 ^= v2;
for (std::size_t i = 0; i < N; ++i)
assert(v1[i] == (v3[i] != v2[i]));
}
int main()
{
test_op_xor_eq<0>();
test_op_xor_eq<1>();
test_op_xor_eq<31>();
test_op_xor_eq<32>();
test_op_xor_eq<33>();
test_op_xor_eq<63>();
test_op_xor_eq<64>();
test_op_xor_eq<65>();
test_op_xor_eq<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>& operator^=(const bitset<N>& rhs);
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_op_xor_eq()
+{
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = make_bitset<N>();
+ std::bitset<N> v3 = v1;
+ v1 ^= v2;
+ for (std::size_t i = 0; i < N; ++i)
+ assert(v1[i] == (v3[i] != v2[i]));
+}
+
+int main()
+{
+ test_op_xor_eq<0>();
+ test_op_xor_eq<1>();
+ test_op_xor_eq<31>();
+ test_op_xor_eq<32>();
+ test_op_xor_eq<33>();
+ test_op_xor_eq<63>();
+ test_op_xor_eq<64>();
+ test_op_xor_eq<65>();
+ test_op_xor_eq<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/reset_all.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/reset_all.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/reset_all.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/reset_all.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,36 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>& reset();
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_reset_all()
{
std::bitset<N> v;
v.set();
v.reset();
for (std::size_t i = 0; i < N; ++i)
assert(!v[i]);
}
int main()
{
test_reset_all<0>();
test_reset_all<1>();
test_reset_all<31>();
test_reset_all<32>();
test_reset_all<33>();
test_reset_all<63>();
test_reset_all<64>();
test_reset_all<65>();
test_reset_all<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>& reset();
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_reset_all()
+{
+ std::bitset<N> v;
+ v.set();
+ v.reset();
+ for (std::size_t i = 0; i < N; ++i)
+ assert(!v[i]);
+}
+
+int main()
+{
+ test_reset_all<0>();
+ test_reset_all<1>();
+ test_reset_all<31>();
+ test_reset_all<32>();
+ test_reset_all<33>();
+ test_reset_all<63>();
+ test_reset_all<64>();
+ test_reset_all<65>();
+ test_reset_all<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/reset_one.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/reset_one.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/reset_one.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/reset_one.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,47 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>& reset(size_t pos);
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_reset_one()
{
std::bitset<N> v;
try
{
v.set();
v.reset(50);
if (50 >= v.size())
assert(false);
for (unsigned i = 0; i < v.size(); ++i)
if (i == 50)
assert(!v[i]);
else
assert(v[i]);
}
catch (std::out_of_range&)
{
}
}
int main()
{
test_reset_one<0>();
test_reset_one<1>();
test_reset_one<31>();
test_reset_one<32>();
test_reset_one<33>();
test_reset_one<63>();
test_reset_one<64>
();
test_reset_one<65>();
test_reset_one<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>& reset(size_t pos);
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_reset_one()
+{
+ std::bitset<N> v;
+ try
+ {
+ v.set();
+ v.reset(50);
+ if (50 >= v.size())
+ assert(false);
+ for (unsigned i = 0; i < v.size(); ++i)
+ if (i == 50)
+ assert(!v[i]);
+ else
+ assert(v[i]);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+}
+
+int main()
+{
+ test_reset_one<0>();
+ test_reset_one<1>();
+ test_reset_one<31>();
+ test_reset_one<32>();
+ test_reset_one<33>();
+ test_reset_one<63>();
+ test_reset_one<64>();
+ test_reset_one<65>();
+ test_reset_one<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/right_shift.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/right_shift.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/right_shift.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/right_shift.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N> operator>>(size_t pos) const;
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_right_shift()
{
for (std::size_t s = 0; s <= N+1; ++s)
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = v1;
assert((v1 >>= s) == (v2 >> s));
}
}
int main()
{
test_right_shift<0>();
test_right_shift<1>();
test_right_shift<31>();
test_right_shift<32>();
test_right_shift<33>();
test_right_shift<63>();
test_right_shift<64>();
test_right_shift<65>();
test_right_shift<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N> operator>>(size_t pos) const;
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_right_shift()
+{
+ for (std::size_t s = 0; s <= N+1; ++s)
+ {
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = v1;
+ assert((v1 >>= s) == (v2 >> s));
+ }
+}
+
+int main()
+{
+ test_right_shift<0>();
+ test_right_shift<1>();
+ test_right_shift<31>();
+ test_right_shift<32>();
+ test_right_shift<33>();
+ test_right_shift<63>();
+ test_right_shift<64>();
+ test_right_shift<65>();
+ test_right_shift<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,53 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>& operator<<=(size_t pos);
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_right_shift()
{
for (std::size_t s = 0; s <= N+1; ++s)
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = v1;
v1 >>= s;
for (std::size_t i = 0; i < N; ++i)
if (i + s < N)
assert(v1[i] == v2[i + s]);
else
assert(v1[i] ==
0);
}
}
int main()
{
test_right_shift<0>();
test_right_shift<1>();
test_right_shift<31>();
test_right_shift<32>();
test_right_shift<33>();
test_right_shift<63>();
test_right_shift<64>();
test_right_shift<65>();
test_right_shift<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>& operator<<=(size_t pos);
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_right_shift()
+{
+ for (std::size_t s = 0; s <= N+1; ++s)
+ {
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = v1;
+ v1 >>= s;
+ for (std::size_t i = 0; i < N; ++i)
+ if (i + s < N)
+ assert(v1[i] == v2[i + s]);
+ else
+ assert(v1[i] == 0);
+ }
+}
+
+int main()
+{
+ test_right_shift<0>();
+ test_right_shift<1>();
+ test_right_shift<31>();
+ test_right_shift<32>();
+ test_right_shift<33>();
+ test_right_shift<63>();
+ test_right_shift<64>();
+ test_right_shift<65>();
+ test_right_shift<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/set_all.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/set_all.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/set_all.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/set_all.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,35 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>& set();
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_set_all()
{
std::bitset<N> v;
v.set();
for (std::size_t i = 0; i < N; ++i)
assert(v[i]);
}
int main()
{
test_set_all<0>();
test_set_all<1>();
test_set_all<31>();
test_set_all<32>();
test_set_all<33>();
test_set_all<63>();
test_set_all<64>();
test_set_all<65>();
test_set_all<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>& set();
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_set_all()
+{
+ std::bitset<N> v;
+ v.set();
+ for (std::size_t i = 0; i < N; ++i)
+ assert(v[i]);
+}
+
+int main()
+{
+ test_set_all<0>();
+ test_set_all<1>();
+ test_set_all<31>();
+ test_set_all<32>();
+ test_set_all<33>();
+ test_set_all<63>();
+ test_set_all<64>();
+ test_set_all<65>();
+ test_set_all<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/set_one.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/set_one.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/set_one.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/set_one.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,52 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N>& set(size_t pos, bool val = true);
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_set_one()
{
std::bitset<N> v;
try
{
v.set(50);
if (50 >= v.size())
assert(false);
assert(v[50]);
}
catch (std::out_of_range&)
{
}
try
{
v.set(50, false);
if (50 >= v.size())
assert(false);
assert(!v[50]);
}
catch (std::out_of_range&)
{
}
}
int main()
{
test_set_one<0>();
test_set_one<1>();
test_set_one<31>();
test_set_one<32>();
test_set_one<33>();
test_set_one<63>();
test_set_one<64>();
test_set_one<65>();
test_set_one<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N>& set(size_t pos, bool val = true);
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_set_one()
+{
+ std::bitset<N> v;
+ try
+ {
+ v.set(50);
+ if (50 >= v.size())
+ assert(false);
+ assert(v[50]);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+ try
+ {
+ v.set(50, false);
+ if (50 >= v.size())
+ assert(false);
+ assert(!v[50]);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+}
+
+int main()
+{
+ test_set_one<0>();
+ test_set_one<1>();
+ test_set_one<31>();
+ test_set_one<32>();
+ test_set_one<33>();
+ test_set_one<63>();
+ test_set_one<64>();
+ test_set_one<65>();
+ test_set_one<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/size.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/size.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/size.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,33 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test size_t count() const;
#include <bitset>
#include <cassert>
template <std::size_t N>
void test_size()
{
const std::bitset<N> v;
assert(v.size() == N);
}
int main()
{
test_size<0>();
test_size<1>();
test_size<31>();
test_size<32>();
test_size<33>();
test_size<63>();
test_size<64>();
test_size<65>();
test_size<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test size_t count() const;
+
+#include <bitset>
+#include <cassert>
+
+template <std::size_t N>
+void test_size()
+{
+ const std::bitset<N> v;
+ assert(v.size() == N);
+}
+
+int main()
+{
+ test_size<0>();
+ test_size<1>();
+ test_size<31>();
+ test_size<32>();
+ test_size<33>();
+ test_size<63>();
+ test_size<64>();
+ test_size<65>();
+ test_size<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/test.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/test.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/test.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,53 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test constexpr bool test(size_t pos) const;
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_test()
{
const std::bitset<N> v1 = make_bitset<N>();
try
{
bool b = v1.test(50);
if (50 >= v1.size())
assert(false);
assert(b == v1[50]);
}
catch (std::out_of_range&)
{
}
}
int main()
{
test_test<0>();
test_test<1>();
test_test<31>();
test
_test<32>();
test_test<33>();
test_test<63>();
test_test<64>();
test_test<65>();
test_test<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test constexpr bool test(size_t pos) const;
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_test()
+{
+ const std::bitset<N> v1 = make_bitset<N>();
+ try
+ {
+ bool b = v1.test(50);
+ if (50 >= v1.size())
+ assert(false);
+ assert(b == v1[50]);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+}
+
+int main()
+{
+ test_test<0>();
+ test_test<1>();
+ test_test<31>();
+ test_test<32>();
+ test_test<33>();
+ test_test<63>();
+ test_test<64>();
+ test_test<65>();
+ test_test<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/to_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/to_string.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/to_string.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/to_string.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,160 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test:
// template <class charT, class traits, class Allocator>
// basic_string<charT, traits, Allocator>
// to_string(charT zero = charT('0'), charT one = charT('1')) const;
//
// template <class charT, class traits>
// basic_string<charT, traits, allocator<charT> > to_string() const;
//
// template <class charT>
// basic_string<charT, char_traits<charT>, allocator<charT> > to_string() const;
//
// basic_string<char, char_traits<char>, allocator<char> > to_string() const;
#include <bitset>
#include <string>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
f
or (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_to_string()
{
{
std::bitset<N> v = make_bitset<N>();
{
std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >();
for (std::size_t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
{
std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t> >();
for (std::size_t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
{
std::string s = v.template to_string<char>();
for (std::size_t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
{
std::string s = v.to_string();
for (std::size_
t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
}
{
std::bitset<N> v = make_bitset<N>();
{
std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >('0');
for (std::size_t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
{
std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t> >('0');
for (std::size_t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
{
std::string s = v.template to_string<char>('0');
for (std::size_t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
{
std::string s = v.to_string('0');
for (std::siz
e_t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
}
{
std::bitset<N> v = make_bitset<N>();
{
std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >('0', '1');
for (std::size_t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
{
std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t> >('0', '1');
for (std::size_t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
{
std::string s = v.template to_string<char>('0', '1');
for (std::size_t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
{
std::string s = v.to_string('0', '
1');
for (std::size_t i = 0; i < N; ++i)
if (v[i])
assert(s[N - 1 - i] == '1');
else
assert(s[N - 1 - i] == '0');
}
}
}
int main()
{
test_to_string<0>();
test_to_string<1>();
test_to_string<31>();
test_to_string<32>();
test_to_string<33>();
test_to_string<63>();
test_to_string<64>();
test_to_string<65>();
test_to_string<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test:
+
+// template <class charT, class traits, class Allocator>
+// basic_string<charT, traits, Allocator>
+// to_string(charT zero = charT('0'), charT one = charT('1')) const;
+//
+// template <class charT, class traits>
+// basic_string<charT, traits, allocator<charT> > to_string() const;
+//
+// template <class charT>
+// basic_string<charT, char_traits<charT>, allocator<charT> > to_string() const;
+//
+// basic_string<char, char_traits<char>, allocator<char> > to_string() const;
+
+#include <bitset>
+#include <string>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_to_string()
+{
+{
+ std::bitset<N> v = make_bitset<N>();
+ {
+ std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >();
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+ {
+ std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t> >();
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+ {
+ std::string s = v.template to_string<char>();
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+ {
+ std::string s = v.to_string();
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+}
+{
+ std::bitset<N> v = make_bitset<N>();
+ {
+ std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >('0');
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+ {
+ std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t> >('0');
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+ {
+ std::string s = v.template to_string<char>('0');
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+ {
+ std::string s = v.to_string('0');
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+}
+{
+ std::bitset<N> v = make_bitset<N>();
+ {
+ std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >('0', '1');
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+ {
+ std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t> >('0', '1');
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+ {
+ std::string s = v.template to_string<char>('0', '1');
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+ {
+ std::string s = v.to_string('0', '1');
+ for (std::size_t i = 0; i < N; ++i)
+ if (v[i])
+ assert(s[N - 1 - i] == '1');
+ else
+ assert(s[N - 1 - i] == '0');
+ }
+}
+}
+
+int main()
+{
+ test_to_string<0>();
+ test_to_string<1>();
+ test_to_string<31>();
+ test_to_string<32>();
+ test_to_string<33>();
+ test_to_string<63>();
+ test_to_string<64>();
+ test_to_string<65>();
+ test_to_string<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ullong.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ullong.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ullong.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ullong.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,50 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test unsigned long long to_ullong() const;
#include <bitset>
#include <algorithm>
#include <climits>
#include <cassert>
template <std::size_t N>
void test_to_ullong()
{
const std::size_t M = sizeof(unsigned long long) * CHAR_BIT < N ? sizeof(unsigned long long) * CHAR_BIT : N;
const std::size_t X = M == 0 ? sizeof(unsigned long long) * CHAR_BIT - 1 : sizeof(unsigned long long) * CHAR_BIT - M;
const unsigned long long max = M == 0 ? 0 : (unsigned long long)(-1) >> X;
unsigned long long tests[] = {0,
std::min<unsigned long long>(1, max),
std::min<unsigned long long>(2
, max),
std::min<unsigned long long>(3, max),
std::min(max, max-3),
std::min(max, max-2),
std::min(max, max-1),
max};
for (std::size_t i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i)
{
unsigned long long j = tests[i];
std::bitset<N> v(j);
assert(j == v.to_ullong());
}
}
int main()
{
test_to_ullong<0>();
test_to_ullong<1>();
test_to_ullong<31>();
test_to_ullong<32>();
test_to_ullong<33>();
test_to_ullong<63>();
test_to_ullong<64>();
test_to_ullong<65>();
test_to_ullong<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test unsigned long long to_ullong() const;
+
+#include <bitset>
+#include <algorithm>
+#include <climits>
+#include <cassert>
+
+template <std::size_t N>
+void test_to_ullong()
+{
+ const std::size_t M = sizeof(unsigned long long) * CHAR_BIT < N ? sizeof(unsigned long long) * CHAR_BIT : N;
+ const std::size_t X = M == 0 ? sizeof(unsigned long long) * CHAR_BIT - 1 : sizeof(unsigned long long) * CHAR_BIT - M;
+ const unsigned long long max = M == 0 ? 0 : (unsigned long long)(-1) >> X;
+ unsigned long long tests[] = {0,
+ std::min<unsigned long long>(1, max),
+ std::min<unsigned long long>(2, max),
+ std::min<unsigned long long>(3, max),
+ std::min(max, max-3),
+ std::min(max, max-2),
+ std::min(max, max-1),
+ max};
+ for (std::size_t i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i)
+ {
+ unsigned long long j = tests[i];
+ std::bitset<N> v(j);
+ assert(j == v.to_ullong());
+ }
+}
+
+int main()
+{
+ test_to_ullong<0>();
+ test_to_ullong<1>();
+ test_to_ullong<31>();
+ test_to_ullong<32>();
+ test_to_ullong<33>();
+ test_to_ullong<63>();
+ test_to_ullong<64>();
+ test_to_ullong<65>();
+ test_to_ullong<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ulong.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ulong.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ulong.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ulong.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,50 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test unsigned long to_ulong() const;
#include <bitset>
#include <algorithm>
#include <climits>
#include <cassert>
template <std::size_t N>
void test_to_ulong()
{
const std::size_t M = sizeof(unsigned long) * CHAR_BIT < N ? sizeof(unsigned long) * CHAR_BIT : N;
const std::size_t X = M == 0 ? sizeof(unsigned long) * CHAR_BIT - 1 : sizeof(unsigned long) * CHAR_BIT - M;
const std::size_t max = M == 0 ? 0 : std::size_t(-1) >> X;
std::size_t tests[] = {0,
std::min<std::size_t>(1, max),
std::min<std::size_t>(2, max),
std::min<std::size_t>(3, max)
,
std::min(max, max-3),
std::min(max, max-2),
std::min(max, max-1),
max};
for (std::size_t i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i)
{
std::size_t j = tests[i];
std::bitset<N> v(j);
assert(j == v.to_ulong());
}
}
int main()
{
test_to_ulong<0>();
test_to_ulong<1>();
test_to_ulong<31>();
test_to_ulong<32>();
test_to_ulong<33>();
test_to_ulong<63>();
test_to_ulong<64>();
test_to_ulong<65>();
test_to_ulong<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test unsigned long to_ulong() const;
+
+#include <bitset>
+#include <algorithm>
+#include <climits>
+#include <cassert>
+
+template <std::size_t N>
+void test_to_ulong()
+{
+ const std::size_t M = sizeof(unsigned long) * CHAR_BIT < N ? sizeof(unsigned long) * CHAR_BIT : N;
+ const std::size_t X = M == 0 ? sizeof(unsigned long) * CHAR_BIT - 1 : sizeof(unsigned long) * CHAR_BIT - M;
+ const std::size_t max = M == 0 ? 0 : std::size_t(-1) >> X;
+ std::size_t tests[] = {0,
+ std::min<std::size_t>(1, max),
+ std::min<std::size_t>(2, max),
+ std::min<std::size_t>(3, max),
+ std::min(max, max-3),
+ std::min(max, max-2),
+ std::min(max, max-1),
+ max};
+ for (std::size_t i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i)
+ {
+ std::size_t j = tests[i];
+ std::bitset<N> v(j);
+ assert(j == v.to_ulong());
+ }
+}
+
+int main()
+{
+ test_to_ulong<0>();
+ test_to_ulong<1>();
+ test_to_ulong<31>();
+ test_to_ulong<32>();
+ test_to_ulong<33>();
+ test_to_ulong<63>();
+ test_to_ulong<64>();
+ test_to_ulong<65>();
+ test_to_ulong<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_and.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_and.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_and.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_and.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N> operator&(const bitset<N>& lhs, const bitset<N>& rhs);
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_op_and()
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = make_bitset<N>();
std::bitset<N> v3 = v1;
assert((v1 & v2) == (v3 &= v2));;
}
int main()
{
test_op_and<0>();
test_op_and<1>();
test_op_and<31>();
test_op_and<32>();
test_op_and<33>();
t
est_op_and<63>();
test_op_and<64>();
test_op_and<65>();
test_op_and<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N> operator&(const bitset<N>& lhs, const bitset<N>& rhs);
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_op_and()
+{
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = make_bitset<N>();
+ std::bitset<N> v3 = v1;
+ assert((v1 & v2) == (v3 &= v2));;
+}
+
+int main()
+{
+ test_op_and<0>();
+ test_op_and<1>();
+ test_op_and<31>();
+ test_op_and<32>();
+ test_op_and<33>();
+ test_op_and<63>();
+ test_op_and<64>();
+ test_op_and<65>();
+ test_op_and<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_not.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_not.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_not.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_not.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N> operator^(const bitset<N>& lhs, const bitset<N>& rhs);
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_op_not()
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = make_bitset<N>();
std::bitset<N> v3 = v1;
assert((v1 ^ v2) == (v3 ^= v2));;
}
int main()
{
test_op_not<0>();
test_op_not<1>();
test_op_not<31>();
test_op_not<32>();
test_op_not<33>();
t
est_op_not<63>();
test_op_not<64>();
test_op_not<65>();
test_op_not<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N> operator^(const bitset<N>& lhs, const bitset<N>& rhs);
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_op_not()
+{
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = make_bitset<N>();
+ std::bitset<N> v3 = v1;
+ assert((v1 ^ v2) == (v3 ^= v2));;
+}
+
+int main()
+{
+ test_op_not<0>();
+ test_op_not<1>();
+ test_op_not<31>();
+ test_op_not<32>();
+ test_op_not<33>();
+ test_op_not<63>();
+ test_op_not<64>();
+ test_op_not<65>();
+ test_op_not<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_or.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_or.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_or.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_or.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test bitset<N> operator|(const bitset<N>& lhs, const bitset<N>& rhs);
#include <bitset>
#include <cstdlib>
#include <cassert>
template <std::size_t N>
std::bitset<N>
make_bitset()
{
std::bitset<N> v;
for (std::size_t i = 0; i < N; ++i)
v[i] = static_cast<bool>(std::rand() & 1);
return v;
}
template <std::size_t N>
void test_op_or()
{
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = make_bitset<N>();
std::bitset<N> v3 = v1;
assert((v1 | v2) == (v3 |= v2));;
}
int main()
{
test_op_or<0>();
test_op_or<1>();
test_op_or<31>();
test_op_or<32>();
test_op_or<33>();
test_op
_or<63>();
test_op_or<64>();
test_op_or<65>();
test_op_or<1000>();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bitset<N> operator|(const bitset<N>& lhs, const bitset<N>& rhs);
+
+#include <bitset>
+#include <cstdlib>
+#include <cassert>
+
+template <std::size_t N>
+std::bitset<N>
+make_bitset()
+{
+ std::bitset<N> v;
+ for (std::size_t i = 0; i < N; ++i)
+ v[i] = static_cast<bool>(std::rand() & 1);
+ return v;
+}
+
+template <std::size_t N>
+void test_op_or()
+{
+ std::bitset<N> v1 = make_bitset<N>();
+ std::bitset<N> v2 = make_bitset<N>();
+ std::bitset<N> v3 = v1;
+ assert((v1 | v2) == (v3 |= v2));;
+}
+
+int main()
+{
+ test_op_or<0>();
+ test_op_or<1>();
+ test_op_or<31>();
+ test_op_or<32>();
+ test_op_or<33>();
+ test_op_or<63>();
+ test_op_or<64>();
+ test_op_or<65>();
+ test_op_or<1000>();
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.operators/stream_in.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.operators/stream_in.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.operators/stream_in.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.operators/stream_in.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test:
// template <class charT, class traits, size_t N>
// basic_ostream<charT, traits>&
// operator<<(basic_ostream<charT, traits>& os, const bitset<N>& x);
#include <bitset>
#include <sstream>
#include <cassert>
int main()
{
std::istringstream in("01011010");
std::bitset<8> b;
in >> b;
assert(b.to_ulong() == 0x5A);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test:
+
+// template <class charT, class traits, size_t N>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const bitset<N>& x);
+
+#include <bitset>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ std::istringstream in("01011010");
+ std::bitset<8> b;
+ in >> b;
+ assert(b.to_ulong() == 0x5A);
+}
Modified: libcxx/trunk/test/utilities/template.bitset/bitset.operators/stream_out.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.operators/stream_out.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.operators/stream_out.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.operators/stream_out.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test:
// template <class charT, class traits, size_t N>
// basic_istream<charT, traits>&
// operator>>(basic_istream<charT, traits>& is, bitset<N>& x);
#include <bitset>
#include <sstream>
#include <cassert>
int main()
{
std::ostringstream os;
std::bitset<8> b(0x5A);
os << b;
assert(os.str() == "01011010");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test:
+
+// template <class charT, class traits, size_t N>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is, bitset<N>& x);
+
+#include <bitset>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ std::ostringstream os;
+ std::bitset<8> b(0x5A);
+ os << b;
+ assert(os.str() == "01011010");
+}
Modified: libcxx/trunk/test/utilities/template.bitset/includes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/includes.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/includes.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/includes.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,32 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test that <bitset> includes <cstddef>, <string>, <stdexcept> and <iosfwd>
#include <bitset>
#ifndef _LIBCPP_CSTDDEF
#error <cstddef> has not been included
#endif
#ifndef _LIBCPP_STRING
#error <string> has not been included
#endif
#ifndef _LIBCPP_STDEXCEPT
#error <stdexcept> has not been included
#endif
#ifndef _LIBCPP_IOSFWD
#error <iosfwd> has not been included
#endif
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test that <bitset> includes <cstddef>, <string>, <stdexcept> and <iosfwd>
+
+#include <bitset>
+
+#ifndef _LIBCPP_CSTDDEF
+#error <cstddef> has not been included
+#endif
+
+#ifndef _LIBCPP_STRING
+#error <string> has not been included
+#endif
+
+#ifndef _LIBCPP_STDEXCEPT
+#error <stdexcept> has not been included
+#endif
+
+#ifndef _LIBCPP_IOSFWD
+#error <iosfwd> has not been included
+#endif
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/template.bitset/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/version.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/version.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/version.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,20 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <bitset>
#include <bitset>
#ifndef _LIBCPP_VERSION
#error _LIBCPP_VERSION not defined
#endif
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <bitset>
+
+#include <bitset>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/time/clock.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/clock.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/clock.h (original)
+++ libcxx/trunk/test/utilities/time/clock.h Sat Aug 21 19:59:46 2010
@@ -14,4 +14,4 @@
static time_point now();
};
-#endif
+#endif // CLOCK_H
Modified: libcxx/trunk/test/utilities/time/hours.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/hours.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/hours.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/hours.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// typedef duration<signed integral type of at least 23 bits, ratio<3600>> hours;
#include <chrono>
#include <type_traits>
#include <limits>
int main()
{
typedef std::chrono::hours D;
typedef D::rep Rep;
typedef D::period Period;
static_assert(std::is_signed<Rep>::value, "");
static_assert(std::is_integral<Rep>::value, "");
static_assert(std::numeric_limits<Rep>::digits >= 22, "");
static_assert((std::is_same<Period, std::ratio<3600> >::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 23 bits, ratio<3600>> hours;
+
+#include <chrono>
+#include <type_traits>
+#include <limits>
+
+int main()
+{
+ typedef std::chrono::hours D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ static_assert(std::is_signed<Rep>::value, "");
+ static_assert(std::is_integral<Rep>::value, "");
+ static_assert(std::numeric_limits<Rep>::digits >= 22, "");
+ static_assert((std::is_same<Period, std::ratio<3600> >::value), "");
+}
Modified: libcxx/trunk/test/utilities/time/microseconds.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/microseconds.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/microseconds.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/microseconds.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// typedef duration<signed integral type of at least 55 bits, micro> microseconds;
#include <chrono>
#include <type_traits>
#include <limits>
int main()
{
typedef std::chrono::microseconds D;
typedef D::rep Rep;
typedef D::period Period;
static_assert(std::is_signed<Rep>::value, "");
static_assert(std::is_integral<Rep>::value, "");
static_assert(std::numeric_limits<Rep>::digits >= 54, "");
static_assert((std::is_same<Period, std::micro>::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 55 bits, micro> microseconds;
+
+#include <chrono>
+#include <type_traits>
+#include <limits>
+
+int main()
+{
+ typedef std::chrono::microseconds D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ static_assert(std::is_signed<Rep>::value, "");
+ static_assert(std::is_integral<Rep>::value, "");
+ static_assert(std::numeric_limits<Rep>::digits >= 54, "");
+ static_assert((std::is_same<Period, std::micro>::value), "");
+}
Modified: libcxx/trunk/test/utilities/time/milliseconds.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/milliseconds.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/milliseconds.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/milliseconds.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// typedef duration<signed integral type of at least 45 bits, milli> milliseconds;
#include <chrono>
#include <type_traits>
#include <limits>
int main()
{
typedef std::chrono::milliseconds D;
typedef D::rep Rep;
typedef D::period Period;
static_assert(std::is_signed<Rep>::value, "");
static_assert(std::is_integral<Rep>::value, "");
static_assert(std::numeric_limits<Rep>::digits >= 44, "");
static_assert((std::is_same<Period, std::milli>::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 45 bits, milli> milliseconds;
+
+#include <chrono>
+#include <type_traits>
+#include <limits>
+
+int main()
+{
+ typedef std::chrono::milliseconds D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ static_assert(std::is_signed<Rep>::value, "");
+ static_assert(std::is_integral<Rep>::value, "");
+ static_assert(std::numeric_limits<Rep>::digits >= 44, "");
+ static_assert((std::is_same<Period, std::milli>::value), "");
+}
Modified: libcxx/trunk/test/utilities/time/minutes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/minutes.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/minutes.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/minutes.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// typedef duration<signed integral type of at least 29 bits, ratio< 60>> minutes;
#include <chrono>
#include <type_traits>
#include <limits>
int main()
{
typedef std::chrono::minutes D;
typedef D::rep Rep;
typedef D::period Period;
static_assert(std::is_signed<Rep>::value, "");
static_assert(std::is_integral<Rep>::value, "");
static_assert(std::numeric_limits<Rep>::digits >= 28, "");
static_assert((std::is_same<Period, std::ratio<60> >::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 29 bits, ratio< 60>> minutes;
+
+#include <chrono>
+#include <type_traits>
+#include <limits>
+
+int main()
+{
+ typedef std::chrono::minutes D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ static_assert(std::is_signed<Rep>::value, "");
+ static_assert(std::is_integral<Rep>::value, "");
+ static_assert(std::numeric_limits<Rep>::digits >= 28, "");
+ static_assert((std::is_same<Period, std::ratio<60> >::value), "");
+}
Modified: libcxx/trunk/test/utilities/time/nanoseconds.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/nanoseconds.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/nanoseconds.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/nanoseconds.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// typedef duration<signed integral type of at least 64 bits, nano> nanoseconds;
#include <chrono>
#include <type_traits>
#include <limits>
int main()
{
typedef std::chrono::nanoseconds D;
typedef D::rep Rep;
typedef D::period Period;
static_assert(std::is_signed<Rep>::value, "");
static_assert(std::is_integral<Rep>::value, "");
static_assert(std::numeric_limits<Rep>::digits >= 63, "");
static_assert((std::is_same<Period, std::nano>::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 64 bits, nano> nanoseconds;
+
+#include <chrono>
+#include <type_traits>
+#include <limits>
+
+int main()
+{
+ typedef std::chrono::nanoseconds D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ static_assert(std::is_signed<Rep>::value, "");
+ static_assert(std::is_integral<Rep>::value, "");
+ static_assert(std::numeric_limits<Rep>::digits >= 63, "");
+ static_assert((std::is_same<Period, std::nano>::value), "");
+}
Modified: libcxx/trunk/test/utilities/time/rep.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/rep.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/rep.h (original)
+++ libcxx/trunk/test/utilities/time/rep.h Sat Aug 21 19:59:46 2010
@@ -15,4 +15,4 @@
Rep& operator/=(Rep x) {data_ /= x.data_; return *this;}
};
-#endif
+#endif // REP_H
Modified: libcxx/trunk/test/utilities/time/seconds.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/seconds.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/seconds.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/seconds.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// typedef duration<signed integral type of at least 35 bits > seconds;
#include <chrono>
#include <type_traits>
#include <limits>
int main()
{
typedef std::chrono::seconds D;
typedef D::rep Rep;
typedef D::period Period;
static_assert(std::is_signed<Rep>::value, "");
static_assert(std::is_integral<Rep>::value, "");
static_assert(std::numeric_limits<Rep>::digits >= 34, "");
static_assert((std::is_same<Period, std::ratio<1> >::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 35 bits > seconds;
+
+#include <chrono>
+#include <type_traits>
+#include <limits>
+
+int main()
+{
+ typedef std::chrono::seconds D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ static_assert(std::is_signed<Rep>::value, "");
+ static_assert(std::is_integral<Rep>::value, "");
+ static_assert(std::numeric_limits<Rep>::digits >= 34, "");
+ static_assert((std::is_same<Period, std::ratio<1> >::value), "");
+}
Modified: libcxx/trunk/test/utilities/time/time.clock.req/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.clock.req/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.clock.req/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.clock.req/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/time/time.clock/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.clock/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.clock/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.clock/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Modified: libcxx/trunk/test/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// high_resolution_clock
// check clock invariants
#include <chrono>
int main()
{
typedef std::chrono::high_resolution_clock C;
static_assert((std::is_same<C::rep, C::duration::rep>::value), "");
static_assert((std::is_same<C::period, C::duration::period>::value), "");
static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");
static_assert(C::is_monotonic || !C::is_monotonic, "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// high_resolution_clock
+
+// check clock invariants
+
+#include <chrono>
+
+int main()
+{
+ typedef std::chrono::high_resolution_clock C;
+ static_assert((std::is_same<C::rep, C::duration::rep>::value), "");
+ static_assert((std::is_same<C::period, C::duration::period>::value), "");
+ static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");
+ static_assert(C::is_monotonic || !C::is_monotonic, "");
+}
Modified: libcxx/trunk/test/utilities/time/time.clock/time.clock.hires/now.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.clock/time.clock.hires/now.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.clock/time.clock.hires/now.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.clock/time.clock.hires/now.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,22 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// high_resolution_clock
// static time_point now();
#include <chrono>
int main()
{
typedef std::chrono::high_resolution_clock C;
C::time_point t1 = C::now();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// high_resolution_clock
+
+// static time_point now();
+
+#include <chrono>
+
+int main()
+{
+ typedef std::chrono::high_resolution_clock C;
+ C::time_point t1 = C::now();
+}
Modified: libcxx/trunk/test/utilities/time/time.clock/time.clock.monotonic/consistency.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.clock/time.clock.monotonic/consistency.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.clock/time.clock.monotonic/consistency.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.clock/time.clock.monotonic/consistency.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// monotonic_clock
// check clock invariants
#include <chrono>
int main()
{
typedef std::chrono::monotonic_clock C;
static_assert((std::is_same<C::rep, C::duration::rep>::value), "");
static_assert((std::is_same<C::period, C::duration::period>::value), "");
static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");
static_assert(C::is_monotonic, "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// monotonic_clock
+
+// check clock invariants
+
+#include <chrono>
+
+int main()
+{
+ typedef std::chrono::monotonic_clock C;
+ static_assert((std::is_same<C::rep, C::duration::rep>::value), "");
+ static_assert((std::is_same<C::period, C::duration::period>::value), "");
+ static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");
+ static_assert(C::is_monotonic, "");
+}
Modified: libcxx/trunk/test/utilities/time/time.clock/time.clock.monotonic/now.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.clock/time.clock.monotonic/now.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.clock/time.clock.monotonic/now.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.clock/time.clock.monotonic/now.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// monotonic_clock
// static time_point now();
#include <chrono>
#include <cassert>
int main()
{
typedef std::chrono::monotonic_clock C;
C::time_point t1 = C::now();
C::time_point t2 = C::now();
assert(t2 >= t1);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// monotonic_clock
+
+// static time_point now();
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ typedef std::chrono::monotonic_clock C;
+ C::time_point t1 = C::now();
+ C::time_point t2 = C::now();
+ assert(t2 >= t1);
+}
Modified: libcxx/trunk/test/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.clock/time.clock.system/consistency.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.clock/time.clock.system/consistency.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.clock/time.clock.system/consistency.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// system_clock
// check clock invariants
#include <chrono>
int main()
{
typedef std::chrono::system_clock C;
static_assert((std::is_same<C::rep, C::duration::rep>::value), "");
static_assert((std::is_same<C::period, C::duration::period>::value), "");
static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");
static_assert((std::is_same<C::time_point::clock, C>::value), "");
static_assert((C::is_monotonic || !C::is_monotonic), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// system_clock
+
+// check clock invariants
+
+#include <chrono>
+
+int main()
+{
+ typedef std::chrono::system_clock C;
+ static_assert((std::is_same<C::rep, C::duration::rep>::value), "");
+ static_assert((std::is_same<C::period, C::duration::period>::value), "");
+ static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");
+ static_assert((std::is_same<C::time_point::clock, C>::value), "");
+ static_assert((C::is_monotonic || !C::is_monotonic), "");
+}
Modified: libcxx/trunk/test/utilities/time/time.clock/time.clock.system/from_time_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.clock/time.clock.system/from_time_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.clock/time.clock.system/from_time_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.clock/time.clock.system/from_time_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,23 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// system_clock
// static time_point from_time_t(time_t t);
#include <chrono>
#include <ctime>
int main()
{
typedef std::chrono::system_clock C;
C::time_point t1 = C::from_time_t(C::to_time_t(C::now()));
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// system_clock
+
+// static time_point from_time_t(time_t t);
+
+#include <chrono>
+#include <ctime>
+
+int main()
+{
+ typedef std::chrono::system_clock C;
+ C::time_point t1 = C::from_time_t(C::to_time_t(C::now()));
+}
Modified: libcxx/trunk/test/utilities/time/time.clock/time.clock.system/now.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.clock/time.clock.system/now.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.clock/time.clock.system/now.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.clock/time.clock.system/now.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,22 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// system_clock
// static time_point now();
#include <chrono>
int main()
{
typedef std::chrono::system_clock C;
C::time_point t1 = C::now();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// system_clock
+
+// static time_point now();
+
+#include <chrono>
+
+int main()
+{
+ typedef std::chrono::system_clock C;
+ C::time_point t1 = C::now();
+}
Modified: libcxx/trunk/test/utilities/time/time.clock/time.clock.system/rep_signed.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.clock/time.clock.system/rep_signed.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.clock/time.clock.system/rep_signed.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.clock/time.clock.system/rep_signed.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,23 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// system_clock
// rep should be signed
#include <chrono>
#include <cassert>
int main()
{
assert(std::chrono::system_clock::duration::min() <
std::chrono::system_clock::duration::zero());
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// system_clock
+
+// rep should be signed
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ assert(std::chrono::system_clock::duration::min() <
+ std::chrono::system_clock::duration::zero());
+}
Modified: libcxx/trunk/test/utilities/time/time.clock/time.clock.system/to_time_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.clock/time.clock.system/to_time_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.clock/time.clock.system/to_time_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.clock/time.clock.system/to_time_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,23 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// system_clock
// time_t to_time_t(const time_point& t);
#include <chrono>
#include <ctime>
int main()
{
typedef std::chrono::system_clock C;
std::time_t t1 = C::to_time_t(C::now());
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// system_clock
+
+// time_t to_time_t(const time_point& t);
+
+#include <chrono>
+#include <ctime>
+
+int main()
+{
+ typedef std::chrono::system_clock C;
+ std::time_t t1 = C::to_time_t(C::now());
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/default_ratio.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/default_ratio.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/default_ratio.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/default_ratio.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// Test default template arg:
// template <class Rep, class Period = ratio<1>>
// class duration;
#include <chrono>
#include <type_traits>
int main()
{
static_assert((std::is_same<std::chrono::duration<int, std::ratio<1> >,
std::chrono::duration<int> >::value), "");
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// Test default template arg:
+
+// template <class Rep, class Period = ratio<1>>
+// class duration;
+
+#include <chrono>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_same<std::chrono::duration<int, std::ratio<1> >,
+ std::chrono::duration<int> >::value), "");
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/duration.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/duration.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/duration.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/duration.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,23 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// If a program instantiates duration with a duration type for the template
// argument Rep a diagnostic is required.
#include <chrono>
int main()
{
typedef std::chrono::duration<std::chrono::milliseconds> D;
D d;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// If a program instantiates duration with a duration type for the template
+// argument Rep a diagnostic is required.
+
+#include <chrono>
+
+int main()
+{
+ typedef std::chrono::duration<std::chrono::milliseconds> D;
+ D d;
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/positive_num.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/positive_num.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/positive_num.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/positive_num.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,22 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// Period::num shall be positive, diagnostic required.
#include <chrono>
int main()
{
typedef std::chrono::duration<int, std::ratio<5, -1> > D;
D d;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// Period::num shall be positive, diagnostic required.
+
+#include <chrono>
+
+int main()
+{
+ typedef std::chrono::duration<int, std::ratio<5, -1> > D;
+ D d;
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/ratio.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/ratio.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/ratio.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/ratio.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,30 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// Period shall be a specialization of ratio, diagnostic required.
#include <chrono>
template <int N, int D = 1>
class Ratio
{
public:
static const int num = N;
static const int den = D;
};
int main()
{
typedef std::chrono::duration<int, Ratio<1> > D;
D d;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// Period shall be a specialization of ratio, diagnostic required.
+
+#include <chrono>
+
+template <int N, int D = 1>
+class Ratio
+{
+public:
+ static const int num = N;
+ static const int den = D;
+};
+
+int main()
+{
+ typedef std::chrono::duration<int, Ratio<1> > D;
+ D d;
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_%2B%2B.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration& operator++();
#include <chrono>
#include <cassert>
int main()
{
std::chrono::hours h(3);
std::chrono::hours& href = ++h;
assert(&href == &h);
assert(h.count() == 4);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration& operator++();
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::hours h(3);
+ std::chrono::hours& href = ++h;
+ assert(&href == &h);
+ assert(h.count() == 4);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_%2B%2Bint.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration operator++(int);
#include <chrono>
#include <cassert>
int main()
{
std::chrono::hours h(3);
std::chrono::hours h2 = h++;
assert(h.count() == 4);
assert(h2.count() == 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration operator++(int);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::hours h(3);
+ std::chrono::hours h2 = h++;
+ assert(h.count() == 4);
+ assert(h2.count() == 3);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_%2B.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration operator+() const;
#include <chrono>
#include <cassert>
int main()
{
const std::chrono::minutes m(3);
std::chrono::minutes m2 = +m;
assert(m.count() == m2.count());
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration operator+() const;
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ const std::chrono::minutes m(3);
+ std::chrono::minutes m2 = +m;
+ assert(m.count() == m2.count());
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_%2B%3D.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration& operator+=(const duration& d);
#include <chrono>
#include <cassert>
int main()
{
std::chrono::seconds s(3);
s += std::chrono::seconds(2);
assert(s.count() == 5);
s += std::chrono::minutes(2);
assert(s.count() == 125);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration& operator+=(const duration& d);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::seconds s(3);
+ s += std::chrono::seconds(2);
+ assert(s.count() == 5);
+ s += std::chrono::minutes(2);
+ assert(s.count() == 125);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_--.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_--.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_--.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_--.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration& operator--();
#include <chrono>
#include <cassert>
int main()
{
std::chrono::hours h(3);
std::chrono::hours& href = --h;
assert(&href == &h);
assert(h.count() == 2);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration& operator--();
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::hours h(3);
+ std::chrono::hours& href = --h;
+ assert(&href == &h);
+ assert(h.count() == 2);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_--int.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_--int.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_--int.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_--int.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration operator--(int);
#include <chrono>
#include <cassert>
int main()
{
std::chrono::hours h(3);
std::chrono::hours h2 = h--;
assert(h.count() == 2);
assert(h2.count() == 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration operator--(int);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::hours h(3);
+ std::chrono::hours h2 = h--;
+ assert(h.count() == 2);
+ assert(h2.count() == 3);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration operator-() const;
#include <chrono>
#include <cassert>
int main()
{
const std::chrono::minutes m(3);
std::chrono::minutes m2 = -m;
assert(m2.count() == -m.count());
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration operator-() const;
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ const std::chrono::minutes m(3);
+ std::chrono::minutes m2 = -m;
+ assert(m2.count() == -m.count());
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_-=.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_-%3D.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_-=.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_-=.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration& operator-=(const duration& d);
#include <chrono>
#include <cassert>
int main()
{
std::chrono::seconds s(3);
s -= std::chrono::seconds(2);
assert(s.count() == 1);
s -= std::chrono::minutes(2);
assert(s.count() == -119);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration& operator-=(const duration& d);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::seconds s(3);
+ s -= std::chrono::seconds(2);
+ assert(s.count() == 1);
+ s -= std::chrono::minutes(2);
+ assert(s.count() == -119);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_divide=.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_divide%3D.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_divide=.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_divide=.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration& operator/=(const rep& rhs);
#include <chrono>
#include <cassert>
int main()
{
std::chrono::nanoseconds ns(15);
ns /= 5;
assert(ns.count() == 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration& operator/=(const rep& rhs);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::nanoseconds ns(15);
+ ns /= 5;
+ assert(ns.count() == 3);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_mod%3Dduration.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration& operator%=(const duration& rhs)
#include <chrono>
#include <cassert>
int main()
{
std::chrono::microseconds us(11);
std::chrono::microseconds us2(3);
us %= us2;
assert(us.count() == 2);
us %= std::chrono::milliseconds(3);
assert(us.count() == 2);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration& operator%=(const duration& rhs)
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::microseconds us(11);
+ std::chrono::microseconds us2(3);
+ us %= us2;
+ assert(us.count() == 2);
+ us %= std::chrono::milliseconds(3);
+ assert(us.count() == 2);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_mod%3Drep.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration& operator%=(const rep& rhs)
#include <chrono>
#include <cassert>
int main()
{
std::chrono::microseconds us(11);
us %= 3;
assert(us.count() == 2);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration& operator%=(const rep& rhs)
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::microseconds us(11);
+ us %= 3;
+ assert(us.count() == 2);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_times%3D.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration& operator*=(const rep& rhs);
#include <chrono>
#include <cassert>
int main()
{
std::chrono::nanoseconds ns(3);
ns *= 5;
assert(ns.count() == 15);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration& operator*=(const rep& rhs);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::nanoseconds ns(3);
+ ns *= 5;
+ assert(ns.count() == 15);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cast/duration_cast.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cast/duration_cast.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cast/duration_cast.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cast/duration_cast.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,43 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class ToDuration, class Rep, class Period>
// ToDuration
// duration_cast(const duration<Rep, Period>& d);
#include <chrono>
#include <type_traits>
#include <cassert>
template <class ToDuration, class FromDuration>
void
test(const FromDuration& f, const ToDuration& d)
{
typedef decltype(std::chrono::duration_cast<ToDuration>(f)) R;
static_assert((std::is_same<R, ToDuration>::value), "");
assert(std::chrono::duration_cast<ToDuration>(f) == d);
}
int main()
{
test(std::chrono::milliseconds(7265000), std::chrono::hours(2));
test(std::chrono::milliseconds(7265000), std::chrono:
:minutes(121));
test(std::chrono::milliseconds(7265000), std::chrono::seconds(7265));
test(std::chrono::milliseconds(7265000), std::chrono::milliseconds(7265000));
test(std::chrono::milliseconds(7265000), std::chrono::microseconds(7265000000LL));
test(std::chrono::milliseconds(7265000), std::chrono::nanoseconds(7265000000000LL));
test(std::chrono::milliseconds(7265000),
std::chrono::duration<double, std::ratio<3600> >(7265./3600));
test(std::chrono::duration<int, std::ratio<2, 3> >(9),
std::chrono::duration<int, std::ratio<3, 5> >(10));
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class ToDuration, class Rep, class Period>
+// ToDuration
+// duration_cast(const duration<Rep, Period>& d);
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+template <class ToDuration, class FromDuration>
+void
+test(const FromDuration& f, const ToDuration& d)
+{
+ typedef decltype(std::chrono::duration_cast<ToDuration>(f)) R;
+ static_assert((std::is_same<R, ToDuration>::value), "");
+ assert(std::chrono::duration_cast<ToDuration>(f) == d);
+}
+
+int main()
+{
+ test(std::chrono::milliseconds(7265000), std::chrono::hours(2));
+ test(std::chrono::milliseconds(7265000), std::chrono::minutes(121));
+ test(std::chrono::milliseconds(7265000), std::chrono::seconds(7265));
+ test(std::chrono::milliseconds(7265000), std::chrono::milliseconds(7265000));
+ test(std::chrono::milliseconds(7265000), std::chrono::microseconds(7265000000LL));
+ test(std::chrono::milliseconds(7265000), std::chrono::nanoseconds(7265000000000LL));
+ test(std::chrono::milliseconds(7265000),
+ std::chrono::duration<double, std::ratio<3600> >(7265./3600));
+ test(std::chrono::duration<int, std::ratio<2, 3> >(9),
+ std::chrono::duration<int, std::ratio<3, 5> >(10));
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cast/toduration.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cast/toduration.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cast/toduration.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cast/toduration.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class ToDuration, class Rep, class Period>
// ToDuration
// duration_cast(const duration<Rep, Period>& d);
// ToDuration shall be an instantiation of duration.
#include <chrono>
int main()
{
std::chrono::duration_cast<int>(std::chrono::milliseconds(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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class ToDuration, class Rep, class Period>
+// ToDuration
+// duration_cast(const duration<Rep, Period>& d);
+
+// ToDuration shall be an instantiation of duration.
+
+#include <chrono>
+
+int main()
+{
+ std::chrono::duration_cast<int>(std::chrono::milliseconds(3));
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.comparisons/op_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.comparisons/op_equal.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.comparisons/op_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.comparisons/op_equal.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,69 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep1, class Period1, class Rep2, class Period2>
// bool
// operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// template <class Rep1, class Period1, class Rep2, class Period2>
// bool
// operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
#include <chrono>
#include <cassert>
int main()
{
{
std::chrono::seconds s1(3);
std::chrono::seconds s2(3);
assert(s1 == s2);
assert(!(s1 != s2));
}
{
std::chrono::seconds s1(3);
std::chrono::seconds s2(4);
assert(!(s1 == s2));
assert(s1 !=
s2);
}
{
std::chrono::milliseconds s1(3);
std::chrono::microseconds s2(3000);
assert(s1 == s2);
assert(!(s1 != s2));
}
{
std::chrono::milliseconds s1(3);
std::chrono::microseconds s2(4000);
assert(!(s1 == s2));
assert(s1 != s2);
}
{
std::chrono::duration<int, std::ratio<2, 3> > s1(9);
std::chrono::duration<int, std::ratio<3, 5> > s2(10);
assert(s1 == s2);
assert(!(s1 != s2));
}
{
std::chrono::duration<int, std::ratio<2, 3> > s1(10);
std::chrono::duration<int, std::ratio<3, 5> > s2(9);
assert(!(s1 == s2));
assert(s1 != s2);
}
{
std::chrono::duration<int, std::ratio<2, 3> > s1(9);
std::chrono::duration<double, std::ratio<3, 5> > s2(10);
assert(s1 == s2);
assert(!(s1 != s2));
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ {
+ std::chrono::seconds s1(3);
+ std::chrono::seconds s2(3);
+ assert(s1 == s2);
+ assert(!(s1 != s2));
+ }
+ {
+ std::chrono::seconds s1(3);
+ std::chrono::seconds s2(4);
+ assert(!(s1 == s2));
+ assert(s1 != s2);
+ }
+ {
+ std::chrono::milliseconds s1(3);
+ std::chrono::microseconds s2(3000);
+ assert(s1 == s2);
+ assert(!(s1 != s2));
+ }
+ {
+ std::chrono::milliseconds s1(3);
+ std::chrono::microseconds s2(4000);
+ assert(!(s1 == s2));
+ assert(s1 != s2);
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(9);
+ std::chrono::duration<int, std::ratio<3, 5> > s2(10);
+ assert(s1 == s2);
+ assert(!(s1 != s2));
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(10);
+ std::chrono::duration<int, std::ratio<3, 5> > s2(9);
+ assert(!(s1 == s2));
+ assert(s1 != s2);
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(9);
+ std::chrono::duration<double, std::ratio<3, 5> > s2(10);
+ assert(s1 == s2);
+ assert(!(s1 != s2));
+ }
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.comparisons/op_less.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.comparisons/op_less.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.comparisons/op_less.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.comparisons/op_less.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,91 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep1, class Period1, class Rep2, class Period2>
// bool
// operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// template <class Rep1, class Period1, class Rep2, class Period2>
// bool
// operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// template <class Rep1, class Period1, class Rep2, class Period2>
// bool
// operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// template <class Rep1, class Period1, class Rep2, class Period2>
// bool
// operator>=(const duration<Rep1, Pe
riod1>& lhs, const duration<Rep2, Period2>& rhs);
#include <chrono>
#include <cassert>
int main()
{
{
std::chrono::seconds s1(3);
std::chrono::seconds s2(3);
assert(!(s1 < s2));
assert(!(s1 > s2));
assert( (s1 <= s2));
assert( (s1 >= s2));
}
{
std::chrono::seconds s1(3);
std::chrono::seconds s2(4);
assert( (s1 < s2));
assert(!(s1 > s2));
assert( (s1 <= s2));
assert(!(s1 >= s2));
}
{
std::chrono::milliseconds s1(3);
std::chrono::microseconds s2(3000);
assert(!(s1 < s2));
assert(!(s1 > s2));
assert( (s1 <= s2));
assert( (s1 >= s2));
}
{
std::chrono::milliseconds s1(3);
std::chrono::microseconds s2(4000);
assert( (s1 < s2));
assert(!(s1 > s2));
assert( (s1 <= s2));
assert(!(s1 >= s2));
}
{
std::chrono::duration<int, std::ratio<2, 3> > s1(9);
std::chrono::duration<int, std::ratio<3, 5> > s2(10);
assert(!(s1 < s2));
assert(!(s1 > s2
));
assert( (s1 <= s2));
assert( (s1 >= s2));
}
{
std::chrono::duration<int, std::ratio<2, 3> > s1(10);
std::chrono::duration<int, std::ratio<3, 5> > s2(9);
assert(!(s1 < s2));
assert( (s1 > s2));
assert(!(s1 <= s2));
assert( (s1 >= s2));
}
{
std::chrono::duration<int, std::ratio<2, 3> > s1(9);
std::chrono::duration<double, std::ratio<3, 5> > s2(10);
assert(!(s1 < s2));
assert(!(s1 > s2));
assert( (s1 <= s2));
assert( (s1 >= s2));
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ {
+ std::chrono::seconds s1(3);
+ std::chrono::seconds s2(3);
+ assert(!(s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert( (s1 >= s2));
+ }
+ {
+ std::chrono::seconds s1(3);
+ std::chrono::seconds s2(4);
+ assert( (s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert(!(s1 >= s2));
+ }
+ {
+ std::chrono::milliseconds s1(3);
+ std::chrono::microseconds s2(3000);
+ assert(!(s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert( (s1 >= s2));
+ }
+ {
+ std::chrono::milliseconds s1(3);
+ std::chrono::microseconds s2(4000);
+ assert( (s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert(!(s1 >= s2));
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(9);
+ std::chrono::duration<int, std::ratio<3, 5> > s2(10);
+ assert(!(s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert( (s1 >= s2));
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(10);
+ std::chrono::duration<int, std::ratio<3, 5> > s2(9);
+ assert(!(s1 < s2));
+ assert( (s1 > s2));
+ assert(!(s1 <= s2));
+ assert( (s1 >= s2));
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(9);
+ std::chrono::duration<double, std::ratio<3, 5> > s2(10);
+ assert(!(s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert( (s1 >= s2));
+ }
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_exact.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_exact.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_exact.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_exact.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep2, class Period2>
// duration(const duration<Rep2, Period2>& d);
// exact conversions allowed for integral reps
#include <chrono>
#include <cassert>
int main()
{
std::chrono::milliseconds ms(1);
std::chrono::microseconds us = ms;
assert(us.count() == 1000);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2, class Period2>
+// duration(const duration<Rep2, Period2>& d);
+
+// exact conversions allowed for integral reps
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::milliseconds ms(1);
+ std::chrono::microseconds us = ms;
+ assert(us.count() == 1000);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_float_to_int.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_float_to_int.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_float_to_int.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_float_to_int.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep2, class Period2>
// duration(const duration<Rep2, Period2>& d);
// conversions from floating point to integral durations disallowed
#include <chrono>
int main()
{
std::chrono::duration<double> d;
std::chrono::duration<int> i = d;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2, class Period2>
+// duration(const duration<Rep2, Period2>& d);
+
+// conversions from floating point to integral durations disallowed
+
+#include <chrono>
+
+int main()
+{
+ std::chrono::duration<double> d;
+ std::chrono::duration<int> i = d;
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_inexact.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_inexact.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_inexact.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_inexact.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep2, class Period2>
// duration(const duration<Rep2, Period2>& d);
// inexact conversions disallowed for integral reps
#include <chrono>
int main()
{
std::chrono::microseconds us(1);
std::chrono::milliseconds ms = us;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2, class Period2>
+// duration(const duration<Rep2, Period2>& d);
+
+// inexact conversions disallowed for integral reps
+
+#include <chrono>
+
+int main()
+{
+ std::chrono::microseconds us(1);
+ std::chrono::milliseconds ms = us;
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_inexact.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_inexact.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_inexact.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_inexact.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep2, class Period2>
// duration(const duration<Rep2, Period2>& d);
// inexact conversions allowed for floating point reps
#include <chrono>
#include <cassert>
int main()
{
std::chrono::duration<double, std::micro> us(1);
std::chrono::duration<double, std::milli> ms = us;
assert(ms.count() == 1./1000);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2, class Period2>
+// duration(const duration<Rep2, Period2>& d);
+
+// inexact conversions allowed for floating point reps
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::duration<double, std::micro> us(1);
+ std::chrono::duration<double, std::milli> ms = us;
+ assert(ms.count() == 1./1000);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_int_to_float.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_int_to_float.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_int_to_float.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_int_to_float.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep2, class Period2>
// duration(const duration<Rep2, Period2>& d);
// conversions from integral to floating point durations allowed
#include <chrono>
#include <cassert>
int main()
{
std::chrono::duration<int> i(3);
std::chrono::duration<int> d = i;
assert(d.count() == 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2, class Period2>
+// duration(const duration<Rep2, Period2>& d);
+
+// conversions from integral to floating point durations allowed
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::duration<int> i(3);
+ std::chrono::duration<int> d = i;
+ assert(d.count() == 3);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/default.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/default.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,34 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// duration() = default;
// Rep must be default initialized, not initialized with 0
#include <chrono>
#include <cassert>
#include "../../rep.h"
template <class D>
void
test()
{
D d;
assert(d.count() == typename D::rep());
}
int main()
{
test<std::chrono::duration<Rep> >();
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// duration() = default;
+
+// Rep must be default initialized, not initialized with 0
+
+#include <chrono>
+#include <cassert>
+
+#include "../../rep.h"
+
+template <class D>
+void
+test()
+{
+ D d;
+ assert(d.count() == typename D::rep());
+}
+
+int main()
+{
+ test<std::chrono::duration<Rep> >();
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,36 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep2>
// explicit duration(const Rep2& r);
#include <chrono>
#include <cassert>
#include "../../rep.h"
template <class D, class R>
void
test(R r)
{
D d(r);
assert(d.count() == r);
}
int main()
{
test<std::chrono::duration<int> >(5);
test<std::chrono::duration<int, std::ratio<3, 2> > >(5);
test<std::chrono::duration<Rep, std::ratio<3, 2> > >(Rep(3));
test<std::chrono::duration<double, std::ratio<2, 3> > >(5.5);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2>
+// explicit duration(const Rep2& r);
+
+#include <chrono>
+#include <cassert>
+
+#include "../../rep.h"
+
+template <class D, class R>
+void
+test(R r)
+{
+ D d(r);
+ assert(d.count() == r);
+}
+
+int main()
+{
+ test<std::chrono::duration<int> >(5);
+ test<std::chrono::duration<int, std::ratio<3, 2> > >(5);
+ test<std::chrono::duration<Rep, std::ratio<3, 2> > >(Rep(3));
+ test<std::chrono::duration<double, std::ratio<2, 3> > >(5.5);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep2>
// explicit duration(const Rep2& r);
// test for explicit
#include <chrono>
#include "../../rep.h"
int main()
{
std::chrono::duration<int> d = 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2>
+// explicit duration(const Rep2& r);
+
+// test for explicit
+
+#include <chrono>
+
+#include "../../rep.h"
+
+int main()
+{
+ std::chrono::duration<int> d = 1;
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep2>
// explicit duration(const Rep2& r);
// Rep2 shall be implicitly convertible to rep
#include <chrono>
#include "../../rep.h"
int main()
{
std::chrono::duration<Rep> d(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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2>
+// explicit duration(const Rep2& r);
+
+// Rep2 shall be implicitly convertible to rep
+
+#include <chrono>
+
+#include "../../rep.h"
+
+int main()
+{
+ std::chrono::duration<Rep> d(1);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep02.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep02.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep2>
// explicit duration(const Rep2& r);
// construct double with int
#include <chrono>
#include <cassert>
int main()
{
std::chrono::duration<double> d(5);
assert(d.count() == 5);
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2>
+// explicit duration(const Rep2& r);
+
+// construct double with int
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::duration<double> d(5);
+ assert(d.count() == 5);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep2>
// explicit duration(const Rep2& r);
// treat_as_floating_point<Rep2>::value shall be false
#include <chrono>
int main()
{
std::chrono::duration<int> d(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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2>
+// explicit duration(const Rep2& r);
+
+// treat_as_floating_point<Rep2>::value shall be false
+
+#include <chrono>
+
+int main()
+{
+ std::chrono::duration<int> d(1.);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_+.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_%2B.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_+.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_+.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,47 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep1, class Period1, class Rep2, class Period2>
// typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
// operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
#include <chrono>
#include <cassert>
int main()
{
{
std::chrono::seconds s1(3);
std::chrono::seconds s2(5);
std::chrono::seconds r = s1 + s2;
assert(r.count() == 8);
}
{
std::chrono::seconds s1(3);
std::chrono::microseconds s2(5);
std::chrono::microseconds r = s1 + s2;
assert(r.count() == 3000005);
}
{
std::chrono::duratio
n<int, std::ratio<2, 3> > s1(3);
std::chrono::duration<int, std::ratio<3, 5> > s2(5);
std::chrono::duration<int, std::ratio<1, 15> > r = s1 + s2;
assert(r.count() == 75);
}
{
std::chrono::duration<int, std::ratio<2, 3> > s1(3);
std::chrono::duration<double, std::ratio<3, 5> > s2(5);
std::chrono::duration<double, std::ratio<1, 15> > r = s1 + s2;
assert(r.count() == 75);
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
+// operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ {
+ std::chrono::seconds s1(3);
+ std::chrono::seconds s2(5);
+ std::chrono::seconds r = s1 + s2;
+ assert(r.count() == 8);
+ }
+ {
+ std::chrono::seconds s1(3);
+ std::chrono::microseconds s2(5);
+ std::chrono::microseconds r = s1 + s2;
+ assert(r.count() == 3000005);
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(3);
+ std::chrono::duration<int, std::ratio<3, 5> > s2(5);
+ std::chrono::duration<int, std::ratio<1, 15> > r = s1 + s2;
+ assert(r.count() == 75);
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(3);
+ std::chrono::duration<double, std::ratio<3, 5> > s2(5);
+ std::chrono::duration<double, std::ratio<1, 15> > r = s1 + s2;
+ assert(r.count() == 75);
+ }
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_-.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_-.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_-.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_-.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,47 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep1, class Period1, class Rep2, class Period2>
// typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
// operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
#include <chrono>
#include <cassert>
int main()
{
{
std::chrono::seconds s1(3);
std::chrono::seconds s2(5);
std::chrono::seconds r = s1 - s2;
assert(r.count() == -2);
}
{
std::chrono::seconds s1(3);
std::chrono::microseconds s2(5);
std::chrono::microseconds r = s1 - s2;
assert(r.count() == 2999995);
}
{
std::chrono::durati
on<int, std::ratio<2, 3> > s1(3);
std::chrono::duration<int, std::ratio<3, 5> > s2(5);
std::chrono::duration<int, std::ratio<1, 15> > r = s1 - s2;
assert(r.count() == -15);
}
{
std::chrono::duration<int, std::ratio<2, 3> > s1(3);
std::chrono::duration<double, std::ratio<3, 5> > s2(5);
std::chrono::duration<double, std::ratio<1, 15> > r = s1 - s2;
assert(r.count() == -15);
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
+// operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ {
+ std::chrono::seconds s1(3);
+ std::chrono::seconds s2(5);
+ std::chrono::seconds r = s1 - s2;
+ assert(r.count() == -2);
+ }
+ {
+ std::chrono::seconds s1(3);
+ std::chrono::microseconds s2(5);
+ std::chrono::microseconds r = s1 - s2;
+ assert(r.count() == 2999995);
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(3);
+ std::chrono::duration<int, std::ratio<3, 5> > s2(5);
+ std::chrono::duration<int, std::ratio<1, 15> > r = s1 - s2;
+ assert(r.count() == -15);
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(3);
+ std::chrono::duration<double, std::ratio<3, 5> > s2(5);
+ std::chrono::duration<double, std::ratio<1, 15> > r = s1 - s2;
+ assert(r.count() == -15);
+ }
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,43 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep1, class Period1, class Rep2, class Period2>
// typename common_type<Rep1, Rep2>::type
// operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
#include <chrono>
#include <cassert>
int main()
{
{
std::chrono::nanoseconds ns1(15);
std::chrono::nanoseconds ns2(5);
assert(ns1 / ns2 == 3);
}
{
std::chrono::microseconds us1(15);
std::chrono::nanoseconds ns2(5);
assert(us1 / ns2 == 3000);
}
{
std::chrono::duration<int, std::ratio<2, 3> > s1(30);
std::chrono::duration<int, std::ratio<3, 5> > s2(5);
assert(s1
/ s2 == 6);
}
{
std::chrono::duration<int, std::ratio<2, 3> > s1(30);
std::chrono::duration<double, std::ratio<3, 5> > s2(5);
assert(s1 / s2 == 20./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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// typename common_type<Rep1, Rep2>::type
+// operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ {
+ std::chrono::nanoseconds ns1(15);
+ std::chrono::nanoseconds ns2(5);
+ assert(ns1 / ns2 == 3);
+ }
+ {
+ std::chrono::microseconds us1(15);
+ std::chrono::nanoseconds ns2(5);
+ assert(us1 / ns2 == 3000);
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(30);
+ std::chrono::duration<int, std::ratio<3, 5> > s2(5);
+ assert(s1 / s2 == 6);
+ }
+ {
+ std::chrono::duration<int, std::ratio<2, 3> > s1(30);
+ std::chrono::duration<double, std::ratio<3, 5> > s2(5);
+ assert(s1 / s2 == 20./3);
+ }
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep1, class Period, class Rep2>
// duration<typename common_type<Rep1, Rep2>::type, Period>
// operator/(const duration<Rep1, Period>& d, const Rep2& s);
#include <chrono>
#include "../../rep.h"
int main()
{
std::chrono::duration<Rep> d(Rep(15));
d = d / 5;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator/(const duration<Rep1, Period>& d, const Rep2& s);
+
+#include <chrono>
+
+#include "../../rep.h"
+
+int main()
+{
+ std::chrono::duration<Rep> d(Rep(15));
+ d = d / 5;
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep1, class Period, class Rep2>
// duration<typename common_type<Rep1, Rep2>::type, Period>
// operator/(const duration<Rep1, Period>& d, const Rep2& s);
#include <chrono>
#include <cassert>
int main()
{
std::chrono::nanoseconds ns(15);
ns = ns / 5;
assert(ns.count() == 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator/(const duration<Rep1, Period>& d, const Rep2& s);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ std::chrono::nanoseconds ns(15);
+ ns = ns / 5;
+ assert(ns.count() == 3);
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,41 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep1, class Period1, class Rep2, class Period2>
// typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
// operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
#include <chrono>
#include <cassert>
int main()
{
{
std::chrono::nanoseconds ns1(15);
std::chrono::nanoseconds ns2(6);
std::chrono::nanoseconds r = ns1 % ns2;
assert(r.count() == 3);
}
{
std::chrono::microseconds us1(15);
std::chrono::nanoseconds ns2(28);
std::chrono::nanoseconds r = us1 % ns2;
assert(r.count() == 20);
}
{
std::chrono::duration<int, std::ratio<3, 5> > s1(6);
std::chrono::duration<int, std::ratio<2, 3> > s2(3);
std::chrono::duration<int, std::ratio<1, 15> > r = s1 % s2;
assert(r.count() == 24);
}
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
+// operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ {
+ std::chrono::nanoseconds ns1(15);
+ std::chrono::nanoseconds ns2(6);
+ std::chrono::nanoseconds r = ns1 % ns2;
+ assert(r.count() == 3);
+ }
+ {
+ std::chrono::microseconds us1(15);
+ std::chrono::nanoseconds ns2(28);
+ std::chrono::nanoseconds r = us1 % ns2;
+ assert(r.count() == 20);
+ }
+ {
+ std::chrono::duration<int, std::ratio<3, 5> > s1(6);
+ std::chrono::duration<int, std::ratio<2, 3> > s2(3);
+ std::chrono::duration<int, std::ratio<1, 15> > r = s1 % s2;
+ assert(r.count() == 24);
+ }
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_mod_rep.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_mod_rep.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_mod_rep.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_mod_rep.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <chrono>
// duration
// template <class Rep1, class Period, class Rep2>
// duration<typename common_type<Rep1, Rep2>::type, Period>
// operator%(const duration<Rep1, Period>& d, const Rep2& s)
#include <chrono>
#include "../../rep.h"
int main()
{
std::chrono::duration<Rep> d(Rep(15));
d = d % 5;
}
\ 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator%(const duration<Rep1, Period>& d, const Rep2& s)
+
+#include <chrono>
+
+#include "../../rep.h"
+
+int main()
+{
+ std::chrono::duration<Rep> d(Rep(15));
+ d = d % 5;
+}
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp Sat Aug 21 19:59:46 2010
@@ -11,12 +11,12 @@
// duration
-// template <class Rep1, class Period, class Rep2>
-// duration<typename common_type<Rep1, Rep2>::type, Period>
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
// operator*(const duration<Rep1, Period>& d, const Rep2& s);
-// template <class Rep1, class Period, class Rep2>
-// duration<typename common_type<Rep1, Rep2>::type, Period>
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
// operator*(const Rep1& s, const duration<Rep2, Period>& d);
#include <chrono>
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep1.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep1.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep1.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep1.fail.cpp Sat Aug 21 19:59:46 2010
@@ -11,12 +11,12 @@
// duration
-// template <class Rep1, class Period, class Rep2>
-// duration<typename common_type<Rep1, Rep2>::type, Period>
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
// operator*(const duration<Rep1, Period>& d, const Rep2& s);
-// template <class Rep1, class Period, class Rep2>
-// duration<typename common_type<Rep1, Rep2>::type, Period>
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
// operator*(const Rep1& s, const duration<Rep2, Period>& d);
#include <chrono>
Modified: libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep2.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep2.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep2.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep2.fail.cpp Sat Aug 21 19:59:46 2010
@@ -11,12 +11,12 @@
// duration
-// template <class Rep1, class Period, class Rep2>
-// duration<typename common_type<Rep1, Rep2>::type, Period>
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
// operator*(const duration<Rep1, Period>& d, const Rep2& s);
-// template <class Rep1, class Period, class Rep2>
-// duration<typename common_type<Rep1, Rep2>::type, Period>
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
// operator*(const Rep1& s, const duration<Rep2, Period>& d);
#include <chrono>
Modified: libcxx/trunk/test/utilities/time/time.duration/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.duration/types.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.duration/types.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.duration/types.pass.cpp Sat Aug 21 19:59:46 2010
@@ -13,8 +13,8 @@
// Test nested types
-// typedef Rep rep;
-// typedef Period period;
+// typedef Rep rep;
+// typedef Period period;
#include <chrono>
#include <type_traits>
Modified: libcxx/trunk/test/utilities/time/time.point/default_duration.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/default_duration.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/default_duration.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/default_duration.pass.cpp Sat Aug 21 19:59:46 2010
@@ -13,7 +13,7 @@
// Test default template arg:
-// template <class Clock, class Duration = typename Clock::duration>
+// template <class Clock, class Duration = typename Clock::duration>
// class time_point;
#include <chrono>
Modified: libcxx/trunk/test/utilities/time/time.point/time.point.cast/time_point_cast.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/time.point.cast/time_point_cast.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/time.point.cast/time_point_cast.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/time.point.cast/time_point_cast.pass.cpp Sat Aug 21 19:59:46 2010
@@ -11,7 +11,7 @@
// time_point
-// template <class ToDuration, class Clock, class Duration>
+// template <class ToDuration, class Clock, class Duration>
// time_point<Clock, ToDuration>
// time_point_cast(const time_point<Clock, Duration>& t);
Modified: libcxx/trunk/test/utilities/time/time.point/time.point.cast/toduration.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/time.point.cast/toduration.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/time.point.cast/toduration.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/time.point.cast/toduration.fail.cpp Sat Aug 21 19:59:46 2010
@@ -11,7 +11,7 @@
// time_point
-// template <class ToDuration, class Clock, class Duration>
+// template <class ToDuration, class Clock, class Duration>
// time_point<Clock, ToDuration>
// time_point_cast(const time_point<Clock, Duration>& t);
Modified: libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_equal.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_equal.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_equal.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_equal.fail.cpp Sat Aug 21 19:59:46 2010
@@ -11,11 +11,11 @@
// time_point
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
Modified: libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp Sat Aug 21 19:59:46 2010
@@ -11,11 +11,11 @@
// time_point
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
Modified: libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_less.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_less.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_less.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_less.fail.cpp Sat Aug 21 19:59:46 2010
@@ -11,19 +11,19 @@
// time_point
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
Modified: libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_less.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_less.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_less.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_less.pass.cpp Sat Aug 21 19:59:46 2010
@@ -11,19 +11,19 @@
// time_point
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// bool
// operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
Modified: libcxx/trunk/test/utilities/time/time.point/time.point.cons/convert.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/time.point.cons/convert.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/time.point.cons/convert.fail.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/time.point.cons/convert.fail.cpp Sat Aug 21 19:59:46 2010
@@ -11,7 +11,7 @@
// time_point
-// template <class Duration2>
+// template <class Duration2>
// time_point(const time_point<clock, Duration2>& t);
// Duration2 shall be implicitly convertible to duration.
Modified: libcxx/trunk/test/utilities/time/time.point/time.point.cons/convert.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/time.point.cons/convert.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/time.point.cons/convert.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/time.point.cons/convert.pass.cpp Sat Aug 21 19:59:46 2010
@@ -11,7 +11,7 @@
// time_point
-// template <class Duration2>
+// template <class Duration2>
// time_point(const time_point<clock, Duration2>& t);
#include <chrono>
Modified: libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_+.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_%2B.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_+.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_+.pass.cpp Sat Aug 21 19:59:46 2010
@@ -11,12 +11,12 @@
// time_point
-// template <class Clock, class Duration1, class Rep2, class Period2>
-// time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
+// template <class Clock, class Duration1, class Rep2, class Period2>
+// time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
// operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
-// template <class Rep1, class Period1, class Clock, class Duration2>
-// time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
+// template <class Rep1, class Period1, class Clock, class Duration2>
+// time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
// operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
#include <chrono>
Modified: libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_-duration.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_-duration.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_-duration.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_-duration.pass.cpp Sat Aug 21 19:59:46 2010
@@ -11,8 +11,8 @@
// time_point
-// template <class Clock, class Duration1, class Rep2, class Period2>
-// time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
+// template <class Clock, class Duration1, class Rep2, class Period2>
+// time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
// operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
#include <chrono>
Modified: libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_-time_point.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_-time_point.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_-time_point.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_-time_point.pass.cpp Sat Aug 21 19:59:46 2010
@@ -11,8 +11,8 @@
// time_point
-// template <class Clock, class Duration1, class Duration2>
-// typename common_type<Duration1, Duration2>::type
+// template <class Clock, class Duration1, class Duration2>
+// typename common_type<Duration1, Duration2>::type
// operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
#include <chrono>
Modified: libcxx/trunk/test/utilities/time/time.traits/time.traits.specializations/duration.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.traits/time.traits.specializations/duration.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.traits/time.traits.specializations/duration.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.traits/time.traits.specializations/duration.pass.cpp Sat Aug 21 19:59:46 2010
@@ -9,10 +9,10 @@
// <chrono>
-// template <class Rep1, class Period1, class Rep2, class Period2>
+// template <class Rep1, class Period1, class Rep2, class Period2>
// struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>
// {
-// typedef chrono::duration<typename common_type<Rep1, Rep2>::type, see below }> type;
+// typedef chrono::duration<typename common_type<Rep1, Rep2>::type, see below }> type;
// };
#include <chrono>
Modified: libcxx/trunk/test/utilities/time/time.traits/time.traits.specializations/time_point.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/time/time.traits/time.traits.specializations/time_point.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/time/time.traits/time.traits.specializations/time_point.pass.cpp (original)
+++ libcxx/trunk/test/utilities/time/time.traits/time.traits.specializations/time_point.pass.cpp Sat Aug 21 19:59:46 2010
@@ -9,10 +9,10 @@
// <chrono>
-// template <class Clock, class Duration1, class Duration2>
+// template <class Clock, class Duration1, class Duration2>
// struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>
-// {
-// typedef chrono::time_point<Clock, typename common_type<Duration1, Duration2>::type> type;
+// {
+// typedef chrono::time_point<Clock, typename common_type<Duration1, Duration2>::type> type;
// };
#include <chrono>
Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/DefaultOnly.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/DefaultOnly.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/DefaultOnly.h (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/DefaultOnly.h Sat Aug 21 19:59:46 2010
@@ -23,4 +23,4 @@
int DefaultOnly::count = 0;
-#endif
+#endif // DEFAULTONLY_H
Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/MoveOnly.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/MoveOnly.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/MoveOnly.h (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/MoveOnly.h Sat Aug 21 19:59:46 2010
@@ -21,8 +21,8 @@
int get() const {return data_;}
- bool operator==(const MoveOnly& x) const {return data_ == x.data_;}
- bool operator< (const MoveOnly& x) const {return data_ < x.data_;}
+ bool operator==(const MoveOnly& x) const {return data_ == x.data_;}
+ bool operator< (const MoveOnly& x) const {return data_ < x.data_;}
};
namespace std {
@@ -36,6 +36,6 @@
}
-#endif
+#endif // _LIBCPP_MOVE
-#endif
+#endif // MOVEONLY_H
Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/alloc_first.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/alloc_first.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/alloc_first.h (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/alloc_first.h Sat Aug 21 19:59:46 2010
@@ -46,4 +46,4 @@
bool alloc_first::allocator_constructed = false;
-#endif
+#endif // ALLOC_FIRST_H
Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/alloc_last.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/alloc_last.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/alloc_last.h (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/alloc_last.h Sat Aug 21 19:59:46 2010
@@ -46,4 +46,4 @@
bool alloc_last::allocator_constructed = false;
-#endif
+#endif // ALLOC_LAST_H
Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/allocators.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/allocators.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/allocators.h (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/allocators.h Sat Aug 21 19:59:46 2010
@@ -150,8 +150,6 @@
A3 select_on_container_copy_construction() const {return A3(-1);}
};
-
-
template <class T> bool A3<T>::copy_called = false;
template <class T> bool A3<T>::move_called = false;
template <class T> bool A3<T>::constructed = false;
@@ -171,6 +169,6 @@
return !(x == y);
}
-#endif
+#endif // _LIBCPP_MOVE
-#endif
+#endif // ALLOCATORS_H
Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp Sat Aug 21 19:59:46 2010
@@ -34,7 +34,6 @@
explicit D(int i) : B(i) {}
};
-
int main()
{
{
Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp Sat Aug 21 19:59:46 2010
@@ -35,7 +35,7 @@
assert(std::get<1>(t) == 1);
}
{
- std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
+ std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
MoveOnly(0),
1, 2);
assert(std::get<0>(t) == 0);
@@ -55,14 +55,14 @@
}
// extensions
{
- std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
+ std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
0, 1);
assert(std::get<0>(t) == 0);
assert(std::get<1>(t) == 1);
assert(std::get<2>(t) == MoveOnly());
}
{
- std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
+ std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
0);
assert(std::get<0>(t) == 0);
assert(std::get<1>(t) == MoveOnly());
Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move_pair.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move_pair.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move_pair.pass.cpp (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move_pair.pass.cpp Sat Aug 21 19:59:46 2010
@@ -38,7 +38,6 @@
explicit D(int i) : B(i) {}
};
-
int main()
{
{
Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/move_pair.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/move_pair.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/move_pair.pass.cpp (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/move_pair.pass.cpp Sat Aug 21 19:59:46 2010
@@ -33,7 +33,6 @@
explicit D(int i) : B(i) {}
};
-
int main()
{
{
Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp Sat Aug 21 19:59:46 2010
@@ -12,7 +12,6 @@
// template<class... Types>
// tuple<Types&&...> forward_as_tuple(Types&&... t);
-
#include <tuple>
#include <cassert>
Modified: libcxx/trunk/test/utilities/utility/forward/forward.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/forward/forward.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/forward/forward.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/forward/forward.pass.cpp Sat Aug 21 19:59:46 2010
@@ -32,7 +32,7 @@
four test(A&&);
eight test(const A&&);
-#endif
+#endif // _LIBCPP_MOVE
int main()
{
@@ -54,7 +54,7 @@
static_assert(sizeof(test(std::forward<const A>(ca))) == 8, "");
static_assert(sizeof(test(std::forward<const A>(csource()))) == 8, "");
-#else
+#else // _LIBCPP_MOVE
static_assert(sizeof(test(std::forward<A&>(a))) == 1, "");
static_assert(sizeof(test(std::forward<A>(a))) == 1, "");
@@ -69,5 +69,5 @@
static_assert(sizeof(test(std::forward<const A&>(csource()))) == 2, "");
static_assert(sizeof(test(std::forward<const A>(ca))) == 2, "");
static_assert(sizeof(test(std::forward<const A>(csource()))) == 2, "");
-#endif
+#endif // _LIBCPP_MOVE
}
Modified: libcxx/trunk/test/utilities/utility/forward/move_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/forward/move_copy.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/forward/move_copy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/forward/move_copy.pass.cpp Sat Aug 21 19:59:46 2010
@@ -29,13 +29,13 @@
A(A&&) {++move_ctor;}
A& operator=(A&&);
-#else
+#else // _LIBCPP_MOVE
A(const A&) {++copy_ctor;}
A& operator=(A&);
operator std::__rv<A> () {return std::__rv<A>(*this);}
A(std::__rv<A>) {++move_ctor;}
-#endif
+#endif // _LIBCPP_MOVE
A() {}
};
Modified: libcxx/trunk/test/utilities/utility/forward/move_if_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/forward/move_if_noexcept.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/forward/move_if_noexcept.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/forward/move_if_noexcept.pass.cpp Sat Aug 21 19:59:46 2010
@@ -45,11 +45,11 @@
static_assert((std::is_same<decltype(std::move_if_noexcept(ci)), const int&&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(a)), const A&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A&>::value), "");
-#else
+#else // _LIBCPP_MOVE
static_assert((std::is_same<decltype(std::move_if_noexcept(i)), const int>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(ci)), const int>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(a)), const A>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A>::value), "");
-#endif
+#endif // _LIBCPP_MOVE
}
Modified: libcxx/trunk/test/utilities/utility/forward/move_only.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/forward/move_only.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/forward/move_only.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/forward/move_only.pass.cpp Sat Aug 21 19:59:46 2010
@@ -17,20 +17,20 @@
#ifdef _LIBCPP_MOVE
move_only(const move_only&);
move_only& operator=(const move_only&);
-#else
+#else // _LIBCPP_MOVE
move_only(move_only&);
move_only& operator=(move_only&);
-#endif
+#endif // _LIBCPP_MOVE
public:
#ifdef _LIBCPP_MOVE
move_only(move_only&&) {}
move_only& operator=(move_only&&) {}
-#else
+#else // _LIBCPP_MOVE
operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
move_only(std::__rv<move_only>) {}
-#endif
+#endif // _LIBCPP_MOVE
move_only() {}
};
Modified: libcxx/trunk/test/utilities/utility/forward/move_only1.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/forward/move_only1.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/forward/move_only1.fail.cpp (original)
+++ libcxx/trunk/test/utilities/utility/forward/move_only1.fail.cpp Sat Aug 21 19:59:46 2010
@@ -20,20 +20,20 @@
#ifdef _LIBCPP_MOVE
move_only(const move_only&);
move_only& operator=(const move_only&);
-#else
+#else // _LIBCPP_MOVE
move_only(move_only&);
move_only& operator=(move_only&);
-#endif
+#endif // _LIBCPP_MOVE
public:
#ifdef _LIBCPP_MOVE
move_only(move_only&&) {}
move_only& operator=(move_only&&) {}
-#else
+#else // _LIBCPP_MOVE
operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
move_only(std::__rv<move_only>) {}
-#endif
+#endif // _LIBCPP_MOVE
move_only() {}
};
Modified: libcxx/trunk/test/utilities/utility/forward/move_only2.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/forward/move_only2.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/forward/move_only2.fail.cpp (original)
+++ libcxx/trunk/test/utilities/utility/forward/move_only2.fail.cpp Sat Aug 21 19:59:46 2010
@@ -20,20 +20,20 @@
#ifdef _LIBCPP_MOVE
move_only(const move_only&);
move_only& operator=(const move_only&);
-#else
+#else // _LIBCPP_MOVE
move_only(move_only&);
move_only& operator=(move_only&);
-#endif
+#endif // _LIBCPP_MOVE
public:
#ifdef _LIBCPP_MOVE
move_only(move_only&&) {}
move_only& operator=(move_only&&) {}
-#else
+#else // _LIBCPP_MOVE
operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
move_only(std::__rv<move_only>) {}
-#endif
+#endif // _LIBCPP_MOVE
move_only() {}
};
Modified: libcxx/trunk/test/utilities/utility/forward/move_only3.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/forward/move_only3.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/forward/move_only3.fail.cpp (original)
+++ libcxx/trunk/test/utilities/utility/forward/move_only3.fail.cpp Sat Aug 21 19:59:46 2010
@@ -17,20 +17,20 @@
#ifdef _LIBCPP_MOVE
move_only(const move_only&);
move_only& operator=(const move_only&);
-#else
+#else // _LIBCPP_MOVE
move_only(move_only&);
move_only& operator=(move_only&);
-#endif
+#endif // _LIBCPP_MOVE
public:
#ifdef _LIBCPP_MOVE
move_only(move_only&&) {}
move_only& operator=(move_only&&) {}
-#else
+#else // _LIBCPP_MOVE
operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
move_only(std::__rv<move_only>) {}
-#endif
+#endif // _LIBCPP_MOVE
move_only() {}
};
Modified: libcxx/trunk/test/utilities/utility/forward/move_only4.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/forward/move_only4.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/forward/move_only4.fail.cpp (original)
+++ libcxx/trunk/test/utilities/utility/forward/move_only4.fail.cpp Sat Aug 21 19:59:46 2010
@@ -20,20 +20,20 @@
#ifdef _LIBCPP_MOVE
move_only(const move_only&);
move_only& operator=(const move_only&);
-#else
+#else // _LIBCPP_MOVE
move_only(move_only&);
move_only& operator=(move_only&);
-#endif
+#endif // _LIBCPP_MOVE
public:
#ifdef _LIBCPP_MOVE
move_only(move_only&&) {}
move_only& operator=(move_only&&) {}
-#else
+#else // _LIBCPP_MOVE
operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
move_only(std::__rv<move_only>) {}
-#endif
+#endif // _LIBCPP_MOVE
move_only() {}
};
Modified: libcxx/trunk/test/utilities/utility/pairs/pairs.pair/U_V.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/pairs/pairs.pair/U_V.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/pairs/pairs.pair/U_V.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/pairs/pairs.pair/U_V.pass.cpp Sat Aug 21 19:59:46 2010
@@ -26,5 +26,5 @@
assert(*p.first == 3);
assert(p.second == nullptr);
}
-#endif
+#endif // _LIBCPP_MOVE
}
Modified: libcxx/trunk/test/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp Sat Aug 21 19:59:46 2010
@@ -28,5 +28,5 @@
assert(*p2.first == 3);
assert(p2.second == 4);
}
-#endif
+#endif // _LIBCPP_MOVE
}
Modified: libcxx/trunk/test/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp Sat Aug 21 19:59:46 2010
@@ -39,5 +39,5 @@
assert(p2.first == nullptr);
assert(p2.second == 4);
}
-#endif
+#endif // _LIBCPP_MOVE
}
Modified: libcxx/trunk/test/utilities/utility/pairs/pairs.pair/make_pair.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/pairs/pairs.pair/make_pair.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/pairs/pairs.pair/make_pair.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/pairs/pairs.pair/make_pair.pass.cpp Sat Aug 21 19:59:46 2010
@@ -36,5 +36,5 @@
assert(p1.first == nullptr);
assert(p1.second == 4);
}
-#endif
+#endif // _LIBCPP_MOVE
}
Modified: libcxx/trunk/test/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp Sat Aug 21 19:59:46 2010
@@ -31,5 +31,5 @@
assert(p3.first == P1(3, nullptr));
assert(p3.second == P2(nullptr, 4));
}
-#endif
+#endif // _LIBCPP_HAS_NO_VARIADICS
}
Modified: libcxx/trunk/test/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp Sat Aug 21 19:59:46 2010
@@ -38,5 +38,5 @@
assert(p2.first == nullptr);
assert(p2.second == 4);
}
-#endif
+#endif // _LIBCPP_MOVE
}
Modified: libcxx/trunk/test/utilities/utility/pairs/pairs.pair/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/pairs/pairs.pair/types.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/pairs/pairs.pair/types.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/pairs/pairs.pair/types.pass.cpp Sat Aug 21 19:59:46 2010
@@ -15,7 +15,6 @@
// typedef T1 first_type;
// typedef T2 second_type;
-
#include <utility>
#include <type_traits>
Modified: libcxx/trunk/test/utilities/utility/utility.swap/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/utility.swap/swap.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/utility.swap/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/utility.swap/swap.pass.cpp Sat Aug 21 19:59:46 2010
@@ -9,8 +9,8 @@
// <utility>
-// template<class T>
-// requires MoveAssignable<T> && MoveConstructible<T>
+// template<class T>
+// requires MoveAssignable<T> && MoveConstructible<T>
// void
// swap(T& a, T& b);
@@ -42,7 +42,7 @@
assert(*j == 1);
}
-#endif
+#endif // _LIBCPP_MOVE
int main()
{
Modified: libcxx/trunk/test/utilities/utility/utility.swap/swap_array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/utility.swap/swap_array.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/utility.swap/swap_array.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/utility.swap/swap_array.pass.cpp Sat Aug 21 19:59:46 2010
@@ -9,8 +9,8 @@
// <utility>
-// template<ValueType T, size_t N>
-// requires Swappable<T>
+// template<ValueType T, size_t N>
+// requires Swappable<T>
// void
// swap(T (&a)[N], T (&b)[N]);
@@ -54,7 +54,7 @@
assert(*j[2] == 3);
}
-#endif
+#endif // _LIBCPP_MOVE
int main()
{
More information about the cfe-commits
mailing list