Skip to content

Commit d070fc0

Browse files
committed
Tests: Allow for sloppy timer precision
1 parent 1d29bc1 commit d070fc0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Tests/CornucopiaCoreTests/Logging/LogFile.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ class Logging: XCTestCase {
174174
let expectedDifferences = [100, 5.0, 50.0, 500.0, 1000.0]
175175
for (index, difference) in differencesInMs.enumerated() {
176176
let expectedDifference = expectedDifferences[index]
177-
let lowerBound = expectedDifference
177+
let lowerBound = expectedDifference * 0.99 // Allow 1% tolerance for timer precision
178178
let upperBound = expectedDifference * 1.6
179-
XCTAssert(difference >= lowerBound)
180-
XCTAssert(difference <= upperBound)
179+
XCTAssert(difference >= lowerBound, "Difference \(difference)ms at index \(index) is less than expected \(lowerBound)ms")
180+
XCTAssert(difference <= upperBound, "Difference \(difference)ms at index \(index) is greater than expected \(upperBound)ms")
181181
}
182182
}
183183
}

0 commit comments

Comments
 (0)