[squeak-dev] The Inbox: CollectionsTests-ct.364.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Sep 7 11:42:21 UTC 2021


A new version of CollectionsTests was added to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-ct.364.mcz

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

Name: CollectionsTests-ct.364
Author: ct
Time: 7 September 2021, 1:42:20.827692 pm
UUID: 02834dfc-8064-f04e-88c8-91fdfa818465
Ancestors: CollectionsTests-ct.361

Tests sorting messages on Dictionary. Complements Collections-ct.958 (#withKeysSorted[:|Safely]).

=============== Diff against CollectionsTests-ct.361 ===============

Item was added:
+ ----- Method: DictionaryTest>>classUnderTest (in category 'accessing') -----
+ classUnderTest
+ 
+ 	^ Dictionary!

Item was added:
+ ----- Method: DictionaryTest>>testKeysSortedSafely (in category 'tests - accessing') -----
+ testKeysSortedSafely
+ 
+ 	self assert: ((Dictionary new
+ 		at: self put: self asString;
+ 		at: self class put: self className;
+ 		at: nil put: nil;
+ 		at: #answer put: 42;
+ 		at: 3.142 put: #pi;
+ 		keysSortedSafely) isSortedBy: #compareSafely:).!

Item was changed:
+ ----- Method: DictionaryTest>>testReplace (in category 'tests') -----
- ----- Method: DictionaryTest>>testReplace (in category 'testing') -----
  testReplace
  	| dict expected |
  	{Dictionary. IdentityDictionary} do: [:class |
  		dict := class newFromPairs:{
  			#first.		1.
  			#second.	2.
  			#third.		3.
  			#fourth.	4.
  			#fifth.		5.
  		}.
  		dict replace: [:each | each asWords].
  		expected := class newFromPairs:{
  			#first.		'one'.
  			#second.	'two'.
  			#third.		'three'.
  			#fourth.	'four'.
  			#fifth.		'five'.
  		}.
  		self assert: dict = expected].!

Item was added:
+ ----- Method: DictionaryTest>>testWithKeysSorted (in category 'tests - sorting') -----
+ testWithKeysSorted
+ 
+ 	| dictionary |
+ 	dictionary := self classUnderTest new
+ 		at: 3 put: #three;
+ 		at: 1 put: #one;
+ 		at: 2 put: #two;
+ 		yourself.
+ 	
+ 	self assert: (dictionary withKeysSorted: [:key | key asWords] descending) equals: (OrderedDictionary new
+ 		at: 2 put: #two;
+ 		at: 3 put: #three;
+ 		at: 1 put: #one;
+ 		yourself).!

Item was added:
+ ----- Method: DictionaryTest>>testWithKeysSortedSafely (in category 'tests - sorting') -----
+ testWithKeysSortedSafely
+ 
+ 	| dictionary |
+ 	dictionary := self classUnderTest new
+ 		at: 3 put: #three;
+ 		at: 1 put: #one;
+ 		at: 2 put: #two;
+ 		yourself.
+ 	
+ 	self assert: dictionary withKeysSortedSafely equals: (OrderedDictionary new
+ 		at: 1 put: #one;
+ 		at: 2 put: #two;
+ 		at: 3 put: #three;
+ 		yourself).!



More information about the Squeak-dev mailing list