[HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (#117017)
[llvm-project.git] / llvm / unittests / Support / ExponentialBackoffTest.cpp
blob257604908bfe43bb4cb47bc66be8287b3dcf26a8
1 //===- unittests/ExponentialBackoffTest.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 "llvm/Support/ExponentialBackoff.h"
10 #include "gtest/gtest.h"
11 #include <chrono>
13 using namespace llvm;
14 using namespace std::chrono_literals;
16 namespace {
18 TEST(ExponentialBackoffTest, Timeout) {
19 auto Start = std::chrono::steady_clock::now();
20 // Use short enough times that this test runs quickly.
21 ExponentialBackoff Backoff(100ms, 1ms, 10ms);
22 do {
23 } while (Backoff.waitForNextAttempt());
24 auto Duration = std::chrono::steady_clock::now() - Start;
25 EXPECT_GE(Duration, 100ms);
28 // Testing individual wait duration is omitted as those tests would be
29 // non-deterministic.
31 } // end anonymous namespace