The Trunk: CollectionsTests-nice.195.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: CollectionsTests-nice.195.mcz

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

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

Name: CollectionsTests-nice.195
Author: nice
Time: 25 January 2013, 11:13:57.37 pm
UUID: 9c525519-c8dc-49aa-a82f-74d8ae1ebef0
Ancestors: CollectionsTests-ul.194

Let tests use add:withOccurrences: once addLast:times: will be deprecated

=============== Diff against CollectionsTests-ul.194 ===============

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). !