Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More tests #159

Merged
merged 2 commits into from
Jun 30, 2024
Merged
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
22 changes: 6 additions & 16 deletions src/EsopeImporter-Tests/FamixEsopeUtilitiesTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Class {
#superclass : #TestCase,
#instVars : [
'mooseModel',
'famixProgFile'
'programFile'
],
#category : #'EsopeImporter-Tests-Importer'
}
Expand Down Expand Up @@ -51,17 +51,7 @@ FamixEsopeUtilitiesTest >> defaultAttribute: varName withType: typeName [
FamixEsopeUtilitiesTest >> defaultFunction: name [

^ (self newEntity: FamixF77PUFunction named: name) programFile:
famixProgFile
]

{ #category : #'default values' }
FamixEsopeUtilitiesTest >> defaultIASTEsopeCommand: commandName name: entityName [

^ IASTEsopeSegCommand new
esopeCommand: commandName;
entityName: entityName;
sourceAnchor: self defaultAnchor;
yourself
programFile
]

{ #category : #'default values' }
Expand Down Expand Up @@ -102,7 +92,7 @@ FamixEsopeUtilitiesTest >> defaultInvocation: name [
FamixEsopeUtilitiesTest >> defaultMain: name [

^ (self newEntity: FamixF77PUMain named: name) programFile:
famixProgFile
programFile
]

{ #category : #'default values' }
Expand Down Expand Up @@ -141,7 +131,7 @@ FamixEsopeUtilitiesTest >> defaultSegment: segmentName with: dictDeclarations [
FamixEsopeUtilitiesTest >> defaultSubroutine: name [

^ (self newEntity: FamixF77PUSubroutine named: name) programFile:
famixProgFile
programFile
]

{ #category : #'default values' }
Expand Down Expand Up @@ -211,7 +201,7 @@ FamixEsopeUtilitiesTest >> newEntity: aFamixClass named: aName [
FamixEsopeUtilitiesTest >> newPU: aName [

^ (self newEntity: FamixF77PUSubroutine named: aName)
programFile: famixProgFile;
programFile: programFile;
yourself
]

Expand All @@ -221,5 +211,5 @@ FamixEsopeUtilitiesTest >> setUp [
super setUp.

mooseModel := FamixEsopeModel new.
famixProgFile := self defaultProgramFile: './main.f'.
programFile := self defaultProgramFile: './main.f'.
]
38 changes: 38 additions & 0 deletions src/EsopeImporter-Tests/FortranProjectImporterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,44 @@ FortranProjectImporterTest >> testGetIncludedFile [
self assert: names equals: 'blah.inc'
]

{ #category : #'tests - import steps' }
FortranProjectImporterTest >> testIASTToFamix [
"json file and assert: taken from
IASTToFamixVisitorTest >> testFamixFortran77PUFunctionWithParameter"

| iastEntity fmxEntity param |
iastEntity := IASTParameter new
entityName: 'var' ;
yourself.
iastEntity := IASTFunction new
entityName: 'fct' ;
parameters: { iastEntity } ;
yourself.
iastEntity := IASTProgramFile new
filename: './main.f' ;
body: { iastEntity } ;
yourself.
importer iastModel: { iastEntity }.

importer iASTToFamix.

self assert: (importer famixModel allWithType: FamixF77ProgramFile) size equals: 1.

fmxEntity := (importer famixModel allWithType: FamixF77ProgramFile) anyOne.
self assert: fmxEntity programUnits size equals: 1.

fmxEntity := fmxEntity programUnits first.
self assert: fmxEntity class equals: FamixF77PUFunction.
self assert: fmxEntity name equals: 'fct'.
self assert: fmxEntity programFile isNotNil.

self assert: fmxEntity parameters size equals: 1.
param := fmxEntity parameters first.
self assert: param class equals: FamixF77Parameter.
self assert: param name equals: 'var'.
self assert: param parentBehaviouralEntity equals: fmxEntity.
]

{ #category : #'tests - import steps' }
FortranProjectImporterTest >> testIncludedFilesToEsope [

Expand Down
Loading