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

commits at source.squeak.org commits at source.squeak.org
Thu Mar 3 07:46:46 UTC 2022


A new version of Chronology-Tests was added to project The Inbox:
http://source.squeak.org/inbox/Chronology-Tests-lrnp.31.mcz

==================== 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') -----
  testBusyWait
  	
  	| 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).!



More information about the Squeak-dev mailing list