Commit 423cf9b1 authored by Sascha Niklas Schneiders's avatar Sascha Niklas Schneiders
Browse files

added new test

parent e1b6f92f
......@@ -248,6 +248,35 @@ public class ExpandedComponentInstanceTest extends AbstractSymtabTest {
result = InstanceInformation.getInstanceNumberFromASTSubComponent(csInner.getInstanceInformation().get().getASTSubComponent(), 1);
assertEquals(3, result);
}
@Test
public void testConnectorCorrectness() {
Scope symTab = createSymTab("src/test/resources");
ExpandedComponentInstanceSymbol inst = symTab.<ExpandedComponentInstanceSymbol>resolve(
"testing.subComponentConnector", ExpandedComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(inst);
testConnectorCorrectnessForComponent(inst);
}
private void testConnectorCorrectnessForComponent(ExpandedComponentInstanceSymbol inst) {
inst.getConnectors().forEach(connectorSymbol -> {
assertNotNull(connectorSymbol.getSourcePort());
assertNotNull(connectorSymbol.getTargetPort());
PortSymbol sourcePort = connectorSymbol.getSourcePort();
PortSymbol targetPort = connectorSymbol.getTargetPort();
System.out.println("source: " + sourcePort.getFullName());
System.out.println("target: " + targetPort.getFullName() + "\n");
assertNotEquals(sourcePort.getFullName(), targetPort.getFullName());
});
inst.getSubComponents().forEach(this::testConnectorCorrectnessForComponent);
}
/*
@Test
public void testGenericInstance() throws Exception {
......
package testing;
component A {
port
in Boolean in1,
out Boolean out1;
component SubA {
port
in Boolean in1,
out Boolean out1;
}
instance SubA subA;
connect in1 -> subA.in1;
connect subA.out1 -> out1;
}
\ No newline at end of file
package testing;
component SubComponentConnector{
port
in Boolean in1,
out Boolean out1;
instance A a;
connect in1 -> a.in1;
connect a.out1 -> out1;
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment