tests for Collection classes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

tests for Collection classes

Cyrille Delaunay-3
Hello

I'm Cyrille Delaunay, I work for the RMOD Inria team.
I'm currently working on tests for the Pharo Collection Library using traits.
I've modified, added some traits and therefore redifined things in  
test classes to attempt to get a best coverage.
(For the moment : Arraytest , BagTest , DictionaryTest , IntervalTest  
, OrderedCollectionTest , SetTest , SortedCollectionTest StringTest ,  
SymbolTest , LinkedListTest ).
All modification have been saved in 'PharoTaskForces'.
With a static coverage tool (also saved in PharoTaskPhorces ) removing noise
for each class (methods defined too high in hierarchy that are not  
appropriated ,
private methods ,  very specific methods that may should not be tested  
for collection  ), I got those coverage :

Arraytest : tested at 94.5 %
BagTest : 88.4 %
DictionaryTest:  85 %
IntervalTest : 93 %
OrderedCollectionTest : 93.9%
SetTest : 85.9%
SortedCollectionTest : 92.3 %
StringTest : 91%
LinkedListTest : 90.5 %


Here are the more important modifications i've made about traits :

-> new trait TConvertTest :
        testing converting methods (such that 'asArray,' asBag', .. )


-> new trait  'TSortTrait' :
        testing sorting methods for 'ArrayedCollection'.
  -sort
  -sort:
  -isSorted
  -isSortedBy:


-> new trait: 'TCopySequenceable' :
        testing copying  methods using an order, an index access
        (copyAfter: for example)


-> new trait 'TOccurrencesTest' :
        testing method :
        -> OccurencesOf:


-> new trait:  TIterateSequencedReadableTest'
  testing iterating methods using a specific order
        ( usable therefore only by sequenceable collection )

-> new trait: 'TConcatenaionTest'
      Bad initial version (specific to sequenceable collection)
    Split into two trait:
        -> TSequencedConcatenationTest (initial version)
        -> TConcatenationTest (to do)

- > new trait: 'TReplacementSequencedTest'
        testing replacemnt methods :
        - replaceAll:with:
        - replaceFrom:to:with:
        - replaceFrom:to:with:startingAt:
        for Sequenced Collection

-> Modification of all the methods in 'TIndexAccessingTest'
        making them independent of elements in collection's Type.( so that it  
can be used with all type of sequenceable collection like 'String').

->
        -> modification of all the tests in 'TAsStringAndDelimiterTest'
                making its independent of the elements' type in collection.
                'TAsStringAndDelimiterTest' added to 'ArrayTest'.

        -> redefinition of 'TAsStringCommaAndDelimiterTest' which were  
specific to sequenceable collection (and didn't work for 'BagTest').  
The initial version has been kept in a new trait:
                'TAsStringCommaAndDelimiterSequenceableTest'.


-> with new trait: 'TBeginsEndsWith' testing methods:
        - beginsWith:
        - endsWith:

-> Remodularisation of the initial trait 'TIndexAccessing' (which  
became to big)
        Split into three traits:
        - methods like 'indexOf' added to the New trait 'IndexAccess' .
        - methods concerning 'SubCollectionAccess' added to a new trait:  
'TSubCollectionAccess'.
        - methods concerning elements access added to a new trait :  
'TSequencedElementAccessTest'

->   new trait: 'TPrintTest'
        testing 'stream printing' methods

        Modification of TPrintTest wich was specific to sequenceable
        collections. Initial version has been kept in a new trait :
        TPrintSequencedTest



-> Modification of TConvertTest wich tested some methods
        (asSet, asIdentitySet) for duplicate contents what can't work for  
Interval or Collection without equel elements.
        Creation of a new trait : 'TConvertAsSetForMultiplinessTest'.


-> Remodularisation of TCopySequenceableTest wich were too big.
        Creation of a new trait :

                -> TCopySequenceableSameContents
                        testing copying methods that only change the order of elements  
                        and don't remove or add any elements to the copy.

                -> TCopyPartOfSequenceable
                        testing copying methods that only copy a part of a collection
                        (copyAfter: copyUpTo: )

                -> TCopySequenceableWithOrWithoutSpecificElements
                        testing copying methods ( from the initial trait  
                                TCopySequenceable ) that copy the collection with more or less  
                        specified elements .

                -> 'TCopySequenceableWithReplacement'
                        testing copying methods ( from the initial version of  
                        TSequenceableTest ) that copy and replace subcollections in the  
                        receiver.

-> Refinition of all tests in TIndexAccess so that they required a  
simple collection without equal element and test the 'Standard'  
comportement that come with. Therefore, it can be used by collections  
that don't allowed duplicate elements.
        The aspect of 'multiple occurrences' was puted into a new trait:  
        TIndexAccessForMultipliness
        ( this aspect is important for 'lastIndexOf:' or 'identityIndexOf:'  
for exemple )


-> modification of all methods in TAddTest.
        those methods used always directly 'self collection' to test if an  
element had been added .
        For example : self assert: self collection size = oldsize + 1

        That didn't work if required methods returned a new object at each time
        and not an instance variable of the classTest.
        TAddTest use now its own copies of required collection to be  
independant of the way the method is given by the ClassTest.

-> new trait:
        - TRmoveByIndexTest
        testing methods for removing by index access
        (used at least by OrderedCollection and SortedCollection)

-> new trait:
        - TCopyPartOfSequenceableForMultipliness
        testing the specific comportement with duplicate for methods in
        TCopyPartOfSequenceable.
        TCopyPartOfSequenceable can now be used by collection that don't  
allowed duplicate elements.

-> new traits :
        - TCopySequenceableWithReplacementForSorted
        testing specific comportement of methods like 'copyReplaceAll:with:'  
for sorted collection.

-> redefinition of trait : 'TIterateTest' (in a new trait 'TIterateNew').
        This trait required a specific collection of integer and many tests  
depended on the fact that elements were SmallInteger.
        As this trait test iterating methods for all collections ( it is used  
by 'CollectionRootTest' ), it should work for every kind of  
collection and therfore every kind of elements in ( it should, for  
example, work for 'LinkedList' that use 'Link' elements )
        The new trait work now for 'LinkedListTest'.

-> Modification of all tests in 'TIterateSequencedReadableTest'
        ( in the same way and for the same reasons than 'TItereateTest' )

-> Modification of test:
        testAsCommaStringMore
        in trait 'TAsStringCommaAndDelimiterSequenceableTest'
        so that it works also with elements for wich 'asString' return a  
String including ' '.
         (for example: Link new asSTring returns: 'a Link')


-> TConvertTest split into  two Traits.
        All methods converting into a sorted collection are now tested in a  
new trait: TConvertAsSortedTest so that collections that can't  
include 'sortable' elements (LinkedList for example ) can use  
TConvertTest.
        TConvertAsSorted is specific to collection that can include sortable  
elements.


-> Modification of TConvertTest wich tested some methods
        (asSet, asIdentitySet) for duplicate contents what can't work for  
Interval or Collection without equel elements.
        Creation of a new trait : 'TConvertAsSetForMultiplinessTest'.


-> Remodularisation of TCopySequenceableTest wich were too big.
        Creation of a new trait :

                -> TCopySequenceableSameContents
                        testing copying methods that only change the order of elements  
                        and don't remove or add any elements to the copy.

                -> TCopyPartOfSequenceable
                        testing copying methods that only copy a part of a collection
                        (copyAfter: copyUpTo: )

                -> TCopySequenceableWithOrWithoutSpecificElements
                        testing copying methods ( from the initial trait  
                                TCopySequenceable ) that copy the collection with more or less  
                        specified elements .

                -> 'TCopySequenceableWithReplacement'
                        testing copying methods ( from the initial version of  
                        TSequenceableTest ) that copy and replace subcollections in the  
                        receiver.

-> Refinition of all tests in TIndexAccess so that they required a  
simple collection without equal element and test the 'Standard'  
comportement that come with. Therefore, it can be used by collections  
that don't allowed duplicate elements.
        The aspect of 'multiple occurrences' was puted into a new trait:  
        TIndexAccessForMultipliness
        ( this aspect is important for 'lastIndexOf:' or 'identityIndexOf:'  
for exemple )


-> modification of all methods in TAddTest.
        those methods used always directly 'self collection' to test if an  
element had been added .
        For example : self assert: self collection size = oldsize + 1

        That didn't work if required methods returned a new object at each time
        and not an instance variable of the classTest.
        TAddTest use now its own copies of required collection to be  
independant of the way the method is given by the ClassTest.

-> new trait:
        - TRmoveByIndexTest
        testing methods for removing by index access
        (used at least by OrderedCollection and SortedCollection)

-> new trait:
        - TCopyPartOfSequenceableForMultipliness
        testing the specific comportement with duplicate for methods in
        TCopyPartOfSequenceable.
        TCopyPartOfSequenceable can now be used by collection that don't  
allowed duplicate elements.

-> new traits :
        - TCopySequenceableWithReplacementForSorted
        testing specific comportement of methods like 'copyReplaceAll:with:'  
for sorted collection.

-> redefinition of trait : 'TIterateTest' (in a new trait 'TIterateNew').
        This trait required a specific collection of integer and many tests  
depended on the fact that elements were SmallInteger.
        As this trait test iterating methods for all collections ( it is used  
by 'CollectionRootTest' ), it should work for every kind of  
collection and therfore every kind of elements in ( it should, for  
example, work for 'LinkedList' that use 'Link' elements )
        The new trait work now for 'LinkedListTest'.

-> Modification of all tests in 'TIterateSequencedReadableTest'
        ( in the same way and for the same reasons than 'TItereateTest' )

-> Modification of test:
        testAsCommaStringMore
        in trait 'TAsStringCommaAndDelimiterSequenceableTest'
        so that it works also with elements for wich 'asString' return a  
String including ' '.
         (for example: Link new asSTring returns: 'a Link')


-> TConvertTest split into  two Traits.
        All methods converting into a sorted collection are now tested in a  
new trait: TConvertAsSortedTest so that collections that can't  
include 'sortable' elements (LinkedList for example ) can use  
TConvertTest.
        TConvertAsSorted is specific to collection that can include sortable  
elements.


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: tests for Collection classes

Damien Cassou
On Thu, Apr 30, 2009 at 10:33 AM, Cyrille Delaunay
<[hidden email]> wrote:

> Hello
>
> I'm Cyrille Delaunay, I work for the RMOD Inria team.
> I'm currently working on tests for the Pharo Collection Library using traits.
> I've modified, added some traits and therefore redifined things in
> test classes to attempt to get a best coverage.
> (For the moment : Arraytest , BagTest , DictionaryTest , IntervalTest
> , OrderedCollectionTest , SetTest , SortedCollectionTest StringTest ,
> SymbolTest , LinkedListTest ).
> All modification have been saved in 'PharoTaskForces'.
> With a static coverage tool (also saved in PharoTaskPhorces ) removing noise
> for each class (methods defined too high in hierarchy that are not
> appropriated ,
> private methods ,  very specific methods that may should not be tested
> for collection  ), I got those coverage :

Hi Cyrille,

thank you very much. This is very nice work. Hope to see that in Pharo soon.

Thank you

--
Damien Cassou
http://damiencassou.seasidehosting.st

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: tests for Collection classes

Stéphane Ducasse
I will integrate it soon

Stef

On Apr 30, 2009, at 11:39 AM, Damien Cassou wrote:

> On Thu, Apr 30, 2009 at 10:33 AM, Cyrille Delaunay
> <[hidden email]> wrote:
>> Hello
>>
>> I'm Cyrille Delaunay, I work for the RMOD Inria team.
>> I'm currently working on tests for the Pharo Collection Library  
>> using traits.
>> I've modified, added some traits and therefore redifined things in
>> test classes to attempt to get a best coverage.
>> (For the moment : Arraytest , BagTest , DictionaryTest , IntervalTest
>> , OrderedCollectionTest , SetTest , SortedCollectionTest StringTest ,
>> SymbolTest , LinkedListTest ).
>> All modification have been saved in 'PharoTaskForces'.
>> With a static coverage tool (also saved in PharoTaskPhorces )  
>> removing noise
>> for each class (methods defined too high in hierarchy that are not
>> appropriated ,
>> private methods ,  very specific methods that may should not be  
>> tested
>> for collection  ), I got those coverage :
>
> Hi Cyrille,
>
> thank you very much. This is very nice work. Hope to see that in  
> Pharo soon.
>
> Thank you
>
> --
> Damien Cassou
> http://damiencassou.seasidehosting.st
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: tests for Collection classes

Stéphane Ducasse
In reply to this post by Cyrille Delaunay-3
http://code.google.com/p/pharo/issues/detail?id=784


On Apr 30, 2009, at 10:33 AM, Cyrille Delaunay wrote:

> Hello
>
> I'm Cyrille Delaunay, I work for the RMOD Inria team.
> I'm currently working on tests for the Pharo Collection Library  
> using traits.
> I've modified, added some traits and therefore redifined things in
> test classes to attempt to get a best coverage.
> (For the moment : Arraytest , BagTest , DictionaryTest , IntervalTest
> , OrderedCollectionTest , SetTest , SortedCollectionTest StringTest ,
> SymbolTest , LinkedListTest ).
> All modification have been saved in 'PharoTaskForces'.
> With a static coverage tool (also saved in PharoTaskPhorces )  
> removing noise
> for each class (methods defined too high in hierarchy that are not
> appropriated ,
> private methods ,  very specific methods that may should not be tested
> for collection  ), I got those coverage :
>
> Arraytest : tested at 94.5 %
> BagTest : 88.4 %
> DictionaryTest:  85 %
> IntervalTest : 93 %
> OrderedCollectionTest : 93.9%
> SetTest : 85.9%
> SortedCollectionTest : 92.3 %
> StringTest : 91%
> LinkedListTest : 90.5 %
>
>
> Here are the more important modifications i've made about traits :
>
> -> new trait TConvertTest :
> testing converting methods (such that 'asArray,' asBag', .. )
>
>
> -> new trait  'TSortTrait' :
> testing sorting methods for 'ArrayedCollection'.
>   -sort
>   -sort:
>   -isSorted
>   -isSortedBy:
>
>
> -> new trait: 'TCopySequenceable' :
> testing copying  methods using an order, an index access
> (copyAfter: for example)
>
>
> -> new trait 'TOccurrencesTest' :
> testing method :
> -> OccurencesOf:
>
>
> -> new trait:  TIterateSequencedReadableTest'
>   testing iterating methods using a specific order
> ( usable therefore only by sequenceable collection )
>
> -> new trait: 'TConcatenaionTest'
>       Bad initial version (specific to sequenceable collection)
>   Split into two trait:
> -> TSequencedConcatenationTest (initial version)
> -> TConcatenationTest (to do)
>
> - > new trait: 'TReplacementSequencedTest'
> testing replacemnt methods :
> - replaceAll:with:
> - replaceFrom:to:with:
> - replaceFrom:to:with:startingAt:
> for Sequenced Collection
>
> -> Modification of all the methods in 'TIndexAccessingTest'
> making them independent of elements in collection's Type.( so that it
> can be used with all type of sequenceable collection like 'String').
>
> ->
> -> modification of all the tests in 'TAsStringAndDelimiterTest'
> making its independent of the elements' type in collection.
> 'TAsStringAndDelimiterTest' added to 'ArrayTest'.
>
> -> redefinition of 'TAsStringCommaAndDelimiterTest' which were
> specific to sequenceable collection (and didn't work for 'BagTest').
> The initial version has been kept in a new trait:
> 'TAsStringCommaAndDelimiterSequenceableTest'.
>
>
> -> with new trait: 'TBeginsEndsWith' testing methods:
> - beginsWith:
> - endsWith:
>
> -> Remodularisation of the initial trait 'TIndexAccessing' (which
> became to big)
> Split into three traits:
> - methods like 'indexOf' added to the New trait 'IndexAccess' .
> - methods concerning 'SubCollectionAccess' added to a new trait:
> 'TSubCollectionAccess'.
> - methods concerning elements access added to a new trait :
> 'TSequencedElementAccessTest'
>
> ->   new trait: 'TPrintTest'
> testing 'stream printing' methods
>
> Modification of TPrintTest wich was specific to sequenceable
> collections. Initial version has been kept in a new trait :
> TPrintSequencedTest
>
>
>
> -> Modification of TConvertTest wich tested some methods
> (asSet, asIdentitySet) for duplicate contents what can't work for
> Interval or Collection without equel elements.
> Creation of a new trait : 'TConvertAsSetForMultiplinessTest'.
>
>
> -> Remodularisation of TCopySequenceableTest wich were too big.
> Creation of a new trait :
>
> -> TCopySequenceableSameContents
> testing copying methods that only change the order of elements
> and don't remove or add any elements to the copy.
>
> -> TCopyPartOfSequenceable
> testing copying methods that only copy a part of a collection
> (copyAfter: copyUpTo: )
>
> -> TCopySequenceableWithOrWithoutSpecificElements
> testing copying methods ( from the initial trait
> TCopySequenceable ) that copy the collection with more or less
> specified elements .
>
> -> 'TCopySequenceableWithReplacement'
> testing copying methods ( from the initial version of
> TSequenceableTest ) that copy and replace subcollections in the
> receiver.
>
> -> Refinition of all tests in TIndexAccess so that they required a
> simple collection without equal element and test the 'Standard'
> comportement that come with. Therefore, it can be used by collections
> that don't allowed duplicate elements.
> The aspect of 'multiple occurrences' was puted into a new trait:
> TIndexAccessForMultipliness
> ( this aspect is important for 'lastIndexOf:' or 'identityIndexOf:'
> for exemple )
>
>
> -> modification of all methods in TAddTest.
> those methods used always directly 'self collection' to test if an
> element had been added .
> For example : self assert: self collection size = oldsize + 1
>
> That didn't work if required methods returned a new object at each  
> time
> and not an instance variable of the classTest.
> TAddTest use now its own copies of required collection to be
> independant of the way the method is given by the ClassTest.
>
> -> new trait:
> - TRmoveByIndexTest
> testing methods for removing by index access
> (used at least by OrderedCollection and SortedCollection)
>
> -> new trait:
> - TCopyPartOfSequenceableForMultipliness
> testing the specific comportement with duplicate for methods in
> TCopyPartOfSequenceable.
> TCopyPartOfSequenceable can now be used by collection that don't
> allowed duplicate elements.
>
> -> new traits :
> - TCopySequenceableWithReplacementForSorted
> testing specific comportement of methods like 'copyReplaceAll:with:'
> for sorted collection.
>
> -> redefinition of trait : 'TIterateTest' (in a new trait  
> 'TIterateNew').
> This trait required a specific collection of integer and many tests
> depended on the fact that elements were SmallInteger.
> As this trait test iterating methods for all collections ( it is used
> by 'CollectionRootTest' ), it should work for every kind of
> collection and therfore every kind of elements in ( it should, for
> example, work for 'LinkedList' that use 'Link' elements )
> The new trait work now for 'LinkedListTest'.
>
> -> Modification of all tests in 'TIterateSequencedReadableTest'
> ( in the same way and for the same reasons than 'TItereateTest' )
>
> -> Modification of test:
> testAsCommaStringMore
> in trait 'TAsStringCommaAndDelimiterSequenceableTest'
> so that it works also with elements for wich 'asString' return a
> String including ' '.
> (for example: Link new asSTring returns: 'a Link')
>
>
> -> TConvertTest split into  two Traits.
> All methods converting into a sorted collection are now tested in a
> new trait: TConvertAsSortedTest so that collections that can't
> include 'sortable' elements (LinkedList for example ) can use
> TConvertTest.
> TConvertAsSorted is specific to collection that can include sortable
> elements.
>
>
> -> Modification of TConvertTest wich tested some methods
> (asSet, asIdentitySet) for duplicate contents what can't work for
> Interval or Collection without equel elements.
> Creation of a new trait : 'TConvertAsSetForMultiplinessTest'.
>
>
> -> Remodularisation of TCopySequenceableTest wich were too big.
> Creation of a new trait :
>
> -> TCopySequenceableSameContents
> testing copying methods that only change the order of elements
> and don't remove or add any elements to the copy.
>
> -> TCopyPartOfSequenceable
> testing copying methods that only copy a part of a collection
> (copyAfter: copyUpTo: )
>
> -> TCopySequenceableWithOrWithoutSpecificElements
> testing copying methods ( from the initial trait
> TCopySequenceable ) that copy the collection with more or less
> specified elements .
>
> -> 'TCopySequenceableWithReplacement'
> testing copying methods ( from the initial version of
> TSequenceableTest ) that copy and replace subcollections in the
> receiver.
>
> -> Refinition of all tests in TIndexAccess so that they required a
> simple collection without equal element and test the 'Standard'
> comportement that come with. Therefore, it can be used by collections
> that don't allowed duplicate elements.
> The aspect of 'multiple occurrences' was puted into a new trait:
> TIndexAccessForMultipliness
> ( this aspect is important for 'lastIndexOf:' or 'identityIndexOf:'
> for exemple )
>
>
> -> modification of all methods in TAddTest.
> those methods used always directly 'self collection' to test if an
> element had been added .
> For example : self assert: self collection size = oldsize + 1
>
> That didn't work if required methods returned a new object at each  
> time
> and not an instance variable of the classTest.
> TAddTest use now its own copies of required collection to be
> independant of the way the method is given by the ClassTest.
>
> -> new trait:
> - TRmoveByIndexTest
> testing methods for removing by index access
> (used at least by OrderedCollection and SortedCollection)
>
> -> new trait:
> - TCopyPartOfSequenceableForMultipliness
> testing the specific comportement with duplicate for methods in
> TCopyPartOfSequenceable.
> TCopyPartOfSequenceable can now be used by collection that don't
> allowed duplicate elements.
>
> -> new traits :
> - TCopySequenceableWithReplacementForSorted
> testing specific comportement of methods like 'copyReplaceAll:with:'
> for sorted collection.
>
> -> redefinition of trait : 'TIterateTest' (in a new trait  
> 'TIterateNew').
> This trait required a specific collection of integer and many tests
> depended on the fact that elements were SmallInteger.
> As this trait test iterating methods for all collections ( it is used
> by 'CollectionRootTest' ), it should work for every kind of
> collection and therfore every kind of elements in ( it should, for
> example, work for 'LinkedList' that use 'Link' elements )
> The new trait work now for 'LinkedListTest'.
>
> -> Modification of all tests in 'TIterateSequencedReadableTest'
> ( in the same way and for the same reasons than 'TItereateTest' )
>
> -> Modification of test:
> testAsCommaStringMore
> in trait 'TAsStringCommaAndDelimiterSequenceableTest'
> so that it works also with elements for wich 'asString' return a
> String including ' '.
> (for example: Link new asSTring returns: 'a Link')
>
>
> -> TConvertTest split into  two Traits.
> All methods converting into a sorted collection are now tested in a
> new trait: TConvertAsSortedTest so that collections that can't
> include 'sortable' elements (LinkedList for example ) can use
> TConvertTest.
> TConvertAsSorted is specific to collection that can include sortable
> elements.
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>


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