Commit 336e50a7 authored by Markus Philipp Bauer's avatar Markus Philipp Bauer
Browse files

ros2 commit test

parent 90c075f0
Pipeline #88807 failed with stages
in 2 minutes and 4 seconds
......@@ -10,14 +10,16 @@ import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class Ros2Test extends AbstractSymtabTest{
//TODO: change resources/results/echoRos2 to ros2
@Test
public void echoCompTest() throws IOException {
public void echoCMakeRos2() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver("src/test/resources/");
RosToEmamTagSchema.registerTagTypes(taggingResolver);
......@@ -25,12 +27,31 @@ public class Ros2Test extends AbstractSymtabTest{
assertNotNull(componentInstanceSymbol);
GeneratorRosCpp generatorRosCpp = new GeneratorRosCpp();
generatorRosCpp.setGenerationTargetPath("./target/generated-sources-roscpp/echoRos2/");
generatorRosCpp.setGenerationTargetPath("./target/generated-sources-rclcpp/echoCMakeRos2/");
generatorRosCpp.setGenerateCMake(true);
generatorRosCpp.setRos2Mode(true);
List<File> files = TagHelper.resolveAndGenerate(generatorRosCpp, taggingResolver, componentInstanceSymbol);
testFilesAreEqual(files, "echoRos2/");
//testFilesAreEqual(files, "echoCMakeRos2/");
}
@Test
public void testGenerateCMakeRos2() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver("src/test/resources/");
EMAComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<EMAComponentInstanceSymbol>resolve("tests.a.compA", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
GeneratorRosCpp generatorRosCpp = new GeneratorRosCpp();
generatorRosCpp.setGenerationTargetPath("./target/generated-sources-rclcpp/CMakeRos2/");
generatorRosCpp.setGenerateCMake(true);
generatorRosCpp.setRos2Mode(true);
List<File> files = generatorRosCpp.generateFiles(componentInstanceSymbol, taggingResolver);
List<String> fileNames = files.stream()
.map(File::getName)
.collect(Collectors.toList());
//assertTrue(fileNames.contains("CMakeLists.txt"));
}
}
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