From 361af7e51d0a950b899c56ad342f16ffda399bcf Mon Sep 17 00:00:00 2001 From: Steffen Schuemann Date: Thu, 4 Jul 2019 08:35:20 +0200 Subject: [PATCH] Fix against clock conversion precision issues in tests. --- test/filesystem_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/filesystem_test.cpp b/test/filesystem_test.cpp index 1c6a1c6..0f310f6 100644 --- a/test/filesystem_test.cpp +++ b/test/filesystem_test.cpp @@ -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(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(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));