Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | 5b08a8a | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
Howard Hinnant | 412dbeb | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Jonathan Roelofs | b3fcc67 | 2014-09-05 19:45:05 +0000 | [diff] [blame] | 9 | // |
| 10 | // UNSUPPORTED: libcpp-has-no-threads |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 11 | |
| 12 | // <thread> |
| 13 | |
| 14 | // class thread::id |
| 15 | |
| 16 | // bool operator< (thread::id x, thread::id y); |
| 17 | // bool operator<=(thread::id x, thread::id y); |
| 18 | // bool operator> (thread::id x, thread::id y); |
| 19 | // bool operator>=(thread::id x, thread::id y); |
| 20 | |
| 21 | #include <thread> |
| 22 | #include <cassert> |
| 23 | |
| 24 | int main() |
| 25 | { |
| 26 | std::thread::id id0; |
| 27 | std::thread::id id1; |
| 28 | std::thread::id id2 = std::this_thread::get_id(); |
| 29 | assert(!(id0 < id1)); |
| 30 | assert( (id0 <= id1)); |
| 31 | assert(!(id0 > id1)); |
| 32 | assert( (id0 >= id1)); |
Howard Hinnant | 7fe6441 | 2014-02-04 19:51:48 +0000 | [diff] [blame] | 33 | assert(!(id0 == id2)); |
| 34 | if (id0 < id2) { |
| 35 | assert( (id0 <= id2)); |
| 36 | assert(!(id0 > id2)); |
| 37 | assert(!(id0 >= id2)); |
| 38 | } else { |
| 39 | assert(!(id0 <= id2)); |
| 40 | assert( (id0 > id2)); |
| 41 | assert( (id0 >= id2)); |
| 42 | } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 43 | } |