[AArch64,ELF] Restrict MOVZ/MOVK to non-PIC large code model (#70178)
[llvm-project.git] / lldb / unittests / Utility / PredicateTest.cpp
blob76d8f7677ea9d5f3598aed9584d49f2d29131710
1 //===-- PredicateTest.cpp -------------------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "lldb/Utility/Predicate.h"
10 #include "gtest/gtest.h"
11 #include <thread>
13 using namespace lldb_private;
15 TEST(Predicate, WaitForValueEqualTo) {
16 Predicate<int> P(0);
17 EXPECT_TRUE(P.WaitForValueEqualTo(0));
18 EXPECT_FALSE(P.WaitForValueEqualTo(1, std::chrono::milliseconds(10)));
20 std::thread Setter([&P] {
21 std::this_thread::sleep_for(std::chrono::milliseconds(100));
22 P.SetValue(1, eBroadcastAlways);
23 });
24 EXPECT_TRUE(P.WaitForValueEqualTo(1));
25 Setter.join();
28 TEST(Predicate, WaitForValueNotEqualTo) {
29 Predicate<int> P(0);
30 EXPECT_EQ(0, P.WaitForValueNotEqualTo(1));
31 EXPECT_EQ(std::nullopt,
32 P.WaitForValueNotEqualTo(0, std::chrono::milliseconds(10)));