Skip to content

Commit 6162c9d

Browse files
authored
Fix flakey clock and line-number tests (#1294)
1 parent a1b9593 commit 6162c9d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/old_tests/UnitTests/clock.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ TEST_CASE("clock, time_t")
9292
REQUIRE(clock::to_time_t(clock::from_time_t(now_tt)) == now_tt);
9393

9494
// Conversions are verified to be consistent. Now, verify that we're correctly converting epochs
95-
// Note that time_t has only 1s resolution, so we need to add 1 second of slop on either side.
96-
REQUIRE_ORDERED(now1_dt - 1s, clock::from_time_t(now_tt), now2_dt + 1s);
95+
// Note that time_t has only 1s resolution, so we need to add 2 seconds of slop on either side.
96+
// (One second for measurement error, and another second for rounding error.)
97+
REQUIRE_ORDERED(now1_dt - 2s, clock::from_time_t(now_tt), now2_dt + 2s);
9798
}
9899

99100
TEST_CASE("clock, FILETIME")

test/test_cpp20/custom_error.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ namespace
77
{
88
static bool s_loggerCalled = false;
99

10-
// Note that we are checking that the source line number matches expectations. If lines above this are changed
11-
// then this value needs to change as well.
1210
void FailOnLine15()
1311
{
1412
// Validate that handler translated exception
13+
#line 15 // Force next line to be reported as line number 15
1514
REQUIRE_THROWS_AS(check_hresult(0x80000018), hresult_illegal_delegate_assignment);
1615
}
1716

0 commit comments

Comments
 (0)