The Inbox: CollectionsTests-nice.331.mcz

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

The Inbox: CollectionsTests-nice.331.mcz

commits-2
Nicolas Cellier uploaded a new version of CollectionsTests to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-nice.331.mcz

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

Name: CollectionsTests-nice.331
Author: nice
Time: 31 December 2019, 11:18:12.887244 pm
UUID: 0cbb84b5-6678-4fd0-bdee-73bd660b7a50
Ancestors: CollectionsTests-mt.330

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.

=============== Diff against CollectionsTests-mt.330 ===============

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)].!