blob: 01f1c5134482fb5675f4fb8f920319447fd0ff2d [file] [log] [blame]
Teresa Johnson2bd812c2016-10-14 00:13:59 +00001//===- unittests/Threading.cpp - Thread tests -----------------------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Teresa Johnson2bd812c2016-10-14 00:13:59 +00006//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/Support/Threading.h"
10#include "llvm/Support/thread.h"
11#include "gtest/gtest.h"
12
13using namespace llvm;
14
15namespace {
16
17TEST(Threading, PhysicalConcurrency) {
Teresa Johnsonc0ef9e42016-10-17 14:56:53 +000018 auto Num = heavyweight_hardware_concurrency();
Teresa Johnson2bd812c2016-10-14 00:13:59 +000019 // Since Num is unsigned this will also catch us trying to
20 // return -1.
21 ASSERT_LE(Num, thread::hardware_concurrency());
22}
23
Teresa Johnson2bd812c2016-10-14 00:13:59 +000024} // end anon namespace