Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
languages
EmbeddedMontiArc
Commits
2a501c99
Commit
2a501c99
authored
Dec 15, 2018
by
Alexander David Hellwig
Browse files
Added testcase for Component with array Port sized by generics
parent
b7a88dcb
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/test/java/de/monticore/lang/embeddedmontiarc/SymtabTest.java
View file @
2a501c99
...
@@ -868,5 +868,31 @@ public class SymtabTest extends AbstractSymtabTest {
...
@@ -868,5 +868,31 @@ public class SymtabTest extends AbstractSymtabTest {
}
}
@Test
public
void
testBasicGenericArrayInstance
(){
Scope
symTab
=
createSymTab
(
"src/test/resources"
);
EMAComponentInstanceSymbol
componentInstanceSymbol
=
symTab
.<
EMAComponentInstanceSymbol
>
resolve
(
"test.basicGenericArrayInstance"
,
EMAComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentInstanceSymbol
);
for
(
int
i
=
1
;
i
<=
6
;
i
++){
assertTrue
(
componentInstanceSymbol
.
getPortInstance
(
"aVal1["
+
i
+
"]"
).
isPresent
());
assertTrue
(
componentInstanceSymbol
.
getPortInstance
(
"aValOut["
+
i
+
"]"
).
isPresent
());
}
EMAComponentInstanceSymbol
subComp1
=
componentInstanceSymbol
.
getSubComponent
(
"basicGenericArraySize1"
).
orElse
(
null
);
EMAComponentInstanceSymbol
subComp2
=
componentInstanceSymbol
.
getSubComponent
(
"basicGenericArraySize2"
).
orElse
(
null
);
assertNotNull
(
subComp1
);
assertNotNull
(
subComp2
);
for
(
int
i
=
1
;
i
<=
3
;
i
++)
{
assertTrue
(
"basicGenericArraySize1.val1["
+
i
+
"] not found"
,
subComp1
.
getPortInstance
(
"val1["
+
i
+
"]"
).
isPresent
());
assertTrue
(
"basicGenericArraySize2.val1["
+
i
+
"] not found"
,
subComp2
.
getPortInstance
(
"val1["
+
i
+
"]"
).
isPresent
());
assertTrue
(
"basicGenericArraySize1.valOut["
+
i
+
"] not found"
,
subComp1
.
getPortInstance
(
"valOut["
+
i
+
"]"
).
isPresent
());
assertTrue
(
"basicGenericArraySize2.valOut["
+
i
+
"] not found"
,
subComp2
.
getPortInstance
(
"valOut["
+
i
+
"]"
).
isPresent
());
}
}
}
}
src/test/resources/test/BasicGenericArrayInstance.ema
0 → 100644
View file @
2a501c99
package
test
;
component
BasicGenericArrayInstance
{
ports
in
Q
aVal1
[
6
],
out
Q
aValOut
[
6
];
instance
BasicGenericArraySize
<
3
>
basicGenericArraySize1
;
instance
BasicGenericArraySize
<
3
>
basicGenericArraySize2
;
connect
val1
[
1
:
3
]
->
basicGenericArraySize1
.
val1
[:];
connect
val1
[
4
:
6
]
->
basicGenericArraySize2
.
val1
[:];
connect
basicGenericArraySize1
.
valOut
[:]
->
valOut
[
1
:
3
];
connect
basicGenericArraySize2
.
valOut
[:]
->
valOut
[
4
:
6
];
}
\ No newline at end of file
src/test/resources/test/BasicGenericArraySize.ema
0 → 100644
View file @
2a501c99
package
test
;
component
BasicGenericArraySize
<
N1
n
=
1
>{
ports
in
Q
val1
[
n
],
out
Q
valOut
[
n
];
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment