Updated to PetitCompiler-JanKurs.160, PetitCompiler-Tests-JanKurs.112, PetitCompiler-Extras-Tests-JanKurs.25, PetitCompiler-Benchmarks-JanKurs.17
Name: PetitCompiler-JanKurs.160
Author: JanKurs
Time: 17-08-2015, 09:52:26.291 AM
UUID: 3b4bfc98-8098-4951-af83-a59e2585b121
Name: PetitCompiler-Tests-JanKurs.112
Author: JanKurs
Time: 16-08-2015, 05:00:32.936 PM
UUID: 85613d47-08f3-406f-9823-9cdab451e805
Name: PetitCompiler-Extras-Tests-JanKurs.25
Author: JanKurs
Time: 16-08-2015, 05:00:10.328 PM
UUID: 09731810-51a1-4151-8d3a-56b636fbd1f7
Name: PetitCompiler-Benchmarks-JanKurs.17
Author: JanKurs
Time: 05-08-2015, 05:29:32.407 PM
UUID: e544b5f1-bcf8-470b-93a6-d2363e4dfc8a
"{ Package: 'stx:goodies/petitparser/compiler/tests/extras' }"
"{ NameSpace: Smalltalk }"
PPCAbstractParserTest subclass:#PPCLRPParserVerificationTest
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'PetitCompiler-Extras-Tests-LRP'
!
!PPCLRPParserVerificationTest class methodsFor:'resources'!
resources
^ Array with: (PPCSetUpBeforeTearDownAfterResource for: self)
! !
!PPCLRPParserVerificationTest class methodsFor:'testing'!
isAbstract
^ self == PPCLRPParserVerificationTest
"Modified: / 31-07-2015 / 07:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!PPCLRPParserVerificationTest methodsFor:'accessing'!
compiledParser
^ self compiledParserClass new
"Created: / 29-07-2015 / 17:00:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
compiledParserClass
^ Smalltalk at: self compiledParserClassName
"Created: / 29-07-2015 / 16:54:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
compiledParserClassName
"Return the name of the compiled parser"
^ (self petitParserClass name , 'C_' ,
"This is bit hacky!!"
((self compilerConfiguration isKindOf: PPCTokenizingConfiguration) ifTrue:[ 'Tokenizing' ] ifFalse:[ 'Universal' ])) asSymbol
"Created: / 29-07-2015 / 16:54:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
compilerConfiguration
"Return configuration to use when compiling parser (as instance of PPCConfiguration)"
^ self subclassResponsibility
"Created: / 29-07-2015 / 16:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
parserClass
^ self compiledParserClass
"Modified: / 29-07-2015 / 18:43:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
parserInstanceFor: aSymbol
^ self parserClass new startSymbol: aSymbol
"Modified: / 29-07-2015 / 18:43:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
petitParser
^ self petitParserClass new
"Created: / 29-07-2015 / 17:01:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
petitParserClass
^ PPCLRPParser
! !
!PPCLRPParserVerificationTest methodsFor:'context'!
context
^ PPCContext new
! !
!PPCLRPParserVerificationTest methodsFor:'setup & teardown'!
setUpBefore
"Called before any of my tests is run (when resources are set up)"
| time configuration |
configuration := self compilerConfiguration.
configuration arguments parserName: self compiledParserClassName.
time := Time millisecondsToRun: [
self petitParser compileWithConfiguration: configuration.
].
Transcript show: self petitParserClass name ; show:' compiled in: '; show: time asString; show: 'ms'; cr.
"Created: / 29-07-2015 / 16:29:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 29-07-2015 / 18:40:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
tearDownAfter
"Called after all my tests are ryn(when resources are torn down)"
"Created: / 29-07-2015 / 16:33:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!PPCLRPParserVerificationTest methodsFor:'testing'!
testSmoke1
| compiledParser normalParser |
normalParser := self petitParser.
compiledParser := self compiledParser.
PPCLRPSourcesResource current sources do:[:source |
self assert: (normalParser parse: source) asString
equals: (compiledParser parse: source withContext: self context) asString.
].
"Created: / 30-07-2015 / 19:07:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !