[squeak-dev] The Inbox: CollectionsTests-ct.362.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Aug 30 18:16:23 UTC 2021
A new version of CollectionsTests was added to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-ct.362.mcz
==================== Summary ====================
Name: CollectionsTests-ct.362
Author: ct
Time: 30 August 2021, 8:16:21.947551 pm
UUID: 9ed95e6d-cd00-b548-a172-dd089cfcf9ee
Ancestors: CollectionsTests-ct.361
Complements Collections-ct.955, supersedes CollectionsTests-ct.358.
=============== Diff against CollectionsTests-ct.361 ===============
Item was added:
+ ----- Method: SortFunctionTest>>testCompareSortBlock (in category 'tests') -----
+ testCompareSortBlock
+
+ | function block |
+ block := [:a :b | a x <= b x and: [a y >= b y]].
+ function := block asCompareSortFunction.
+
+ self assert: (function value: 1 @ 1 value: 1 @ 1).
+ self assert: (function value: 0 @ 1 value: 1 @ 1).
+ self assert: (function value: 1 @ 2 value: 1 @ 1).
+ self deny: (function value: 2 @ 1 value: 1 @ 1).!
Item was added:
+ ----- Method: SortFunctionTest>>testCompareSortFunction (in category 'tests') -----
+ testCompareSortFunction
+
+ "allows for chaining"
+ self assert: ((#(#(1 #a) #(1 #b)) sorted: [:a :b | a first <= b first] asCompareSortFunction, [:a | a second] descending) isSortedBy: [:a | a first] ascending, [:a | a second] descending).
+
+ "supports inequalities"
+ self assert: (#(2 4 5 3 1 6 0) sorted: #< asCompareSortFunction) isSorted.!
Item was added:
+ ----- Method: SortFunctionTest>>testCompareSortSymbol (in category 'tests') -----
+ testCompareSortSymbol
+
+ | function symbol |
+ symbol := #compareSafely:.
+ function := symbol asCompareSortFunction.
+
+ self assert: (function value: true value: nil).
+ self deny: (function value: nil value: true).
+ self assert: (function value: Object new value: true).
+ self deny: (function value: true value: Object new).
+ self assert: (function value: Object new value: nil).
+ self deny: (function value: nil value: Object new).!
More information about the Squeak-dev
mailing list
|