'From Cuis 6.0 [latest update: #5305] on 24 June 2022 at 9:30:48 pm'!


!TestValueWithinFix methodsFor: 'tests' stamp: 'jmv 4/17/2013 12:11'!
testValueWithinNonLocalReturnFixReal
	"self run: #testValueWithinNonLocalReturnFixReal"
	"The real test for the fix is just as obscure as the original problem"
	| startTime |
	self valueWithinNonLocalReturn.
	startTime := Time localMillisecondClock.
	[[] repeat] valueWithin: 100 milliSeconds onTimeout:[ | deltaTime |
		"This *should* timeout after 100 msecs but the pending process from
		the previous invokation will signal timeout after 20 msecs already
		which will in turn cut this invokation short."
		deltaTime := Time localMillisecondClock - startTime.
		self deny: deltaTime < 90.
	].
! !

!TestValueWithinFix methodsFor: 'tests' stamp: 'ar 8/17/2007 13:38'!
testValueWithinNonLocalReturnFixSimply
	"self run: #testValueWithinNonLocalReturnFixSimply"
	"The simple version to test the fix"
	self valueWithinNonLocalReturn.
	self shouldnt:[(Delay forMilliseconds: 50) wait] raise: TimedOut.! !

!TestValueWithinFix methodsFor: 'tests' stamp: 'KenD 6/24/2022 21:29:49'!
testValueWithinTimingBasic
	"Test timing of valueWithin:onTimeout:"
	| time |
	[time := [
		[1000 milliSeconds asDelay wait]
			valueWithin: 100 milliSeconds onTimeout: []
	] durationToRun.
	self assert: time < 200 milliSeconds.
	] forkAt: Processor userInterruptPriority.! !

!TestValueWithinFix methodsFor: 'tests' stamp: 'KenD 6/24/2022 21:29:29'!
testValueWithinTimingNestedInner
	"Test nested timing of valueWithin:onTimeout:"
	| time |
	[time := [
		[
			[5 seconds asDelay wait]
				valueWithin: 100 milliSeconds onTimeout: []
		] valueWithin: 500 milliSeconds onTimeout: []
	] durationToRun.
	self assert: time < 200 milliSeconds.
	] forkAt: Processor userInterruptPriority.! !

!TestValueWithinFix methodsFor: 'tests' stamp: 'KenD 6/24/2022 21:30:07'!
testValueWithinTimingNestedOuter
	"Test nested timing of valueWithin:onTimeout:"
	| time |
	[time := [
		[
			3 timesRepeat: [
				[5 seconds asDelay wait]
					valueWithin: 100 milliSeconds onTimeout: []]
		] valueWithin: 150 milliSeconds onTimeout: []
	] durationToRun.
	self assert: time > 100 milliSeconds.
	self assert: time < 200 milliSeconds.
	] forkAt: Processor userInterruptPriority.
	! !

!TestValueWithinFix methodsFor: 'tests' stamp: 'KenD 6/24/2022 21:30:22'!
testValueWithinTimingRepeat
	"Test timing of valueWithin:onTimeout:"
	| time |
	[time := [
		3 timesRepeat: [
			[500 milliSeconds asDelay wait]
				valueWithin: 100 milliSeconds onTimeout: []]
	] durationToRun.
	self assert: time < 400 milliSeconds.
	] forkAt: Processor userInterruptPriority.
! !

!TestValueWithinFix methodsFor: 'tests' stamp: 'ar 8/17/2007 13:37'!
valueWithinNonLocalReturn
	"Do a non-local return from a valueWithin: block"
	[^self] valueWithin: 20 milliSeconds onTimeout:[].
! !
