Commit ab179b8f authored by Manuel Schrick's avatar Manuel Schrick
Browse files

implemented first test for SplitHandler

parent 599d306a
......@@ -208,7 +208,7 @@ public class SplitHandler {
}
addedSplitConnectors.addAll(createSplitConnectorsIfNeeded(nodeLeft, node, nodeRight, newRoute, oldRoute, layoutState));
oldRoute.clear(columnIndex);
oldRoute.clear(oldRoute.columnIndexOf(node));
return addedSplitConnectors;
}
......
package de.monticore.lang.montiarc.svggenerator.routesTests;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.montiarc.svggenerator.SVGGenerator;
import de.monticore.lang.montiarc.svggenerator.TestingUtilities;
import de.monticore.lang.montiarc.svggenerator.calculators.MainCalculator;
import de.monticore.lang.montiarc.svggenerator.calculators.RoutesLayoutState;
import de.monticore.symboltable.Scope;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/**
* Created by Peters Notebook on 10.11.2017.
*/
public class SplitHandlerTest {
private MainCalculator calculator = new MainCalculator();
private SVGGenerator svgGenerator = new SVGGenerator();
@Test
public void testNormalSplit() {
Scope symTab = TestingUtilities.createSymTab("src/test/resources/");
ExpandedComponentInstanceSymbol instance = symTab.<ExpandedComponentInstanceSymbol>resolve("testManuelSchrick.split.normalSplit", ExpandedComponentInstanceSymbol.KIND).orElse(null);
TestingUtilities.drawComponentsAndSubComponents(instance, 5, calculator, svgGenerator);
RoutesLayoutState layoutState = calculator.routesLayoutCalculator.layoutState;
assertNotNull(layoutState);
long splitConnectorCount = layoutState.splitConnectors.size();
assertTrue(splitConnectorCount > 0);
}
}
package testManuelSchrick.split;
component NormalSplit {
ports
in Integer inA,
out Integer outE;
component DummyA {
ports
in Integer in1,
out Integer out1,
out Integer out2,
out Integer out3;
}
component DummyB {
ports
in Integer in1,
out Integer out1,
out Integer out2,
out Integer out3;
}
component DummyC {
ports
in Integer in1,
in Integer in2,
out Integer out1,
out Integer out2;
}
component DummyD {
ports
in Integer in1,
in Integer in2,
in Integer in3,
out Integer out1;
}
component DummyE {
ports
in Integer in1,
in Integer in2,
in Integer in3,
out Integer out1;
}
instance DummyA dummyA;
instance DummyB dummyB;
instance DummyC dummyC;
instance DummyD dummyD;
instance DummyE dummyE;
connect dummyA.out1 -> dummyB.in1;
connect dummyA.out2 -> dummyC.in1;
connect dummyA.out3 -> dummyD.in1;
connect dummyB.out1 -> dummyC.in2;
connect dummyB.out2 -> dummyD.in2;
connect dummyB.out3 -> dummyE.in1;
connect dummyC.out1 -> dummyD.in3;
connect dummyC.out2 -> dummyE.in2;
connect dummyD.out1 -> dummyE.in3;
connect inA -> dummyA.in1;
connect dummyE.out1 -> outE;
}
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