Skip to content

Commit 0bfe100

Browse files
committed
[NFC] Test case refactor
1 parent 47fba9e commit 0bfe100

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ TEST_F(TUSchedulerTests, CommandLineWarnings) {
10421042

10431043
TEST(DebouncePolicy, Compute) {
10441044
namespace c = std::chrono;
1045-
std::vector<DebouncePolicy::clock::duration> History = {
1045+
DebouncePolicy::clock::duration History[] = {
10461046
c::seconds(0),
10471047
c::seconds(5),
10481048
c::seconds(10),
@@ -1053,8 +1053,9 @@ TEST(DebouncePolicy, Compute) {
10531053
Policy.Max = c::seconds(25);
10541054
// Call Policy.compute(History) and return seconds as a float.
10551055
auto Compute = [&](llvm::ArrayRef<DebouncePolicy::clock::duration> History) {
1056-
using FloatingSeconds = c::duration<float, c::seconds::period>;
1057-
return static_cast<float>(Policy.compute(History) / FloatingSeconds(1));
1056+
return c::duration_cast<c::duration<float, c::seconds::period>>(
1057+
Policy.compute(History))
1058+
.count();
10581059
};
10591060
EXPECT_NEAR(10, Compute(History), 0.01) << "(upper) median = 10";
10601061
Policy.RebuildRatio = 1.5;

0 commit comments

Comments
 (0)