Skip to content
Snippets Groups Projects
Commit 5dbfe76b authored by Johannes Mey's avatar Johannes Mey
Browse files

move diagram generation to test

parent 9ba558f7
No related branches found
No related tags found
No related merge requests found
Pipeline #12785 failed
......@@ -16,7 +16,8 @@ build:
- "./gradlew assemble"
artifacts:
paths:
- "src/gen"
- "src/gen/java"
- "src/gen/jastadd"
test:
image: openjdk:11
......@@ -28,6 +29,8 @@ test:
artifacts:
reports:
junit: "*/build/test-results/test/TEST-*.xml"
paths:
- "src/gen/resources"
ragdoc_build:
image:
......@@ -68,7 +71,6 @@ pages:
stage: publish
needs:
- ragdoc_view
- build
- test
before_script:
- pip install -r pages/requirements.txt
......
......@@ -34,6 +34,16 @@ dependencies {
jastadd2 "org.jastadd:jastadd:2.3.5"
implementation group: 'de.tudresden.inf.st', name: 'dumpAstWithPlantuml', version: '0.3.6-54'
grammar2uml group: 'de.tudresden.inf.st', name: 'grammar2uml', version: '0.2.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.assertj:assertj-core:3.22.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}
test {
testLogging {
showStandardStreams = true
}
useJUnitPlatform()
}
// Default run configuration
......
package de.tudresden.inf.st.mg;
import de.tudresden.inf.st.mg.common.MotionGrammarParser;
import de.tudresden.inf.st.mg.jastadd.model.T1;
import de.tudresden.inf.st.mg.jastadd.model.World;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Comparator;
import java.util.Random;
import static org.assertj.core.api.Assertions.assertThat;
public class ParserTest {
public static final Path AST_DIAGRAM_DIR = Path.of("src", "gen", "resources", "diagrams", "parsing");
@BeforeAll
static void prepareOutputPath() throws IOException {
Files.walk(AST_DIAGRAM_DIR)
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
Files.createDirectories(AST_DIAGRAM_DIR);
}
@Test
void runParser() throws MotionGrammarParser.ParseException {
// for some reason, the best random seed value here is 1 and not 0???
World world = World.initialWorld(new Random(1));
WorldParser parser = new WorldParser(world);
var result = parser.parseT();
assertThat(result).isNotNull().isInstanceOf(T1.class);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment