Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
Class {
#name : #CRFBindingAttributeInitialisationTest,
#superclass : #CRFBindingTest,
#name : 'CRFBindingAttributeInitialisationTest',
#superclass : 'CRFBindingTest',
#instVars : [
'helloClass'
],
#category : #'Carrefour-FastAndBindingGenerator-Tests'
#category : 'Carrefour-FastAndBindingGenerator-Tests',
#package : 'Carrefour-FastAndBindingGenerator-Tests'
}

{ #category : #running }
{ #category : 'running' }
CRFBindingAttributeInitialisationTest >> setUp [
super setUp.
helloClass := (self famixModel allModelClasses detect: [:class | class name = #'Hello']).
Expand All @@ -17,35 +18,33 @@ CRFBindingAttributeInitialisationTest >> setUp [
CRFBinderVisitor new bindFastModel: self fastModel fromEntity: helloClass
]

{ #category : #running }
{ #category : 'running' }
CRFBindingAttributeInitialisationTest >> sourceCodeOfClass: aClass [
^ self fastString copyFrom: aClass sourceAnchor startPos to: aClass sourceAnchor endPos
]

{ #category : #running }
{ #category : 'running' }
CRFBindingAttributeInitialisationTest >> testAllFamixAttributeAreBound [
self assert: helloClass attributes size equals: 10.
helloClass attributes do: [ :attribute |
self assert: attribute fastDeclaration isNotEmpty ]
]

{ #category : #running }
{ #category : 'running' }
CRFBindingAttributeInitialisationTest >> testAllFamixAttributeInitializationAreBound [

| invocationsFamix invocationsFast |
invocationsFamix := ((self famixModel allUsing: FamixTInvocation)
select: [ :invoc |
invoc signature beginsWith: #'Canard(' ])
asOrderedCollection sorted: [ :invocA :invocB |
invocA sourceAnchor startPos
< invocB sourceAnchor startPos ].
invocationsFast := ((self fastModel allWithType:
FASTJavaNewExpression) select: [
:newClassExpression |
newClassExpression type typeName name = #Canard ])
asOrderedCollection sorted: #startPos ascending.
invocationsFamix doWithIndex: [ :invocationFamix :index |
| invocationFast |
invocationsFamix := ( (self famixModel allUsing: FamixTInvocation)
select: [ :invoc | invoc signature beginsWith: #'Canard(' ] )
asOrderedCollection sorted: [ :invocA :invocB |
invocA sourceAnchor startPos < invocB sourceAnchor startPos ].

invocationsFast := ((self fastModel allWithType: FASTJavaNewExpression)
select: [ :newClassExpression |
newClassExpression type typeName name = #Canard ])
asOrderedCollection sorted: #startPos ascending.

invocationsFamix doWithIndex: [ :invocationFamix :index || invocationFast |
invocationFast := invocationsFast at: index.
self assert: invocationFamix fast equals: invocationFast.
self assert: invocationFast famixInvocation equals: invocationFamix ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #CRFBindingBuildLienSimpleTest,
#superclass : #CRFBindingTest,
#category : #'Carrefour-FastAndBindingGenerator-Tests'
#name : 'CRFBindingBuildLienSimpleTest',
#superclass : 'CRFBindingTest',
#category : 'Carrefour-FastAndBindingGenerator-Tests',
#package : 'Carrefour-FastAndBindingGenerator-Tests'
}

{ #category : #running }
{ #category : 'running' }
CRFBindingBuildLienSimpleTest >> setUp [
super setUp.
fastModel := (JavaSmaCCProgramNodeImporterVisitor new
Expand All @@ -18,15 +19,15 @@ CRFBindingBuildLienSimpleTest >> setUp [
detect: [ :method | method name = 'buildLienSimple' ])
]

{ #category : #tests }
{ #category : 'tests' }
CRFBindingBuildLienSimpleTest >> testBindingClassBLAbstractLienSimple [

self
assert: (self famixModel allModelClasses detect: [ :class | class name = '_Anonymous(BLAbstractLienSimple)' ]) fastDeclaration anyOne
equals: ((self fastModel allWithType: FASTJavaNewClassExpression) detect: [ :variableExpression | variableExpression type fullName = 'BLAbstractLienSimple' ])
]

{ #category : #tests }
{ #category : 'tests' }
CRFBindingBuildLienSimpleTest >> testBindingVariableRel [
self
assert: ((self fastModel allWithType: FASTJavaVariableExpression) select: [ :variableExpression | variableExpression name = 'rel' ]) anyOne famixVariable
Expand All @@ -37,7 +38,7 @@ CRFBindingBuildLienSimpleTest >> testBindingVariableRel [
equals: ((self fastModel allWithType: FASTJavaVariableExpression) select: [ :variableExpression | variableExpression name = 'rel' ]) anyOne
]

{ #category : #tests }
{ #category : 'tests' }
CRFBindingBuildLienSimpleTest >> testBindingVariableRelDeclaration [

self
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
Class {
#name : #CRFBindingBuildMyClassTest,
#superclass : #CRFBindingTest,
#category : #'Carrefour-FastAndBindingGenerator-Tests'
#name : 'CRFBindingBuildMyClassTest',
#superclass : 'CRFBindingTest',
#category : 'Carrefour-FastAndBindingGenerator-Tests',
#package : 'Carrefour-FastAndBindingGenerator-Tests'
}

{ #category : #initialization }
{ #category : 'initialization' }
CRFBindingBuildMyClassTest >> setUp [

super setUp.
fastModel := (JavaSmaCCProgramNodeImporterVisitor new
parseCodeMethodString: self fastMethodMyClassBuild)
name: #fastModel;
yourself.
parseCodeMethodString: self fastMethodMyClassBuild)
name: #fastModel;
yourself.
CRFBinderVisitor
bindFastModel: self fastModel
fromFamixMethodEntity:
(self famixModel allModelMethods
detect: [ :method | method name = 'build' and: [ (method atScope: FamixTClass) anyOne name = 'MyClass' ] ])
(self famixModel allModelMethods detect: [ :method |
method name = 'build' and: [
(method containersOfType: FamixTClass) anyOne name = 'MyClass' ] ])
]

{ #category : #initialization }
{ #category : 'initialization' }
CRFBindingBuildMyClassTest >> testAStringIsCorrectlyBind [

self
assert:
(self fastModel allWithType: FASTJavaAssignmentExpression) anyOne
famixVariable
equals:
((self famixModel allWithType: FamixJavaAttribute) detect: [ :att |
att name = 'aString' and: [
(att atScope: FamixTClass) anyOne name = 'MyClass' ] ])
((self famixModel allWithType: FamixJavaAttribute) detect: [ :att |
att name = 'aString' and: [
(att containersOfType: FamixTClass) anyOne name = 'MyClass' ] ])
]
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
Class {
#name : #CRFBindingClassDefinitionTest,
#superclass : #CRFBindingTest,
#name : 'CRFBindingClassDefinitionTest',
#superclass : 'CRFBindingTest',
#instVars : [
'helloClass'
],
#category : #'Carrefour-FastAndBindingGenerator-Tests'
#category : 'Carrefour-FastAndBindingGenerator-Tests',
#package : 'Carrefour-FastAndBindingGenerator-Tests'
}

{ #category : #running }
{ #category : 'running' }
CRFBindingClassDefinitionTest >> setUp [
super setUp.
helloClass := (self famixModel allModelClasses detect: [:class | class name = #'Hello']).
Expand All @@ -17,12 +18,12 @@ CRFBindingClassDefinitionTest >> setUp [
CRFBinderVisitor new bindFastModel: self fastModel fromEntity: helloClass
]

{ #category : #running }
{ #category : 'running' }
CRFBindingClassDefinitionTest >> sourceCodeOfClass: aClass [
^ self fastString copyFrom: aClass sourceAnchor startPos to: aClass sourceAnchor endPos
]

{ #category : #running }
{ #category : 'running' }
CRFBindingClassDefinitionTest >> testClassDefinitionIsBinded [
self assert: helloClass fastTypeDefinition equals: (fastModel allWithType: FASTJavaClassDeclaration) anyOne.
self assert: helloClass equals: (fastModel allWithType: FASTJavaClassDeclaration) anyOne famixTypeDefinition.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #CRFBindingClassPropertyAccessTest,
#superclass : #CRFBindingTest,
#category : #'Carrefour-FastAndBindingGenerator-Tests'
#name : 'CRFBindingClassPropertyAccessTest',
#superclass : 'CRFBindingTest',
#category : 'Carrefour-FastAndBindingGenerator-Tests',
#package : 'Carrefour-FastAndBindingGenerator-Tests'
}

{ #category : #running }
{ #category : 'running' }
CRFBindingClassPropertyAccessTest >> setUp [
super setUp.
fastModel := (JavaSmaCCProgramNodeImporterVisitor new
Expand All @@ -18,17 +19,17 @@ CRFBindingClassPropertyAccessTest >> setUp [
detect: [ :method | method name = 'classPropertyAccess' ])
]

{ #category : #tests }
{ #category : 'tests' }
CRFBindingClassPropertyAccessTest >> testClassPropertyBinding [
self assert: (self fastModel allWithType: FASTJavaClassProperty) anyOne famixVariable equals: (self famixModel allAttributes select: [:attribute | attribute name = 'classProperty' ]) anyOne.
]

{ #category : #tests }
{ #category : 'tests' }
CRFBindingClassPropertyAccessTest >> testClassPropertyBindingFamixToFast [
self assert: (self fastModel allWithType: FASTJavaClassProperty) anyOne equals: (self famixModel allAttributes select: [:attribute | attribute name = 'classProperty' ]) anyOne fastAccesses anyOne.
]

{ #category : #tests }
{ #category : 'tests' }
CRFBindingClassPropertyAccessTest >> testClassPropertySize [
self assert: (self fastModel allWithType: FASTJavaClassProperty) size equals: 1.
]
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #CRFBindingComplexReturn,
#superclass : #CRFBindingTest,
#category : #'Carrefour-FastAndBindingGenerator-Tests'
#name : 'CRFBindingComplexReturn',
#superclass : 'CRFBindingTest',
#category : 'Carrefour-FastAndBindingGenerator-Tests',
#package : 'Carrefour-FastAndBindingGenerator-Tests'
}

{ #category : #running }
{ #category : 'running' }
CRFBindingComplexReturn >> setUp [
super setUp.
fastModel := (JavaSmaCCProgramNodeImporterVisitor new
Expand All @@ -18,14 +19,14 @@ CRFBindingComplexReturn >> setUp [
detect: [ :method | method name = 'getMenuIcon' ])
]

{ #category : #running }
{ #category : 'running' }
CRFBindingComplexReturn >> testBindingMethod [
self assert: (self famixModel allMethods select: [ :method | method name = 'getMenuIcon' ]) first fast equals: self fastModel allFASTJavaMethodEntity first.
self assert: self fastModel allFASTJavaMethodEntity first famixMethod equals: (self famixModel allMethods select: [ :method | method name = 'getMenuIcon' ]) first.

]

{ #category : #running }
{ #category : 'running' }
CRFBindingComplexReturn >> testBindingNewExpression [
self
assert:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
This class contains tests
"
Class {
#name : #CRFBindingDeclarationInParameterTest,
#superclass : #CRFBindingTest,
#category : #'Carrefour-FastAndBindingGenerator-Tests'
#name : 'CRFBindingDeclarationInParameterTest',
#superclass : 'CRFBindingTest',
#category : 'Carrefour-FastAndBindingGenerator-Tests',
#package : 'Carrefour-FastAndBindingGenerator-Tests'
}

{ #category : #running }
{ #category : 'running' }
CRFBindingDeclarationInParameterTest >> setUp [
super setUp.
fastModel := (JavaSmaCCProgramNodeImporterVisitor new
Expand All @@ -21,7 +22,7 @@ CRFBindingDeclarationInParameterTest >> setUp [
detect: [ :method | method name = 'decla' ])
]

{ #category : #running }
{ #category : 'running' }
CRFBindingDeclarationInParameterTest >> testParameterIsDeclaration [
| variableExpressions |
variableExpressions := (self fastModel allWithType: FASTJavaVariableExpression) asOrderedCollection sort: #startPos ascending.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #CRFBindingDoubleAffectationTest,
#superclass : #CRFBindingTest,
#category : #'Carrefour-FastAndBindingGenerator-Tests'
#name : 'CRFBindingDoubleAffectationTest',
#superclass : 'CRFBindingTest',
#category : 'Carrefour-FastAndBindingGenerator-Tests',
#package : 'Carrefour-FastAndBindingGenerator-Tests'
}

{ #category : #running }
{ #category : 'running' }
CRFBindingDoubleAffectationTest >> setUp [
super setUp.
fastModel := (JavaSmaCCProgramNodeImporterVisitor new
Expand All @@ -18,14 +19,14 @@ CRFBindingDoubleAffectationTest >> setUp [
detect: [ :method | method name = 'doubleAffectation' ])
]

{ #category : #running }
{ #category : 'running' }
CRFBindingDoubleAffectationTest >> testBindingMethod [
self assert: (self famixModel allMethods select: [ :method | method name = 'doubleAffectation' ]) first fast equals: self fastModel allFASTJavaMethodEntity first.
self assert: self fastModel allFASTJavaMethodEntity first famixMethod equals: (self famixModel allMethods select: [ :method | method name = 'doubleAffectation' ]) first.

]

{ #category : #running }
{ #category : 'running' }
CRFBindingDoubleAffectationTest >> testBindingSameClassAffectation [
self
assertCollection: ((self famixModel allUsing: FamixTLocalVariable) select: [ :localVariable | localVariable parentBehaviouralEntity name = 'doubleAffectation' ])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #CRFBindingDoubleInsideMethodTest,
#superclass : #CRFBindingTest,
#category : #'Carrefour-FastAndBindingGenerator-Tests'
#name : 'CRFBindingDoubleInsideMethodTest',
#superclass : 'CRFBindingTest',
#category : 'Carrefour-FastAndBindingGenerator-Tests',
#package : 'Carrefour-FastAndBindingGenerator-Tests'
}

{ #category : #running }
{ #category : 'running' }
CRFBindingDoubleInsideMethodTest >> setUp [
super setUp.
fastModel := (JavaSmaCCProgramNodeImporterVisitor new
Expand All @@ -18,7 +19,7 @@ CRFBindingDoubleInsideMethodTest >> setUp [
detect: [ :method | method name = 'doubleInsideMethod' ])
]

{ #category : #tests }
{ #category : 'tests' }
CRFBindingDoubleInsideMethodTest >> testLabel41Binding [
self
assert: ((fastModel allWithType: FASTJavaVariableExpression) select: [ :varExpre | varExpre name = 'label41' ]) anyOne parentNode expression famixInvocation
Expand All @@ -28,7 +29,7 @@ CRFBindingDoubleInsideMethodTest >> testLabel41Binding [
equals: ((famixModel allUsing: FamixTInvocation) select: [ :invoc | invoc signature = 'BLLabel("inside ")' ]) anyOne fast
]

{ #category : #tests }
{ #category : 'tests' }
CRFBindingDoubleInsideMethodTest >> testLabel42Binding [
self
assert: ((fastModel allWithType: FASTJavaVariableExpression) select: [ :varExpre | varExpre name = 'label42' ]) anyOne parentNode expression famixInvocation
Expand All @@ -38,7 +39,7 @@ CRFBindingDoubleInsideMethodTest >> testLabel42Binding [
equals: ((famixModel allUsing: FamixTInvocation) select: [ :invoc | invoc signature = 'BLLabel("inside inside")' ]) anyOne fast
]

{ #category : #tests }
{ #category : 'tests' }
CRFBindingDoubleInsideMethodTest >> testLabelBinding [
self
assert: ((fastModel allWithType: FASTJavaVariableExpression) select: [ :varExpre | varExpre name = 'label' ]) anyOne parentNode expression famixInvocation
Expand Down
Loading
Loading