[squeak-dev] The Trunk: Tests-cmm.59.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Mar 15 17:12:34 UTC 2010


Chris Muller uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-cmm.59.mcz

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

Name: Tests-cmm.59
Author: cmm
Time: 15 March 2010, 12:11:54.34 pm
UUID: 4397368b-98a8-4272-827c-97927c574d9b
Ancestors: Tests-ul.58

Added FileStreamTest>>#testReadIntoStartingAtCount.

=============== Diff against Tests-ul.58 ===============

Item was added:
+ ----- 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.
+ 	"quick test"
+ 	self assert: bytesRead = 100.
+ 	"compare test"
+ 	self assert: (bytesRead occurrencesOf: 1) = 100.
+ 	1 to: readBuffer size do:
+ 		[ : n | self assert:
+ 			((readBuffer at: n) = (n between: 10 	and: 10 + 100)
+ 				ifTrue: [ (writeBuffer at: n) ]
+ 				ifFalse: [ 0 ]) ] ]
+ 	ensure:
+ 		[ file ifNotNil: [ file close ].
+ 		FileDirectory default
+ 			deleteFileNamed: filename
+ 			ifAbsent: [ "ok" ] ]!




More information about the Squeak-dev mailing list