Skip to content

Commit 64bb3c5

Browse files
committed
fxing the test case generation
1 parent 4b5ff34 commit 64bb3c5

File tree

23 files changed

+1688
-646
lines changed

23 files changed

+1688
-646
lines changed

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class Constants {
1313
*/
1414
public static final String NEW_LINE = StringUtil.NEW_LINE;
1515
public static final String NULLABLE = "/*@ nullable */";
16+
1617
public static final String ALL_OBJECTS = "allObjects";
1718
public static final String ALL_INTS = "allInts";
1819
public static final String ALL_BOOLS = "allBools";

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/ModelGenerator.java

Lines changed: 0 additions & 191 deletions
This file was deleted.

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/OutputEnvironment.java

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.io.IOException;
77
import java.nio.file.Files;
88
import java.nio.file.Path;
9-
import java.nio.file.StandardCopyOption;
109
import java.util.Objects;
1110

1211
/**
@@ -15,23 +14,49 @@
1514
* @author Alexander Weigl
1615
* @version 1 (02.02.24)
1716
*/
18-
public record OutputEnvironment(Path targetFolder) {
19-
/** Returns the source code folder */
17+
public record OutputEnvironment(Path targetFolder, boolean onlyTestDir) {
18+
/**
19+
* Returns the source code folder
20+
*/
2021
public Path getSourceDir() {
21-
return targetFolder.resolve("src");
22+
return targetFolder.resolve("src/main/java");
2223
}
2324

24-
/** Returns the test code folder */
25+
/**
26+
* Returns the test code folder
27+
*/
2528
public Path getTestSourceDir() {
26-
return targetFolder.resolve("test");
29+
if (onlyTestDir) {
30+
return targetFolder;
31+
}
32+
return targetFolder.resolve("src/test/java");
2733
}
2834

29-
/** Returns the path to the ANT build.xml file */
35+
/**
36+
* Returns the path to the ANT build.xml file
37+
*/
3038
public Path getAntFile() {
3139
return targetFolder.resolve("build.xml");
3240
}
3341

34-
/** Returns the path to the README.md file */
42+
/**
43+
* Returns the path to the ANT build.xml file
44+
*/
45+
public Path getGradleFile() {
46+
return targetFolder.resolve("build.gradle.kts");
47+
}
48+
49+
/**
50+
* Returns the path to the pom.xml for Maven file
51+
*/
52+
public Path getMavenFile() {
53+
return targetFolder.resolve("pom.xml");
54+
}
55+
56+
57+
/**
58+
* Returns the path to the README.md file
59+
*/
3560
public Path getReadmeFile() {
3661
return targetFolder.resolve("README.md");
3762
}
@@ -42,15 +67,30 @@ public Path getReadmeFile() {
4267
* @throws IOException if the output folder is not write or the folders can not be created.
4368
*/
4469
public void init() throws IOException {
45-
Files.createDirectories(getSourceDir());
4670
Files.createDirectories(getTestSourceDir());
47-
installAntFile();
71+
if (!onlyTestDir) {
72+
Files.createDirectories(getSourceDir());
73+
installProjectFile();
74+
}
4875
}
4976

50-
private void installAntFile() throws IOException {
51-
try (var buildXml = getClass().getResourceAsStream("/de/uka/ilkd/key/tcg/build.xml")) {
52-
Files.copy(Objects.requireNonNull(buildXml), getAntFile(),
53-
StandardCopyOption.REPLACE_EXISTING);
77+
private void installProjectFile() throws IOException {
78+
if (!Files.exists(getAntFile())) {
79+
try (var buildXml = getClass().getResourceAsStream("/de/uka/ilkd/key/tcg/build.xml")) {
80+
Files.copy(Objects.requireNonNull(buildXml), getAntFile());
81+
}
82+
}
83+
84+
if (!Files.exists(getMavenFile())) {
85+
try (var pomXml = getClass().getResourceAsStream("/de/uka/ilkd/key/tcg/pom.xml")) {
86+
Files.copy(Objects.requireNonNull(pomXml), getMavenFile());
87+
}
88+
}
89+
90+
if (!Files.exists(getGradleFile())) {
91+
try (var gradleKts = getClass().getResourceAsStream("/de/uka/ilkd/key/tcg/build.gradle.kts")) {
92+
Files.copy(Objects.requireNonNull(gradleKts), getGradleFile());
93+
}
5494
}
5595
}
5696
}

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/RefEx.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)