Commit 9472a77c authored by Alexander David Hellwig's avatar Alexander David Hellwig
Browse files

Ignored old tests

parent a70c9088
......@@ -71,7 +71,7 @@ public class GenerationTest extends AbstractSymtabTest {
}
@Test
public void testCppOnlyMiddlewareGeneration() throws IOException{
public void testCppOnlyMiddlewareGeneration() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver("src/test/resources/");
ExpandedComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<ExpandedComponentInstanceSymbol>resolve("tests.a.addComp", ExpandedComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
......@@ -79,28 +79,28 @@ public class GenerationTest extends AbstractSymtabTest {
MiddlewareGenerator middlewareGenerator = new MiddlewareGenerator();
String generationTargetPath = "./target/generated-sources-cmake/CMakeCppOnly/src/";
middlewareGenerator.setGenerationTargetPath(generationTargetPath);
middlewareGenerator.add(new CPPGenImpl(),"cpp");
middlewareGenerator.add(new CPPGenImpl(), "cpp");
List<File> files = middlewareGenerator.generate(componentInstanceSymbol, taggingResolver);
testFilesAreEqual(files,"CMakeCppOnly/src/",generationTargetPath);
testFilesAreEqual(files, "CMakeCppOnly/src/", generationTargetPath);
}
@Ignore("Planner no longer used")
@Test
public void plannerTest() throws IOException{
public void plannerTest() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver("src/test/resources/");
ExpandedComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<ExpandedComponentInstanceSymbol>resolve("ba.vehicle.planner", ExpandedComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
ComponentSymbol componentSymbol = taggingResolver.<ComponentSymbol>resolve("ba.vehicle.Planner",ComponentSymbol.KIND).orElse(null);
ComponentSymbol componentSymbol = taggingResolver.<ComponentSymbol>resolve("ba.vehicle.Planner", ComponentSymbol.KIND).orElse(null);
EmbeddedMontiArcMathCoCos.createChecker().checkAll((ASTComponent)componentSymbol.getAstNode().orElse(null));
EmbeddedMontiArcMathCoCos.createChecker().checkAll((ASTComponent) componentSymbol.getAstNode().orElse(null));
MiddlewareGenerator middlewareGenerator = new MiddlewareGenerator();
String generationTargetPath = "./target/generated-sources-cmake/Planner/src/";
middlewareGenerator.setGenerationTargetPath(generationTargetPath);
middlewareGenerator.add(new CPPGenImpl(),"cpp");
middlewareGenerator.add(new CPPGenImpl(), "cpp");
List<File> files = middlewareGenerator.generate(componentInstanceSymbol, taggingResolver);
//known errors:
......@@ -112,19 +112,20 @@ public class GenerationTest extends AbstractSymtabTest {
fixKnownErrors(files);
testFilesAreEqual(files,"Planner/src/",generationTargetPath);
testFilesAreEqual(files, "Planner/src/", generationTargetPath);
}
@Ignore
@Test
public void testBaSystem() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver("src/test/resources/");
ExpandedComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<ExpandedComponentInstanceSymbol>resolve("ba.system", ExpandedComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
ComponentSymbol componentSymbol = taggingResolver.<ComponentSymbol>resolve("ba.System",ComponentSymbol.KIND).orElse(null);
ComponentSymbol componentSymbol = taggingResolver.<ComponentSymbol>resolve("ba.System", ComponentSymbol.KIND).orElse(null);
EmbeddedMontiArcMathCoCos.createChecker().checkAll((ASTComponent)componentSymbol.getAstNode().orElse(null));
EmbeddedMontiArcMathCoCos.createChecker().checkAll((ASTComponent) componentSymbol.getAstNode().orElse(null));
componentInstanceSymbol.getPorts().forEach(p -> p.setMiddlewareSymbol(new RosConnectionSymbol()));
componentInstanceSymbol.getSubComponents().stream()
......@@ -137,14 +138,14 @@ public class GenerationTest extends AbstractSymtabTest {
.sorted(Comparator.comparing(ConnectorSymbol::getName))
.collect(Collectors.toList());
for(ConnectorSymbol con : stopCommConnectors){
String indexString = con.getName().replaceAll(".*\\[(\\d+)\\].*","$1");
if(con.getSource().startsWith("stopCommQuality")){
con.getSourcePort().setMiddlewareSymbol(new RosConnectionSymbol("/v"+ indexString + "/comm/in/slowDown"+ indexString,"std_msgs/Bool","data"));
con.getTargetPort().setMiddlewareSymbol(new RosConnectionSymbol("/v"+ indexString + "/comm/in/slowDown"+ indexString,"std_msgs/Bool","data"));
}else{
con.getSourcePort().setMiddlewareSymbol(new RosConnectionSymbol("/sim/comm/slowDown" + indexString,"std_msgs/Bool","data"));
con.getTargetPort().setMiddlewareSymbol(new RosConnectionSymbol("/sim/comm/slowDown" + indexString,"std_msgs/Bool","data"));
for (ConnectorSymbol con : stopCommConnectors) {
String indexString = con.getName().replaceAll(".*\\[(\\d+)\\].*", "$1");
if (con.getSource().startsWith("stopCommQuality")) {
con.getSourcePort().setMiddlewareSymbol(new RosConnectionSymbol("/v" + indexString + "/comm/in/slowDown" + indexString, "std_msgs/Bool", "data"));
con.getTargetPort().setMiddlewareSymbol(new RosConnectionSymbol("/v" + indexString + "/comm/in/slowDown" + indexString, "std_msgs/Bool", "data"));
} else {
con.getSourcePort().setMiddlewareSymbol(new RosConnectionSymbol("/sim/comm/slowDown" + indexString, "std_msgs/Bool", "data"));
con.getTargetPort().setMiddlewareSymbol(new RosConnectionSymbol("/sim/comm/slowDown" + indexString, "std_msgs/Bool", "data"));
}
}
......@@ -152,17 +153,19 @@ public class GenerationTest extends AbstractSymtabTest {
String generationTargetPath = "./target/generated-sources-cmake/system/src/";
distributedTargetGenerator.setGenerationTargetPath(generationTargetPath);
//distributedTargetGenerator.setGenDebug(true);
distributedTargetGenerator.add(new CPPGenImpl(),"cpp");
distributedTargetGenerator.add(new RosCppGenImpl(),"roscpp");
distributedTargetGenerator.add(new CPPGenImpl(), "cpp");
distributedTargetGenerator.add(new RosCppGenImpl(), "roscpp");
List<File> files = distributedTargetGenerator.generate(componentInstanceSymbol, taggingResolver);
fixKnownErrors(files);
testFilesAreEqual(files,"system/src/",generationTargetPath);
testFilesAreEqual(files, "system/src/", generationTargetPath);
}
//TODO:add once true and false work
@Ignore
@Test
public void testLaneIntersection() throws IOException{
public void testLaneIntersection() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver("src/test/resources/");
ExpandedComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<ExpandedComponentInstanceSymbol>resolve("ba.util.lineIntersection", ExpandedComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
......@@ -170,15 +173,17 @@ public class GenerationTest extends AbstractSymtabTest {
MiddlewareGenerator middlewareGenerator = new MiddlewareGenerator();
String generationTargetPath = "./target/generated-sources-cmake/laneIntersection/src/";
middlewareGenerator.setGenerationTargetPath(generationTargetPath);
middlewareGenerator.add(new CPPGenImpl(),"cpp");
middlewareGenerator.add(new CPPGenImpl(), "cpp");
//middlewareGenerator.add(new RosCppGenImpl(),"roscpp");
List<File> files = middlewareGenerator.generate(componentInstanceSymbol, taggingResolver);
fixKnownErrors(files);
}
//TODO:add once true and false work
@Ignore
@Test
public void testRectIntersection() throws IOException{
public void testRectIntersection() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver("src/test/resources/");
ExpandedComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<ExpandedComponentInstanceSymbol>resolve("ba.collision.rectIntersection", ExpandedComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
......@@ -188,7 +193,7 @@ public class GenerationTest extends AbstractSymtabTest {
MiddlewareGenerator middlewareGenerator = new MiddlewareGenerator();
String generationTargetPath = "./target/generated-sources-cmake/rectIntersection/src/";
middlewareGenerator.setGenerationTargetPath(generationTargetPath);
middlewareGenerator.add(new CPPGenImpl(),"cpp");
middlewareGenerator.add(new CPPGenImpl(), "cpp");
//middlewareGenerator.add(new RosCppGenImpl(),"roscpp");
List<File> files = middlewareGenerator.generate(componentInstanceSymbol, taggingResolver);
......@@ -202,11 +207,11 @@ public class GenerationTest extends AbstractSymtabTest {
//Helper::getDoubleFromOctaveListFirstResult(Fasin(Helper::convertToOctaveValueList(deltaY/dist),1)
//=> Fasin(deltaY/dist) => std::sin(...)
//...
for(File f : files) {
for (File f : files) {
Path path = Paths.get(f.getAbsolutePath());
Charset charset = StandardCharsets.UTF_8;
String content = new String(Files.readAllBytes(path), charset);
content = content.replace("#include \"octave/builtin-defun-decls.h\"","#include <cmath>");
/*content = content.replace("#include \"octave/builtin-defun-decls.h\"","#include <cmath>");
content = content.replaceAll("\\(Helper::getDoubleFromOctaveListFirstResult\\(([\\w|/]*)\\(Helper::convertToOctaveValueList\\(([\\w|/|\\(|\\)|,| |-]*)\\),1\\)\\)\\)","$1($2)");
content = content.replaceAll("(\\w+)\\(([\\w]+\\-1)\\)","$1[$2]");
content = content.replace("LaneletPaircurLaneletPair", "ba_util_LaneletPair curLaneletPair");
......@@ -216,13 +221,21 @@ public class GenerationTest extends AbstractSymtabTest {
content = content.replace("Fabs","std::abs");
content = content.replace("Col<int> counter=Col<int>(1);" , "Col<int> counter=Col<int>(n);");
content = content.replace("colvec tmpLine;","colvec tmpLine = colvec(4);");
content = content.replace("colvec tmpLine;","colvec tmpLine = colvec(4);");*/
content = content
//.replace("-1-1", "-1") //not present in emam2cpp master
.replace("double lIndex", "int lIndex")
.replace("double indexIn", "int indexIn")
.replace("colvec counter", "Col<int> counter=Col<int>(n)")
.replace("colvec indexLookup;","Col<int> indexLookup=Col<int>(1);")
.replace("int curIndex = indexLookup(i, 1);","int curIndex = indexLookup(i-1, 1-1);")
;
Files.write(path, content.getBytes(charset));
}
}
@Test
public void testMiddlewareGenerator() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver("src/test/resources/");
......@@ -296,15 +309,14 @@ public class GenerationTest extends AbstractSymtabTest {
componentInstanceSymbol.getConnectors().stream()
.filter(c -> c.getSourcePort().equals(c.getTargetPort()))
.forEach(c -> System.out.println("Source = Target:"+c.getSource() + " -> " + c.getTargetPort()));
.forEach(c -> System.out.println("Source = Target:" + c.getSource() + " -> " + c.getTargetPort()));
componentInstanceSymbol.getPorts().forEach(p -> p.setMiddlewareSymbol(new RosConnectionSymbol()));
componentInstanceSymbol.getSubComponents().stream()
.flatMap(subc -> subc.getConnectors().stream())
.flatMap(subc -> subc.getConnectors().stream())
.filter(c -> c.getSourcePort().equals(c.getTargetPort()))
.forEach(c -> System.out.println("Source = Target in comp "+c.getComponentInstance().get().getName()+":"+c.getSource() + " -> " + c.getTargetPort()));
.forEach(c -> System.out.println("Source = Target in comp " + c.getComponentInstance().get().getName() + ":" + c.getSource() + " -> " + c.getTargetPort()));
componentInstanceSymbol.getSubComponents().stream()
.flatMap(subc -> subc.getPorts().stream())
......@@ -323,13 +335,13 @@ public class GenerationTest extends AbstractSymtabTest {
//Workaround for compiler errors: change
//conflictIn(i-1) to conflictIn[i-1]
//indexLookupIn(i-1) to indexLookupIn[i-1]
for(File f : files) {
for (File f : files) {
Path path = Paths.get(f.getAbsolutePath());
Charset charset = StandardCharsets.UTF_8;
String content = new String(Files.readAllBytes(path), charset);
content = content.replace("conflictIn(i-1)", "conflictIn[i-1]");
content = content.replace("indexLookupIn(i-1)", "indexLookupIn[i-1]");
content = content.replace("Col<int> counter=Col<int>(1);","Col<int> counter=Col<int>(2);");
content = content.replace("Col<int> counter=Col<int>(1);", "Col<int> counter=Col<int>(2);");
Files.write(path, content.getBytes(charset));
}
}
......@@ -344,8 +356,8 @@ public class GenerationTest extends AbstractSymtabTest {
DistributedTargetGenerator distributedTargetGenerator = new DistributedTargetGenerator();
distributedTargetGenerator.setGenerationTargetPath("./target/generated-sources-cmake/paramInit/src/");
distributedTargetGenerator.add(new CPPGenImpl(),"cpp");
distributedTargetGenerator.generate(componentInstanceSymbol,taggingResolver);
distributedTargetGenerator.add(new CPPGenImpl(), "cpp");
distributedTargetGenerator.generate(componentInstanceSymbol, taggingResolver);
}
@Ignore
......@@ -365,8 +377,8 @@ public class GenerationTest extends AbstractSymtabTest {
// 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));
generatorCPP.generateFiles(componentInstanceSymbol, taggingResolver);
generatorCPP.generateFile(TestConverter.generateMainTestFile(streamSymbol, componentInstanceSymbol));
}
@Test
......
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