The Trunk: CollectionsTests-nice.353.mcz

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

The Trunk: CollectionsTests-nice.353.mcz

commits-2
Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.353.mcz

==================== Summary ====================

Name: CollectionsTests-nice.353
Author: nice
Time: 3 March 2021, 3:13:55.90362 pm
UUID: 027a743c-cd7c-f548-98a8-7879e0fe1e36
Ancestors: CollectionsTests-nice.352

More thorough tests for optimized RunArray (companion change of Collections-nice.464)

Note that those added tests lazily use well known collection class results as reference.

This remasters CollectionsTests-nice.331
UUID: 0cbb84b5-6678-4fd0-bdee-73bd660b7a50
which is a false ancestor (the name conflict with trunk version), and thus moved to treated.

=============== Diff against CollectionsTests-nice.352 ===============

Item was added:
+ ----- Method: RunArrayTest>>testAddRemove (in category 'tests - instance creation') -----
+ testAddRemove
+ | reference runArray |
+ reference := 'aaabcddcccbba' asOrderedCollection.
+ runArray := reference as: RunArray.
+ #((#addLast: $a) (#addLast: $d) (#addFirst: $a) (#addFirst: $d)
+ (#remove: $b) (#remove: $d) (#remove: $a) (#removeAll))
+ do: [:selectorAndArgs |
+ reference perform: selectorAndArgs first withArguments: selectorAndArgs allButFirst.
+ runArray perform: selectorAndArgs first withArguments: selectorAndArgs allButFirst.
+ self assert: (reference as: RunArray)
+ equals: runArray].!

Item was added:
+ ----- Method: RunArrayTest>>testCopy (in category 'tests - instance creation') -----
+ testCopy
+ | reference runArray |
+ reference := 'aaabcddcccbba'.
+ runArray := reference as: RunArray.
+ #((#copyFrom:to: 2 9) (#copyFrom:to: 3 2) (#copyEmpty) (#copyWith: $e) (#copyWith: $a)
+ (#copyUpTo: $d) (#copyUpToLast: $c) (#copyUpThrough: $d))
+ do: [:selectorAndArgs |
+ self assert: ((reference perform: selectorAndArgs first withArguments: selectorAndArgs allButFirst) as: RunArray)
+ equals: (runArray perform: selectorAndArgs first withArguments: selectorAndArgs allButFirst)].!

Item was added:
+ ----- Method: RunArrayTest>>testIndexOf (in category 'tests - instance creation') -----
+ testIndexOf
+ | reference runArray |
+ reference := 'aaabcddcccbba'.
+ runArray := reference as: RunArray.
+ #((#indexOf: $d) (#lastIndexOf: $c) (#indexOf: $e) (#indexOfAnyOf: 'cd') (#lastIndexOfAnyOf: 'cd') (#lastIndexOf: $e)
+ (#indexOf:startingAt: $a 7) (#lastIndexOf:startingAt: $b 7) (#indexOfAnyOf:startingAt: 'cd' 6) (#lastIndexOfAnyOf:startingAt: 'cd' 7))
+ do: [:selectorAndArgs |
+ self assert: (reference perform: selectorAndArgs first withArguments: selectorAndArgs allButFirst)
+ equals: (runArray perform: selectorAndArgs first withArguments: selectorAndArgs allButFirst)].!

Item was added:
+ ----- Method: RunArrayTest>>testSelectAndCollect (in category 'tests - instance creation') -----
+ testSelectAndCollect
+ | reference runArray |
+ reference := 'aaabaccaabb' as: Array.
+ runArray := reference as: RunArray.
+ {{#select: . #isVowel} . {#reject: . #isVowel} .
+ {#collect: . [:e | 'de' atWrap: e codePoint]} . {#replace: . [:e | e codePoint // 2]}}
+ do: [:selectorAndArgs |
+ self assert: ((reference perform: selectorAndArgs first withArguments: selectorAndArgs allButFirst) as: RunArray)
+ equals: (runArray perform: selectorAndArgs first withArguments: selectorAndArgs allButFirst)].!