Skip to content

Commit

Permalink
Fix tests for GS64
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Aug 8, 2023
1 parent a62027d commit 713d70b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
20 changes: 10 additions & 10 deletions source/Buoy-Collections-Tests/OrderedSetTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1106,20 +1106,20 @@ OrderedSetTest >> testWriteStream [
nextPut: $d;
nextPut: $e;
nextPut: $f.

"According to ANSI standard it is unspecified whether or not the
returned collection is the same object as the backing store collection.
Se we just test over the stream contents"

self
assert: set size equals: 3;
assert: set first equals: $d;
assert: set second equals: $e;
assert: set last equals: $f.
assert: stream contents size equals: 3;
assert: stream contents first equals: $d;
assert: stream contents second equals: $e;
assert: stream contents last equals: $f.

stream nextPut: $g.

self
assert: set size equals: 3;
assert: set first equals: $d;
assert: set second equals: $e;
assert: set last equals: $f.

self
assert: stream contents size equals: 4;
assert: stream contents first equals: $d;
Expand Down
12 changes: 11 additions & 1 deletion source/Buoy-Collections/OrderedSet.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,17 @@ OrderedSet >> copyReplaceAll: oldSubCollection with: newSubCollection [
{ #category : #copying }
OrderedSet >> copyReplaceFrom: start to: stop with: replacementCollection [

^ self species withAll: ( collection copyReplaceFrom: start to: stop with: replacementCollection )
stop >= start then: [ "When stop>=start this method will do a replacement, otherwise an insertion"
AssertionChecker
enforce: [ stop - start + 1 = replacementCollection size ]
because:
'The replacement collection doesn''t have the expected size.'
raising: SubscriptOutOfBounds ].

^ self species withAll: (collection
copyReplaceFrom: start
to: stop
with: replacementCollection)
]

{ #category : #copying }
Expand Down

0 comments on commit 713d70b

Please sign in to comment.