[squeak-dev] The Trunk: CollectionsTests-nice.284.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Nov 26 21:42:13 UTC 2017


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

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

Name: CollectionsTests-nice.284
Author: nice
Time: 8 November 2017, 12:33:12.625652 am
UUID: dc0e00e8-72ad-4698-a05c-fe0fba0bf7dc
Ancestors: CollectionsTests-nice.283

Update tests for SortFunction refactorings

=============== Diff against CollectionsTests-nice.283 ===============

Item was changed:
  SystemOrganization addCategory: #'CollectionsTests-Abstract'!
  SystemOrganization addCategory: #'CollectionsTests-Arrayed'!
  SystemOrganization addCategory: #'CollectionsTests-Sequenceable'!
+ SystemOrganization addCategory: #'CollectionsTests-SortFunctions'!
  SystemOrganization addCategory: #'CollectionsTests-Stack'!
  SystemOrganization addCategory: #'CollectionsTests-Streams'!
  SystemOrganization addCategory: #'CollectionsTests-Support'!
  SystemOrganization addCategory: #'CollectionsTests-Text'!
  SystemOrganization addCategory: #'CollectionsTests-Unordered'!
  SystemOrganization addCategory: #'CollectionsTests-Weak'!

Item was changed:
  TestCase subclass: #ChainedSortFunctionTest
  	instanceVariableNames: ''
  	classVariableNames: ''
  	poolDictionaries: ''
+ 	category: 'CollectionsTests-SortFunctions'!
- 	category: 'CollectionsTests-Support'!

Item was added:
+ ----- Method: ChainedSortFunctionTest>>testComparisonOfFunctions (in category 'tests') -----
+ testComparisonOfFunctions
+ 
+ 	self assert: #name ascending, #surname equals: #name ascending, #surname.
+ 	self assert: (#name ascending, #surname) hash equals: (#name ascending, #surname) hash.
+ 
+ 	self deny: #name ascending, #surname = (#name ascending, #surname2).
+ 	self deny: #name ascending, #surname = (#name descending, #surname).
+ 	self deny: #name ascending, #surname ascending = (#name ascending, #surname descending).!

Item was changed:
  TestCase subclass: #SortFunctionTest
  	instanceVariableNames: ''
  	classVariableNames: ''
  	poolDictionaries: ''
+ 	category: 'CollectionsTests-SortFunctions'!
- 	category: 'CollectionsTests-Support'!

Item was added:
+ ----- Method: SortFunctionTest>>testAsSortFunction (in category 'tests') -----
+ testAsSortFunction
+ 	| function |
+ 	function := #name ascending.
+ 	self assert: function equals: function asSortFunction.
+ 	function := #name asSortFunction.
+ 	self assert: function equals: function asSortFunction.
+ 	function := [ :each | each name ] ascending.
+ 	self assert: function equals: function asSortFunction.
+ 	function := [ :x :y | x <=> y ] asSortFunction.
+ 	self assert: function equals: function asSortFunction.!

Item was added:
+ ----- Method: SortFunctionTest>>testComparisonOfFunctionsDefinedByBlock (in category 'tests') -----
+ testComparisonOfFunctionsDefinedByBlock
+ 	| collatorBlock |
+ 	collatorBlock := [ :a :b | 1 ].
+ 	
+ 	self assert: collatorBlock ascending equals: collatorBlock ascending.
+ 	self assert: collatorBlock ascending hash equals: collatorBlock ascending hash.
+ 	
+ 	self deny: collatorBlock ascending = collatorBlock descending.
+ 	self deny: collatorBlock ascending = [ :a :b | -1 ] ascending!

Item was added:
+ ----- Method: SortFunctionTest>>testComparisonOfFunctionsDefinedBySymbol (in category 'tests') -----
+ testComparisonOfFunctionsDefinedBySymbol
+ 
+ 	self assert: #name ascending equals: #name ascending.
+ 	self assert: #name ascending hash equals: #name ascending hash.
+ 	
+ 	self deny: #name ascending = #name descending.
+ 	self deny: #name ascending = #name2 ascending.
+ 	self deny: #name ascending undefinedFirst = #name ascending undefinedLast!

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 reversed.
- 	function := 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 reversed.
- 	function := 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 changed:
  ----- Method: SortFunctionTest>>testPropertyWithOddCollator (in category 'tests') -----
  testPropertyWithOddCollator
  
  	| function |
+ 	function := #y collatedBy: [:a :b | "sort the odd first" (b bitAnd: 1) - (a bitAnd: 1)].
- 	function := #y sortedWith: [:a :b | "sort the odd first" (b bitAnd: 1) - (a bitAnd: 1)].
  	self assert: (function value: 0 at 1 value: 0 at 0).
  	self assert: (function value: 0 at 1 value: 0 at 2).
  	self deny: (function value: 0 at 2 value: 0 at 1).
  	self deny: (function value: 0 at 2 value: 0 at 3).!

Item was added:
+ ----- Method: SortFunctionTest>>testUndefinedFirstUnary (in category 'tests') -----
+ testUndefinedFirstUnary
+ 
+ 	| function |
+ 	function := #y ascending undefinedFirst.
+ 	self assert: (function value: 0 @ nil value: 1 @ 1).
+ 	self assert: (function value: 1 @ 2 value: 1 @ 2).
+ 	self deny: (function value: 2 @ 2 value: 1 @ 1).
+ 	function := #y descending undefinedFirst.
+ 	self assert: (function value: 1 @ nil value: 2 @ 1).
+ 	self deny: (function value: 1 @ 2 value: 1 @ 3).
+ 	self deny: (function value: 2 @ 2 value: 1 @ 3)!

Item was added:
+ ----- Method: SortFunctionTest>>testUndefinedLastUnary (in category 'tests') -----
+ testUndefinedLastUnary
+ 
+ 	| function |
+ 	function := #y ascending undefinedLast.
+ 	self assert: (function value: 0 @ 2 value: 1 @ nil).
+ 	self assert: (function value: 1 @ 2 value: 1 @ 2).
+ 	self deny: (function value: 2 @ 2 value: 1 @ 1).
+ 	function := #y descending undefinedLast.
+ 	self assert: (function value: 1 @ 2 value: 2 @ nil).
+ 	self deny: (function value: 1 @ 2 value: 1 @ 3).
+ 	self deny: (function value: 2 @ 2 value: 1 @ 3)!

Item was changed:
  TestCase subclass: #TestSpaceshipOperator
  	instanceVariableNames: ''
  	classVariableNames: ''
  	poolDictionaries: ''
+ 	category: 'CollectionsTests-SortFunctions'!
- 	category: 'CollectionsTests-Support'!

Item was added:
+ ----- Method: TestSpaceshipOperator>>testIntegers (in category 'tests') -----
+ testIntegers
+ 	self assert: (42 <=> 42) equals: 0.
+ 	self assert: (1 <=> 42) equals: -1.
+ 	self assert: (100 <=> 42) equals: 1!



More information about the Squeak-dev mailing list