blob: 099781fb72f9e1c7bd3e85c06b84e816bb93965f [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
Howard Hinnant412dbeb2010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant3e519522010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <thread>
11
12// class thread::id
13
14// bool operator< (thread::id x, thread::id y);
15// bool operator<=(thread::id x, thread::id y);
16// bool operator> (thread::id x, thread::id y);
17// bool operator>=(thread::id x, thread::id y);
18
19#include <thread>
20#include <cassert>
21
22int main()
23{
24 std::thread::id id0;
25 std::thread::id id1;
26 std::thread::id id2 = std::this_thread::get_id();
27 assert(!(id0 < id1));
28 assert( (id0 <= id1));
29 assert(!(id0 > id1));
30 assert( (id0 >= id1));
Howard Hinnant7fe64412014-02-04 19:51:48 +000031 assert(!(id0 == id2));
32 if (id0 < id2) {
33 assert( (id0 <= id2));
34 assert(!(id0 > id2));
35 assert(!(id0 >= id2));
36 } else {
37 assert(!(id0 <= id2));
38 assert( (id0 > id2));
39 assert( (id0 >= id2));
40 }
Howard Hinnant3e519522010-05-11 19:42:16 +000041}