84% of all instance-methods are unary !
Markus Gaelli
gaelli at emergent.de
Tue Jun 10 16:29:00 UTC 2003
Hi,
If my code below is right, around _84 %_ (!) of all instance-methods
in Squeak 3.6-5247 are unary, thus easy executable, if there were
examples
for their objects.
Think of the coverage we could gain, if we had more examples.
Put in assertions in your code, and we have lots of real failure
checking
tests too.
Markus
----------
|aMethodSigBlock anArray maxParameters|
maxParameters:=20.
aMethodSigBlock :=
[:aClass || myArray |
myArray _ Array new: maxParameters withAll: 0.
aClass selectors
do: [:aSel |
aSel isUnary
ifTrue: [myArray at: 1 put: (myArray at: 1) + 1].
aSel isInfix
ifTrue: [myArray at: 2 put: (myArray at: 2) + 1].
aSel isKeyword
ifTrue: [| anIndex |
anIndex _ (aSel findTokens: ':') size.
myArray at: anIndex put: (myArray at: anIndex) + 1]].
myArray].
anArray := Array new: maxParameters withAll: 0.
Object withAllSubclasses do: [:e | e isMeta ifFalse: [anArray :=
anArray + (aMethodSigBlock value: e)]].
anArray,{(anArray first / anArray sum) asFloat}
#(22787 2854 796 381 202 71 28 13 5 3 1 1 0 1 0 0 0 0 0 0
0.839516634122978)
More information about the Squeak-dev
mailing list
|