Nicolas Cellier uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-nice.62.mcz==================== Summary ====================
Name: Tests-nice.62
Author: nice
Time: 15 March 2010, 8:41:26.192 pm
UUID: 091c62fa-a36d-b246-8375-434167aa9d3e
Ancestors: Tests-cmm.61
Fix testReadIntoStartingAtCount
=============== Diff against Tests-cmm.61 ===============
Item was changed:
----- Method: FileStreamTest>>testReadIntoStartingAtCount (in category 'as yet unclassified') -----
testReadIntoStartingAtCount
| filename file |
filename := 'filestream.tst'.
[ | writeBuffer readBuffer bytesRead |
writeBuffer := (ByteArray new: 2500)
atAllPut: 1 ;
yourself.
(StandardFileStream forceNewFileNamed: filename)
binary ;
nextPutAll: writeBuffer ;
close.
file := StandardFileStream readOnlyFileNamed: filename.
readBuffer := ByteArray new: 400.
bytesRead := file
readInto: readBuffer
startingAt: 10
count: 100.
self assert: bytesRead = 100.
"quick test"
self assert: (readBuffer occurrencesOf: 1) = 100.
"compare test"
1 to: readBuffer size do:
[ : n | self assert:
+ (readBuffer at: n) = ((n between: 10 and: 10 + 100 - 1)
+ ifTrue: [ writeBuffer at: n ]
- ((readBuffer at: n) = (n between: 10 and: 10 + 100 - 1)
- ifTrue: [ (writeBuffer at: n) ]
ifFalse: [ 0 ]) ] ]
ensure:
[ file ifNotNil: [ file close ].
FileDirectory default
deleteFileNamed: filename
ifAbsent: [ "ok" ] ]!