[NFC] Test case refactor

This commit is contained in:
Nathan James 2021-01-06 20:00:15 +00:00
parent 47fba9e1ea
commit 0bfe100145
No known key found for this signature in database
GPG Key ID: CC007AFCDA90AA5F
1 changed files with 4 additions and 3 deletions

View File

@ -1042,7 +1042,7 @@ TEST_F(TUSchedulerTests, CommandLineWarnings) {
TEST(DebouncePolicy, Compute) {
namespace c = std::chrono;
std::vector<DebouncePolicy::clock::duration> History = {
DebouncePolicy::clock::duration History[] = {
c::seconds(0),
c::seconds(5),
c::seconds(10),
@ -1053,8 +1053,9 @@ TEST(DebouncePolicy, Compute) {
Policy.Max = c::seconds(25);
// Call Policy.compute(History) and return seconds as a float.
auto Compute = [&](llvm::ArrayRef<DebouncePolicy::clock::duration> History) {
using FloatingSeconds = c::duration<float, c::seconds::period>;
return static_cast<float>(Policy.compute(History) / FloatingSeconds(1));
return c::duration_cast<c::duration<float, c::seconds::period>>(
Policy.compute(History))
.count();
};
EXPECT_NEAR(10, Compute(History), 0.01) << "(upper) median = 10";
Policy.RebuildRatio = 1.5;