From 01673c8df4e7c3d4ecb7a58118b0e37745ce7958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= Date: Sun, 14 Mar 2021 16:20:45 +0100 Subject: [PATCH] pass tests that are within time tolerance --- test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs b/test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs index d394f309c..541e57cd8 100644 --- a/test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs +++ b/test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs @@ -750,7 +750,9 @@ public void ExtractZipShouldSetTimeOnFilesFromConstructorTimeSetting(TimeSetting fastZip.ExtractZip(archiveStream, extractDir.Fullpath, FastZip.Overwrite.Always, _ => true, "", "", true, true, false); var fi = new FileInfo(Path.Combine(extractDir.Fullpath, SingleEntryFileName)); - Assert.AreEqual(targetTime, FileTimeFromTimeSetting(fi, timeSetting)); + var actualTime = FileTimeFromTimeSetting(fi, timeSetting); + // Assert that the time is within +/- 2s of the target time to allow for timing/rounding discrepancies + Assert.LessOrEqual(Math.Abs((targetTime - actualTime).TotalSeconds), 2); } }