Skip to content

Commit 87f9f32

Browse files
committed
Renovation of the TestCase generation
1 parent 5b08998 commit 87f9f32

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+990
-1215
lines changed

key.core.testgen/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ description "Test Case Generation based on proof attempts."
22

33
dependencies {
44
implementation project(":key.core")
5+
implementation("com.squareup:javapoet:1.13.0")
56
}

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

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package de.uka.ilkd.key.testgen;
2+
3+
public enum Format {
4+
Plain, JUnit4, JUnit5, TestNG,
5+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import de.uka.ilkd.key.settings.ProofDependentSMTSettings;
2222
import de.uka.ilkd.key.settings.ProofIndependentSMTSettings;
2323
import de.uka.ilkd.key.settings.ProofIndependentSettings;
24-
import de.uka.ilkd.key.settings.TestGenerationSettings;
24+
import de.uka.ilkd.key.testgen.settings.TestGenerationSettings;
2525
import de.uka.ilkd.key.smt.*;
2626
import de.uka.ilkd.key.smt.lang.SMTSort;
2727
import de.uka.ilkd.key.smt.model.Model;

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,11 @@
2424
import org.slf4j.Logger;
2525
import org.slf4j.LoggerFactory;
2626

27-
public class ProofInfo {
27+
public record ProofInfo(Proof proof, Services services) {
2828
private static final Logger LOGGER = LoggerFactory.getLogger(ProofInfo.class);
2929

30-
private final Proof proof;
31-
32-
private final Services services;
33-
3430
public ProofInfo(Proof proof) {
35-
this.proof = proof;
36-
this.services = proof.getServices();
31+
this(proof, proof.getServices());
3732
}
3833

3934
public IProgramMethod getMUT() {
@@ -79,7 +74,7 @@ public Term getPreConTerm() {
7974
if (c instanceof FunctionalOperationContract t) {
8075
OriginalVariables orig = t.getOrigVars();
8176
Term post = t.getPre(services.getTypeConverter().getHeapLDT().getHeap(), orig.self,
82-
orig.params, orig.atPres, services);
77+
orig.params, orig.atPres, services);
8378
return post;
8479
}
8580
// no pre <==> false
@@ -170,7 +165,7 @@ private String processUpdate(Term update) {
170165
return "";
171166
}
172167
return " \n" + up.lhs().sort() + " " + up.lhs().toString() + " = " + update.sub(0)
173-
+ ";";
168+
+ ";";
174169
}
175170
StringBuilder result = new StringBuilder();
176171
for (Term sub : update.subs()) {

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

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,17 @@
33
* SPDX-License-Identifier: GPL-2.0-only */
44
package de.uka.ilkd.key.testgen;
55

6+
import org.jspecify.annotations.Nullable;
7+
68
/**
7-
* Reference expression
9+
* Reference expression.
10+
* <p>
11+
* Example: rcObj.field, where rcObjType is the type of rcObj. The prefix "rc" stands for
12+
* receiver.
813
*
914
* @author gladisch
1015
*/
11-
public class RefEx {
12-
public final String rcObjType;
13-
public final String rcObj;
14-
public final String fieldType;
15-
public final String field;
16-
17-
/**
18-
* Example: rcObj.field, where rcObjType is the type of rcObj. The prefix "rc" stands for
19-
* receiver.
20-
*/
21-
public RefEx(String rcObjType, String rcObj, String fieldType, String field) {
22-
this.rcObjType = rcObjType;
23-
this.rcObj = rcObj;
24-
this.fieldType = fieldType;
25-
this.field = field;
26-
}
27-
16+
public record RefEx(@Nullable String rcObjType, String rcObj, String fieldType, String field) {
2817
@Override
2918
public String toString() {
3019
if (rcObjType != null && !rcObjType.isEmpty()) {

0 commit comments

Comments
 (0)