[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[s8] hashed collections

"HashedSet with #toString and #valueOf"
| array test |
array := #(1 2 #new #point #window #toString #valueOf #() nil last).
test := HashedSet withAll: array.

test size = array size ifFalse: [ self error: 'Wrong size' ].
test asArray sorted asLiteral = array sorted asLiteral ifFalse: [ self error: 'Invalid contents' ].

(test includes: #missing) ifTrue: [ self error: 'Includes #missing' ].

(test includes: #toString) ifFalse: [ self error: '#toString is missing' ].

#ok 


"PoolDictionary with #toString and #valueOf"
| array test |
array := #(1 2 #new #point #window #toString #valueOf #() nil last).
test := PoolDictionary new.
array do: [:each| test at: each toString put: each ].

test size = array size ifFalse: [ self error: 'Wrong size' ].
test values asArray sorted asLiteral = array sorted asLiteral ifFalse: [ self error: 'Invalid contents' ].
 
(test includesKey: #missing) ifTrue: [ self error: 'Includes #missing' ].

(test includesKey: #toString) ifFalse: [ self error: '#toString is missing' ].

#ok