compiler/tests/extras/PPCExpressionsVerificationTest.st
changeset 502 1e45d3c96ec5
parent 464 f6d77fee9811
equal deleted inserted replaced
464:f6d77fee9811 502:1e45d3c96ec5
    73     compiledParser := self compiledGrammar.
    73     compiledParser := self compiledGrammar.
    74     
    74     
    75     source := fileResources expressionOfSize: 100. 
    75     source := fileResources expressionOfSize: 100. 
    76     result := normalParser parse: source.
    76     result := normalParser parse: source.
    77     
    77     
    78     self assert: ((result deepFlatten select: [ :e | e isNumber ]) size) = 100.
    78     self assert: (((self deepFlattened: result) select: [ :e | e isNumber ]) size) = 100.
    79     self assert: ((result deepFlatten select: [ :e | e isNumber ]) size) = 100.
    79     self assert: (((self deepFlattened: result)select: [ :e | e isNumber ]) size) = 100.
    80 ! !
    80 ! !
    81 
    81 
       
    82 !PPCExpressionsVerificationTest methodsFor:'utilities'!
       
    83 
       
    84 deepFlatten: anObject into: aCollection
       
    85     (anObject isCollection and:[anObject isString not]) ifTrue:[
       
    86         anObject do:[:each|self deepFlatten: each into: aCollection]
       
    87     ] ifFalse:[
       
    88         aCollection add: anObject 
       
    89     ].
       
    90     ^aCollection
       
    91 !
       
    92 
       
    93 deepFlattened: aCollection
       
    94     ^self deepFlatten: aCollection into: OrderedCollection new.
       
    95 ! !
       
    96