[squeak-dev] The Trunk: CollectionsTests-tfel.240.mcz

commits at source.squeak.org commits at source.squeak.org
Fri May 1 09:04:47 UTC 2015


Tim Felgentreff uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-tfel.240.mcz

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

Name: CollectionsTests-tfel.240
Author: tfel
Time: 1 May 2015, 11:04:36.037 am
UUID: 74204945-fbd6-6c49-9348-caafa98fb628
Ancestors: CollectionsTests-mt.239

Add a test case to check that ByteString>>findSubstring:in:startingAt:matchTable: behaves the same way as the primitive implementation (esp when using a negative index for startingAt:)

=============== Diff against CollectionsTests-mt.239 ===============

Item was added:
+ ----- Method: StringTest>>testFindSubstringInStartingAtMatchTable (in category 'tests - finding') -----
+ testFindSubstringInStartingAtMatchTable
+ 
+ 	| str tbl cm |
+ 	str := 'hello '.
+ 	tbl := String classPool at: #CaseSensitiveOrder.
+ 	self assert: (str findSubstring: ' ' in: str startingAt: 1 matchTable: tbl) = 6.
+ 	self assert: (str findSubstring: 'q' in: str startingAt: 1 matchTable: tbl) = 0.
+ 	self assert: (str findSubstring: 'q' in: str startingAt: -1 matchTable: tbl) = 0.
+ 	self assert: (str findSubstring: ' ' in: str startingAt: -1 matchTable: tbl) = 6.
+ 
+ 	"The next test ensures that the fallback code works just as well"
+ 	cm := (CompiledMethod newFrom: (ByteString >> #findSubstring:in:startingAt:matchTable:)).
+ 	cm objectAt: 1 put: (cm header bitAnd: 16r1FF bitInvert).
+ 	self assert: (cm valueWithReceiver: str arguments: {' '. str. 1. tbl}) = 6.
+ 	self assert: (cm valueWithReceiver: str arguments: {'q'. str. 1. tbl}) = 0.
+ 	self assert: (cm valueWithReceiver: str arguments: {'q'. str. -1. tbl}) = 0.
+ 	self assert: (cm valueWithReceiver: str arguments: {' '. str. -1. tbl}) = 6.
+ !



More information about the Squeak-dev mailing list