Hi,

I was looking for an approximation of the coverage in the Collection  
tests.
I wrote the following scripts. Maybe some of you have ideas to refine  
on how to refine it.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
=-=-=-=-=
| definedMethods testedMethods classCategory testCategory suffix  
classes untestedMethods testClasses |
suffix := 'Abstract'.
classCategory := 'Collections-', suffix.
testCategory := 'CollectionsTests-', suffix.
classes := Smalltalk allClasses select: [:cls | cls category =  
classCategory].
testClasses := Smalltalk allClasses select: [:cls | cls category =  
testCategory].

definedMethods :=
        classes inject: Set new into: [:sum :cls | sum union: cls  
methodDictionary keys].


testedMethods :=
        testClasses inject: Set new into:
                [:sum :cls | sum union: (cls methodDictionary values inject: 
Set new  
into:
                                                [:sums :cm | sums union: cm 
messages])].
                                
"testedMethods contains all the methods send in test methods, which  
probably contains methods that have nothign to do with collection"
testedMethods := testedMethods reject: [:sel | (definedMethods  
includes: sel) not].

untestedMethods := definedMethods select: [:selector | (testedMethods  
includes: selector) not].

{ testedMethods . definedMethods .
'coverage =', (testedMethods size * 100 / definedMethods size) asFloat  
printString
}
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
=-=-=-=-=

Here are the results so far
CollectionsTests-
        Abstract = 7 %
        Arrayed = 15%
        Sequenceable = 54%
        SkipLists = 47%
        Stack = 61%
        Streams = 10%
        Support = 24%
        Text = 25%
        Unordered = 27%
        Weak = 11%

I tried to make Christo run, but it seems that Reflectivity behaves  
strangely under Pharo.

Cheers,
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to