The Trunk: CollectionsTests-nice.283.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.283.mcz

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

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

Name: CollectionsTests-nice.283
Author: nice
Time: 5 November 2017, 11:44:39.51802 pm
UUID: cd2d2262-39d2-4a4d-aa16-7dfd759c1740
Ancestors: CollectionsTests-topa.282

Test the undefinedFirst as proposed by Denis Kudriashov in Pharo.
       
Also test ability of sorting properties with odd collator rather than default <=>

=============== Diff against CollectionsTests-topa.282 ===============

Item was changed:
  ----- Method: SortFunctionTest>>testDirectionToggling (in category 'tests') -----
  testDirectionToggling
 
  | function |
  function := #x ascending.
  self assert: (function value: 0 @ 2 value: 1 @ 1).
  self assert: (function value: 1 @ 2 value: 1 @ 1).
  self deny: (function value: 2 @ 2 value: 1 @ 1).
+ function := function toggleDirection.
- function toggleDirection.
  self deny: (function value: 1 @ 2 value: 2 @ 1).
  self assert: (function value: 1 @ 2 value: 1 @ 1).
  self assert: (function value: 2 @ 2 value: 1 @ 1).
+ function := function toggleDirection.
- function toggleDirection.
  self assert: (function value: 0 @ 2 value: 1 @ 1).
  self assert: (function value: 1 @ 2 value: 1 @ 1).
  self deny: (function value: 2 @ 2 value: 1 @ 1)!

Item was added:
+ ----- Method: SortFunctionTest>>testPropertyWithOddCollator (in category 'tests') -----
+ testPropertyWithOddCollator
+
+ | function |
+ function := #y sortedWith: [:a :b | "sort the odd first" (b bitAnd: 1) - (a bitAnd: 1)].
+ self assert: (function value: 0@1 value: 0@0).
+ self assert: (function value: 0@1 value: 0@2).
+ self deny: (function value: 0@2 value: 0@1).
+ self deny: (function value: 0@2 value: 0@3).!

Item was added:
+ ----- Method: SortFunctionTest>>testUndefinedFirst (in category 'tests') -----
+ testUndefinedFirst
+
+ | function |
+ function := #value ascending undefinedFirst .
+ self assert: (function value: 1->nil value: 2->'foo').
+ self assert: (function collate: 1->nil with: 2->nil) = 0.
+ self assert: (function value: 2->'bar' value: 1->'foo').
+ self deny: (function value: 2->'foo' value: 1->'bar').
+ self deny: (function value: 1->'foo' value: 2->nil).!

Item was added:
+ ----- Method: SortFunctionTest>>testUndefinedLast (in category 'tests') -----
+ testUndefinedLast
+
+ | function |
+ function := #value ascending undefinedLast .
+ self deny: (function value: 1->nil value: 2->'foo').
+ self assert: (function collate: 1->nil with: 2->nil) = 0.
+ self assert: (function value: 2->'bar' value: 1->'foo').
+ self deny: (function value: 2->'foo' value: 1->'bar').
+ self assert: (function value: 1->'foo' value: 2->nil).!