xref: /llvm-project/llvm/unittests/Support/Threading.cpp (revision 2946cd701067404b99c39fb29dc9c74bd7193eb3)
1 //===- unittests/Threading.cpp - Thread tests -----------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "llvm/Support/Threading.h"
10 #include "llvm/Support/thread.h"
11 #include "gtest/gtest.h"
12 
13 using namespace llvm;
14 
15 namespace {
16 
17 TEST(Threading, PhysicalConcurrency) {
18   auto Num = heavyweight_hardware_concurrency();
19   // Since Num is unsigned this will also catch us trying to
20   // return -1.
21   ASSERT_LE(Num, thread::hardware_concurrency());
22 }
23 
24 } // end anon namespace
25