[squeak-dev] The Trunk: CollectionsTests-nice.308.mcz

commits at source.squeak.org commits at source.squeak.org
Tue May 7 07:28:51 UTC 2019


Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.308.mcz

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

Name: CollectionsTests-nice.308
Author: nice
Time: 7 May 2019, 9:28:47.605099 am
UUID: 682eef1e-7191-404d-b11a-4078704d76f3
Ancestors: CollectionsTests-pre.307, CollectionsTests-nice.195

Merge CollectionsTests-pre.307, CollectionsTests-nice.195

Let's use add:withOccurrences: now that addLast:times: is deprecated

=============== Diff against CollectionsTests-pre.307 ===============

Item was changed:
  ----- Method: TextAndTextStreamTest>>testRunArrayAdjacentMerge (in category 'tests') -----
  testRunArrayAdjacentMerge
  
  	"this demonstrates that adjancent runs with equal attributes are merged. "
  	| runArray |
  	runArray := RunArray new.
  	runArray 
+ 		add: TextEmphasis normal withOccurrences: 5;
+ 		add: TextEmphasis bold withOccurrences: 5;
+ 		add: TextEmphasis bold withOccurrences: 5.
- 		addLast: TextEmphasis normal times: 5;
- 		addLast: TextEmphasis bold times: 5;
- 		addLast: TextEmphasis bold times: 5.
  	self assert: (runArray runs size = 2). !

Item was changed:
  ----- Method: TextAndTextStreamTest>>testRunArrayInvariant (in category 'tests') -----
  testRunArrayInvariant
  
  	"this verifies that the fundamental invariant of a RunArray is always satisfied. "
  	"see comment below"
  	| runArray |
  	runArray := RunArray new.
  	runArray 
+ 		add: TextEmphasis normal withOccurrences: 5;
+ 		add: TextEmphasis bold withOccurrences: 5;
+ 		add: TextEmphasis normal withOccurrences: 5.
- 		addLast: TextEmphasis normal times: 5;
- 		addLast: TextEmphasis bold times: 5;
- 		addLast: TextEmphasis normal times: 5.
  	self assert:
         ((1 to: runArray size) allSatisfy:
             [:idx |  | lastIndex lastOffset lastRun lengthOfPreviousRuns |
                 runArray at: idx.  " updates the cached values "
                 lastIndex := runArray instVarNamed: 'lastIndex'.
                 lastRun := runArray instVarNamed: 'lastRun'.
                 lastOffset := runArray instVarNamed: 'lastOffset'.
                 lengthOfPreviousRuns 
                     := (1 to: lastRun - 1)
                        inject: 0
                         into: [:sum :idx2 | sum + (runArray runs at: idx2)].
                 lastIndex = (lastOffset + lengthOfPreviousRuns + 1) 
             ]
         ). 
  
  " This method is a bit tricky. First, it uses Object>>instVarNamed: to access instance variables for which no accessors are defined. The same method is used by the debuggers and by various inspectors.
  The assertion itself explains the meaning of the cached values."!

Item was changed:
  ----- Method: TextAndTextStreamTest>>testRunArrayReversal (in category 'tests') -----
  testRunArrayReversal
  
    	"this tests the reversal of a  RunArray "
  	| runArray |
  	runArray := RunArray new.
  	runArray 
+ 		add: TextEmphasis normal withOccurrences: 5;
+ 		add: TextEmphasis bold withOccurrences: 5;
+ 		add: TextEmphasis normal withOccurrences: 5.
- 		addLast: TextEmphasis normal times: 5;
- 		addLast: TextEmphasis bold times: 5;
- 		addLast: TextEmphasis normal times: 5.
  	self assert: (runArray reversed runs size = 3). !

Item was changed:
  ----- Method: TextAndTextStreamTest>>testRunArrayRunsAreNotMerged (in category 'tests') -----
  testRunArrayRunsAreNotMerged
  
  	" this demonstrates that different runs are not merged "
  	| runArray |
  	runArray := RunArray new.
  	runArray 
+ 		add: TextEmphasis normal withOccurrences: 5;
+ 		add: TextEmphasis bold withOccurrences: 5;
+ 		add: TextEmphasis normal withOccurrences: 5.
- 		addLast: TextEmphasis normal times: 5;
- 		addLast: TextEmphasis bold times: 5;
- 		addLast: TextEmphasis normal times: 5.
  	self assert: (runArray runs size = 3). !

Item was changed:
  ----- Method: TextAndTextStreamTest>>testRunArrayRunsSize (in category 'tests') -----
  testRunArrayRunsSize
  
   	"this demonstrates that the size of a run array is the sum of the sizes of its runs. "
  	| runArray |
  	runArray := RunArray new.
    	runArray 
+ 		add: TextEmphasis normal withOccurrences: 5;
+ 		add: TextEmphasis bold withOccurrences: 5;
+ 		add: TextEmphasis normal withOccurrences: 5.
- 		addLast: TextEmphasis normal times: 5;
- 		addLast: TextEmphasis bold times: 5;
- 		addLast: TextEmphasis normal times: 5.
  	self assert: (runArray size = 15). !



More information about the Squeak-dev mailing list