Added test for stream language

parent c6687915
......@@ -4,16 +4,21 @@ import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.Expanded
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.RosConnectionSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.RosToEmamTagSchema;
import de.monticore.lang.monticar.generator.cpp.GeneratorCPP;
import de.monticore.lang.monticar.generator.cpp.TestConverter;
import de.monticore.lang.monticar.generator.middleware.impls.CPPGenImpl;
import de.monticore.lang.monticar.generator.middleware.impls.DummyMiddlewareGenImpl;
import de.monticore.lang.monticar.generator.middleware.impls.DummyMiddlewareSymbol;
import de.monticore.lang.monticar.generator.middleware.impls.RosCppGenImpl;
import de.monticore.lang.monticar.generator.roscpp.helper.TagHelper;
import de.monticore.lang.monticar.streamunits._symboltable.ComponentStreamUnitsSymbol;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;
......@@ -148,6 +153,28 @@ public class GenerationTest extends AbstractSymtabTest {
distributedTargetGenerator.add(new RosCppGenImpl(), "roscpp");
distributedTargetGenerator.generate(componentInstanceSymbol, taggingResolver);
}
@Ignore
@Test
public void testsStreamTest() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver("src/test/resources/");
RosToEmamTagSchema.registerTagTypes(taggingResolver);
ExpandedComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<ExpandedComponentInstanceSymbol>resolve("ba.tests.relToAbsTrajectoryInst", ExpandedComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
GeneratorCPP generatorCPP = new GeneratorCPP();
generatorCPP.setGenerationTargetPath("./target/generated-sources-emam/intersection/test/");
generatorCPP.setModelsDirPath(Paths.get("src/test/resources"));
generatorCPP.setGenerateTests(false);
// generatorCPP.useArmadilloBackend();
ComponentStreamUnitsSymbol streamSymbol = taggingResolver.<ComponentStreamUnitsSymbol>resolve("ba.tests.RelToAbsTrajectory", ComponentStreamUnitsSymbol.KIND).orElse(null);
assertNotNull(streamSymbol);
generatorCPP.generateFiles(componentInstanceSymbol,taggingResolver);
generatorCPP.generateFile(TestConverter.generateMainTestFile(streamSymbol,componentInstanceSymbol));
}
@Test
......
package ba.tests;
stream RelToAbsTrajectory for RelToAbsTrajectoryInst{
relTrajIn1: [0,0,0,0,0;1,1,1,1,1;2,2,2,2,2];
relTrajIn2: [0,0,0,0,0;1,1,1,1,1;2,2,2,2,2];
absPosIn1: [1;1];
absPosIn2: [2;2];
absTrajOut1: [1,1,1,1,1;2,2,2,2,2;2,2,2,2,2];
absTrajOut2: [2,2,2,2,2;3,3,3,3,3;2,2,2,2,2];
}
\ No newline at end of file
package ba.tests;
import ba.util.RelToAbsTrajectory;
component RelToAbsTrajectoryInst{
ports in Q^{3,5} relTrajIn1,
in Q^{3,5} relTrajIn2,
in Q^{2,1} absPosIn1,
in Q^{2,1} absPosIn2,
out Q^{3,5} absTrajOut1,
out Q^{3,5} absTrajOut2;
instance RelToAbsTrajectory<2,5> relToAbsTrajectory;
connect relTrajIn1 -> relToAbsTrajectory.relTrajectoryIn[1];
connect relTrajIn2 -> relToAbsTrajectory.relTrajectoryIn[2];
connect absPosIn1 -> relToAbsTrajectory.absPositionIn[1];
connect absPosIn2 -> relToAbsTrajectory.absPositionIn[2];
connect relToAbsTrajectory.absTrajectoryOut[1] -> absTrajOut1;
connect relToAbsTrajectory.absTrajectoryOut[2] -> absTrajOut2;
}
\ No newline at end of file
Markdown is supported
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