[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[times] 00


self cancelFileIn!

"Set alternate action for testing lines"
! SwikiCodeRobot methodsFor: #timeTests !
ms: expression count: count
	" Private - Returns a block to evaluate expression in a loop (count times). "

	| msg i |
	i := 1. [msg isNil] whileTrue: [
		msg := #test ,i.
		(self respondsTo: msg) ifTrue: [
			msg := nil. i := i + 1.
		]
	].
	self note: 'implementing ' ,msg asLiteral.
	self class implement: msg comment: 'swiki test implementation'
		as: '	[' ,expression ,'] value. Smalltalk gc.
			^[' ,count ,' timesRepeat: [' ,expression ,']
			] ms rounded
		' category: #testing.
	^[ self perform: msg ]! !



.times
"Minimal tests"
#x
123
Point
#(1 2 3)

#x class
Smalltalk current
Smalltalk isClass
123 isNumber
123 isNil
nil isNil
#(1 2 3) isArray

0 isKindOf: Number
1 isKindOf: Number
1 isKindOf: Object
#(1) isKindOf: Object

self nativeLanguage

"Basic tests"
'hello word' isLiteral not
#x isLiteral
#x asLiteral = '#x'

##10000 3 + 4 = 7

Smalltalk current includesKey: #Object
(Smalltalk current includesKey: #the-thing) not
(Smalltalk current includesKey: 123) not
(Smalltalk current includesKey: Point zero) not

##100 Point selectors sorted
##100 Object withAllSubclasses size