Teresa Johnson | 2bd812c | 2016-10-14 00:13:59 +0000 | [diff] [blame] | 1 | //===- unittests/Threading.cpp - Thread tests -----------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "llvm/Support/Threading.h" |
| 11 | #include "llvm/Support/thread.h" |
| 12 | #include "gtest/gtest.h" |
| 13 | |
| 14 | using namespace llvm; |
| 15 | |
| 16 | namespace { |
| 17 | |
| 18 | TEST(Threading, PhysicalConcurrency) { |
Teresa Johnson | c0ef9e4 | 2016-10-17 14:56:53 +0000 | [diff] [blame] | 19 | auto Num = heavyweight_hardware_concurrency(); |
Teresa Johnson | 2bd812c | 2016-10-14 00:13:59 +0000 | [diff] [blame] | 20 | // Since Num is unsigned this will also catch us trying to |
| 21 | // return -1. |
| 22 | ASSERT_LE(Num, thread::hardware_concurrency()); |
| 23 | } |
| 24 | |
| 25 | } // end anon namespace |