From 61b9a7258a7693d7f3674a5a1daf7b036ff1d382 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 6 Sep 2015 18:46:46 +0000 Subject: Import libc++ 3.7.0 release (r246257). --- .../thread.thread.id/assign.pass.cpp | 29 +++++++++++++++ .../thread.thread.id/copy.pass.cpp | 26 +++++++++++++ .../thread.thread.id/default.pass.cpp | 25 +++++++++++++ .../thread.thread.id/eq.pass.cpp | 32 ++++++++++++++++ .../thread.thread.id/lt.pass.cpp | 43 ++++++++++++++++++++++ .../thread.thread.id/stream.pass.cpp | 29 +++++++++++++++ .../thread.thread.id/thread_id.pass.cpp | 35 ++++++++++++++++++ 7 files changed, 219 insertions(+) create mode 100644 test/std/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp create mode 100644 test/std/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp create mode 100644 test/std/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp create mode 100644 test/std/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp create mode 100644 test/std/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp create mode 100644 test/std/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp create mode 100644 test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp (limited to 'test/std/thread/thread.threads/thread.thread.class/thread.thread.id') diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp new file mode 100644 index 0000000000000..585f7ea98a030 --- /dev/null +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads + +// + +// class thread::id + +// id& operator=(const id&) = default; + +#include +#include + +int main() +{ + std::thread::id id0; + std::thread::id id1; + id1 = id0; + assert(id1 == id0); + id1 = std::this_thread::get_id(); + assert(id1 != id0); +} diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp new file mode 100644 index 0000000000000..e8c38016b2886 --- /dev/null +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads + +// + +// class thread::id + +// id(const id&) = default; + +#include +#include + +int main() +{ + std::thread::id id0; + std::thread::id id1 = id0; + assert(id1 == id0); +} diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp new file mode 100644 index 0000000000000..0037deb1dd655 --- /dev/null +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads + +// + +// class thread::id + +// id(); + +#include +#include + +int main() +{ + std::thread::id id; + assert(id == std::thread::id()); +} diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp new file mode 100644 index 0000000000000..6dd4c3ec4f570 --- /dev/null +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads + +// + +// class thread::id + +// bool operator==(thread::id x, thread::id y); +// bool operator!=(thread::id x, thread::id y); + +#include +#include + +int main() +{ + std::thread::id id0; + std::thread::id id1; + id1 = id0; + assert( (id1 == id0)); + assert(!(id1 != id0)); + id1 = std::this_thread::get_id(); + assert(!(id1 == id0)); + assert( (id1 != id0)); +} diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp new file mode 100644 index 0000000000000..de52b1d00cdf3 --- /dev/null +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads + +// + +// class thread::id + +// bool operator< (thread::id x, thread::id y); +// bool operator<=(thread::id x, thread::id y); +// bool operator> (thread::id x, thread::id y); +// bool operator>=(thread::id x, thread::id y); + +#include +#include + +int main() +{ + std::thread::id id0; + std::thread::id id1; + std::thread::id id2 = std::this_thread::get_id(); + assert(!(id0 < id1)); + assert( (id0 <= id1)); + assert(!(id0 > id1)); + assert( (id0 >= id1)); + assert(!(id0 == id2)); + if (id0 < id2) { + assert( (id0 <= id2)); + assert(!(id0 > id2)); + assert(!(id0 >= id2)); + } else { + assert(!(id0 <= id2)); + assert( (id0 > id2)); + assert( (id0 >= id2)); + } +} diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp new file mode 100644 index 0000000000000..126965fe3fc38 --- /dev/null +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads + +// + +// class thread::id + +// template +// basic_ostream& +// operator<<(basic_ostream& out, thread::id id); + +#include +#include +#include + +int main() +{ + std::thread::id id0 = std::this_thread::get_id(); + std::ostringstream os; + os << id0; +} diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp new file mode 100644 index 0000000000000..106c69e2e4a1f --- /dev/null +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads + +// + +// template +// struct hash +// : public unary_function +// { +// size_t operator()(T val) const; +// }; + +// Not very portable + +#include +#include + +int main() +{ + std::thread::id id1; + std::thread::id id2 = std::this_thread::get_id(); + typedef std::hash H; + static_assert((std::is_same::value), "" ); + static_assert((std::is_same::value), "" ); + H h; + assert(h(id1) != h(id2)); +} -- cgit v1.2.3