Skip to content

Commit

Permalink
PR #603: pass CreateZip tests that are within time tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
piksel committed Mar 14, 2021
1 parent 4cb5853 commit 7ed87d1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs
Expand Up @@ -725,7 +725,10 @@ public void CreateZipShouldSetTimeOnEntriesFromConstructorTimeSetting(TimeSettin
var archive = new MemoryStream(target.ToArray());
using (var zf = new ZipFile(archive))
{
Assert.AreEqual(TestTargetTime(timeSetting), zf[0].DateTime);
var expectedTime = TestTargetTime(timeSetting);
var actualTime = zf[0].DateTime;
// Assert that the time is within +/- 2s of the target time to allow for timing/rounding discrepancies
Assert.LessOrEqual(Math.Abs((expectedTime - actualTime).TotalSeconds), 2);
}
}

Expand Down

0 comments on commit 7ed87d1

Please sign in to comment.