[squeak-dev] The Inbox: Chronology-Tests-lrnp.31.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Fri Mar 25 17:57:50 UTC 2022

Hi Lauren,

thanks for the patch! :-) Just as a comprehension question, what are the rounding errors you are talking about and why did you insert a #roundTo: in the test?



Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Donnerstag, 3. März 2022 08:46:46
An: squeak-dev at lists.squeakfoundation.org
Betreff: [squeak-dev] The Inbox: Chronology-Tests-lrnp.31.mcz

A new version of Chronology-Tests was added to project The Inbox:

==================== Summary ====================

Name: Chronology-Tests-lrnp.31
Author: lrnp
Time: 3 March 2022, 12:46:42.775073 am
UUID: 437b3938-ef51-494d-9dee-ba89baa669bb
Ancestors: Chronology-Tests-ct.30

adjust margin of error for millisecond timing

Given that the shortest measurable interval is 1 ms, rounded, allow up to 2 milliseconds over or under for a combination of rounding and delays introduced by taking measurements.

This makes the busyWait test harder to pass unless the millisecond precision prescribed by Delay's comment applies to the current image. If the prescription applies, the test will pass more reliably in case of rounding errors.

=============== Diff against Chronology-Tests-ct.30 ===============

Item was changed:
  ----- Method: DurationTest>>testBusyWait (in category 'tests') -----

         | duration start elapsed |
         duration := Duration milliSeconds: 1.
         start := DateAndTime now.

         1000 timesRepeat: [duration busyWait].
+        elapsed := DateAndTime now - start roundTo: duration.
-        elapsed := DateAndTime now - start.

+        self assert: elapsed >= (duration * 998).
+        self assert: elapsed <= (duration * 1002).!
-        self assert: elapsed >= (duration * 1000).
-        self assert: elapsed <= (duration * 1000 * 2).!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220325/00a221a1/attachment.html>

More information about the Squeak-dev mailing list