Fix flakey clock and line-number tests (#1294)

This commit is contained in:
Raymond Chen 2023-03-31 20:17:20 -07:00 коммит произвёл GitHub
Родитель a1b9593323
Коммит 6162c9d05d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -92,8 +92,9 @@ TEST_CASE("clock, time_t")
REQUIRE(clock::to_time_t(clock::from_time_t(now_tt)) == now_tt);
// Conversions are verified to be consistent. Now, verify that we're correctly converting epochs
// Note that time_t has only 1s resolution, so we need to add 1 second of slop on either side.
REQUIRE_ORDERED(now1_dt - 1s, clock::from_time_t(now_tt), now2_dt + 1s);
// Note that time_t has only 1s resolution, so we need to add 2 seconds of slop on either side.
// (One second for measurement error, and another second for rounding error.)
REQUIRE_ORDERED(now1_dt - 2s, clock::from_time_t(now_tt), now2_dt + 2s);
}
TEST_CASE("clock, FILETIME")

Просмотреть файл

@ -7,11 +7,10 @@ namespace
{
static bool s_loggerCalled = false;
// Note that we are checking that the source line number matches expectations. If lines above this are changed
// then this value needs to change as well.
void FailOnLine15()
{
// Validate that handler translated exception
#line 15 // Force next line to be reported as line number 15
REQUIRE_THROWS_AS(check_hresult(0x80000018), hresult_illegal_delegate_assignment);
}