Threading.cpp 743 B

123456789101112131415161718192021222324
  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. #include "llvm/Support/Threading.h"
  9. #include "llvm/Support/thread.h"
  10. #include "gtest/gtest.h"
  11. using namespace llvm;
  12. namespace {
  13. TEST(Threading, PhysicalConcurrency) {
  14. auto Num = heavyweight_hardware_concurrency();
  15. // Since Num is unsigned this will also catch us trying to
  16. // return -1.
  17. ASSERT_LE(Num, thread::hardware_concurrency());
  18. }
  19. } // end anon namespace