Fix against clock conversion precision issues in tests.

This commit is contained in:
Steffen Schuemann 2019-07-04 08:35:20 +02:00
parent 8dee4d7731
commit 361af7e51d

View File

@ -2287,10 +2287,10 @@ TEST_CASE("30.10.15.25 last_write_time", "[filesystem][operations][fs.op.last_wr
}
auto nt = timeFromString("2015-10-21T04:30:00");
CHECK_NOTHROW(fs::last_write_time(t.path() / "foo", nt));
CHECK(fs::last_write_time("foo") == nt);
CHECK(std::abs(std::chrono::duration_cast<std::chrono::seconds>(fs::last_write_time("foo") - nt).count()) < 1);
nt = timeFromString("2015-10-21T04:29:00");
CHECK_NOTHROW(fs::last_write_time("foo", nt, ec));
CHECK(fs::last_write_time("foo") == nt);
CHECK(std::abs(std::chrono::duration_cast<std::chrono::seconds>(fs::last_write_time("foo") - nt).count()) < 1);
CHECK(!ec);
CHECK_THROWS_AS(fs::last_write_time("bar", nt), fs::filesystem_error);
CHECK_NOTHROW(fs::last_write_time("bar", nt, ec));