Fixed allSelectorsSent because a simpler implementation was overriding the original.
[cslatevm.git] / tests / regression / collection.slate
blob1daa5b696c0cc28e0a88a37f831fd018cca7adbd
1 RegressionTests addPrototype: #CollectionHash derivedFrom: {TestCase}.
2 "Checks whether hash value for collections with same elements is equal."
4 t@(RegressionTests CollectionHash traits) testCollection: c1 against: c2
6   t assert: c1 = c2
7     description: c1 printString ; ' and ' ; c2 printString ; ' are not equal.'.
8   t assert: c1 hash = c2 hash
9     description: c1 printString ; ' and ' ; c2 printString ; ' hashes differ.'
12 t@(RegressionTests CollectionHash traits) testCollection
14   c1 ::= Set newWith: #a.
15   c2 ::= Set newWith: #a.
16   t testCollection: c1 against: c2.
17   
18   { 1. 16r10000000. #a. 'string'. {0. 2}. Set. 0. 2. 3. 4. 5. 6. 7. 8.
19     9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20 } do: 
20     [| :e | c1 include: e. c2 include: e].
21   t testCollection: c1 against: c2
24 t@(RegressionTests CollectionHash traits) testSequence
25 [| s1 s2 |
26   s1 := {0. 1. 2. #a. 'foo'}.
27   s2 := {0. 1. 2. #a. 'foo'}.
28   t testCollection: s1 against: s2.
30   s1 := s1 as: ExtensibleArray.
31   s2 := s2 as: ExtensibleArray.
32   s1 addAll: {{}. #k. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0}.
33   s2 addAll: {{}. #k. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0}.
34   t testCollection: s1 against: s2.
37 t@(RegressionTests CollectionHash traits) suite
38 [t suiteForSelectors: {
39   #testCollection.
40   #testSequence.
41 }].
43 RegressionTests addPrototype: #ExtSeqWriter derivedFrom: {TestCase}.
44 "Checks whether writer iterator of ExtensibleSequence is actually able to
45 extend the sequence."
47 t@(RegressionTests ExtSeqWriter traits) testWriting
49   s ::= ExtensibleArray new.
50   w ::= s writer.
51   w ; {#a. 0. {}. lobby}.
52   t assert: w contents = s.
53   t assert: s size = 4
56 t@(RegressionTests ExtSeqWriter traits) suite
57 [t suiteForSelectors: {
58   #testWriting.
59 }].