Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
evoal-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Operate
Terraform modules
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
evoal
source
evoal-core
Commits
34da6c65
Commit
34da6c65
authored
2 years ago
by
Bernhard Johannes Berger
Browse files
Options
Downloads
Patches
Plain Diff
Removed old test
parent
3c8de71a
No related branches found
No related tags found
No related merge requests found
Pipeline
#248684
passed
2 years ago
Stage: Domain Specific Languages
Stage: EvoAl
Stage: Release
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/de.evoal.core.main/src/test/java/de/evoal/core/api/utils/LanguageHelperTest.java
+0
-182
0 additions, 182 deletions
...test/java/de/evoal/core/api/utils/LanguageHelperTest.java
with
0 additions
and
182 deletions
src/core/de.evoal.core.main/src/test/java/de/evoal/core/api/utils/LanguageHelperTest.java
deleted
100644 → 0
+
0
−
182
View file @
3c8de71a
package
de.evoal.core.api.utils
;
import
de.evoal.languages.model.instance.Instance
;
import
de.evoal.languages.model.ol.OptimisationModel
;
import
org.junit.jupiter.api.*
;
import
static
de
.
evoal
.
core
.
api
.
utils
.
LanguageHelper
.*;
public
class
LanguageHelperTest
{
@Order
(
1
)
@Test
public
void
testLoading
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
Assertions
.
assertNotNull
(
instance
);
}
@Test
public
void
testLookupForNullInstance
()
{
Assertions
.
assertThrows
(
IllegalStateException
.
class
,
()
->
lookup
(
null
,
"child"
));
}
@Test
public
void
testLookupForNullPath
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
Assertions
.
assertThrows
(
IllegalArgumentException
.
class
,
()
->
lookup
(
instance
,
null
));
}
@Test
public
void
testLookupForEmptyPath
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
final
Object
result
=
lookup
(
instance
,
""
);
Assertions
.
assertNotNull
(
result
);
Assertions
.
assertTrue
(
instance
==
result
);
}
@Test
public
void
testLookupForExistingChild
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
final
Object
result
=
lookup
(
instance
,
"child"
);
Assertions
.
assertNotNull
(
result
);
Assertions
.
assertTrue
(
result
instanceof
Instance
);
final
Instance
child
=
(
Instance
)
result
;
Assertions
.
assertEquals
(
"A"
,
child
.
getName
().
getName
());
}
@Test
public
void
testLookupName
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
final
Object
result
=
lookup
(
instance
,
"name"
);
Assertions
.
assertNotNull
(
result
);
Assertions
.
assertEquals
(
"parent"
,
result
);
}
@Test
public
void
testLookupChildOfLiteral
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
Assertions
.
assertThrows
(
IllegalStateException
.
class
,
()
->
lookup
(
instance
,
"child.string-field.non-existing"
));
}
@Test
public
void
testLookupNonExistingChild
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
Assertions
.
assertThrows
(
IllegalStateException
.
class
,
()
->
lookup
(
instance
,
"child.non-existing"
));
}
@Test
public
void
testLookupBooleanField
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
final
Object
result
=
lookup
(
instance
,
"child.boolean-field"
);
Assertions
.
assertNotNull
(
result
);
Assertions
.
assertTrue
(
result
instanceof
Boolean
);
Assertions
.
assertEquals
(
true
,
result
);
}
@Test
public
void
testLookupFlotField
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
final
Object
result
=
lookup
(
instance
,
"child.float-field"
);
Assertions
.
assertNotNull
(
result
);
Assertions
.
assertTrue
(
result
instanceof
Double
);
Assertions
.
assertEquals
(
1.3
,
result
);
}
@Test
public
void
testLookupIntegerField
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
final
Object
result
=
lookup
(
instance
,
"child.integer-field"
);
Assertions
.
assertNotNull
(
result
);
Assertions
.
assertTrue
(
result
instanceof
Integer
);
Assertions
.
assertEquals
(
4
,
result
);
}
@Test
public
void
testLookupStringField
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
final
Object
result
=
lookup
(
instance
,
"child.string-field"
);
Assertions
.
assertNotNull
(
result
);
Assertions
.
assertTrue
(
result
instanceof
String
);
Assertions
.
assertEquals
(
"FOOBAR"
,
result
);
}
@Test
public
void
testLookup1DArrayField
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
final
Object
result
=
lookup
(
instance
,
"child.array-1D-float"
);
Assertions
.
assertNotNull
(
result
);
Assertions
.
assertTrue
(
result
instanceof
Object
[]);
final
Object
[]
array
=
(
Object
[])
result
;
Assertions
.
assertEquals
(
3
,
array
.
length
);
Assertions
.
assertEquals
(
4.2
,
array
[
0
]);
Assertions
.
assertEquals
(
3.1
,
array
[
1
]);
Assertions
.
assertEquals
(
1.0
,
array
[
2
]);
}
@Test
public
void
testLookup2DArrayField
()
{
final
OptimisationModel
model
=
de
.
evoal
.
core
.
junit
.
dsl
.
LanguageHelper
.
loadFromClasspath
(
"de/evoal/core/api/utils/LanguageHelperTest.ol"
);
final
Instance
instance
=
model
.
getInstance
();
final
Object
result
=
lookup
(
instance
,
"child.array-2D-int"
);
Assertions
.
assertNotNull
(
result
);
Assertions
.
assertTrue
(
result
instanceof
Object
[]);
final
Object
[]
array
=
(
Object
[])
result
;
Assertions
.
assertEquals
(
3
,
array
.
length
);
final
Object
[]
array0
=
(
Object
[])
array
[
0
];
final
Object
[]
array1
=
(
Object
[])
array
[
1
];
final
Object
[]
array2
=
(
Object
[])
array
[
2
];
Assertions
.
assertEquals
(
5
,
array0
.
length
);
Assertions
.
assertEquals
(
3
,
array1
.
length
);
Assertions
.
assertEquals
(
1
,
array2
.
length
);
Assertions
.
assertEquals
(
1
,
array0
[
0
]);
Assertions
.
assertEquals
(
2
,
array0
[
1
]);
Assertions
.
assertEquals
(
3
,
array0
[
2
]);
Assertions
.
assertEquals
(
4
,
array0
[
3
]);
Assertions
.
assertEquals
(
5
,
array0
[
4
]);
Assertions
.
assertEquals
(
3
,
array1
[
0
]);
Assertions
.
assertEquals
(
2
,
array1
[
1
]);
Assertions
.
assertEquals
(
1
,
array1
[
2
]);
Assertions
.
assertEquals
(
42
,
array2
[
0
]);
}
}
This diff is collapsed.
Click to expand it.
Christina Sophie Viola Plump
@cplump
mentioned in issue
#18 (closed)
·
2 years ago
mentioned in issue
#18 (closed)
mentioned in issue #18
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment