Add generate BC Code Test

This commit is contained in:
Till Schnell 2021-05-10 18:10:19 +02:00
parent fd7628cb40
commit a7b9c2a4ee
6 changed files with 93 additions and 37 deletions

View File

@ -14,7 +14,6 @@ import org.hamcrest.CoreMatchers;
import org.junit.Before;
import org.junit.Test;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericGenratorResultForSourceFile;
import de.dhbwstuttgart.core.JavaTXCompiler;
import de.dhbwstuttgart.inferWildcards.ConstraintsGenerationUtils;
import de.dhbwstuttgart.inferWildcards.JavaTXCompilerWildcards;
@ -125,8 +124,6 @@ public class TestInferWildcardsFields
System.out.println(typeInference);
List<ResultSet> expectedTypeInferResult = generateExpectedTypeInferResult(wildcardsCompiler);
assertThat("Type Inference Results containing the correct Wildcard results", typeInference,
CoreMatchers.anything());
}
@ -134,16 +131,8 @@ public class TestInferWildcardsFields
@Test
public void testGenrationBytecode () throws ClassNotFoundException, IOException {
JavaTXCompilerWildcards wildcardsCompiler = getWildcardsCompiler();
wildcardsCompiler.getTphMap();
List<ResultSet> typeinferenceResult = generateExpectedTypeInferResult(wildcardsCompiler);
List<GenericGenratorResultForSourceFile> simplifyResultsForAllSourceFiles = wildcardsCompiler
.getGeneratedGenericResultsForAllSourceFiles(
typeinferenceResult);
wildcardsCompiler.generateBytecode(new File(resourceDirPath + "/generatedBC"), typeinferenceResult,
simplifyResultsForAllSourceFiles);
wildcardsCompiler.generateBytecode(new File(resourceDirPath + "/generatedBC"));
assertThat("Generation Succeeded", null, CoreMatchers.anything());
}

View File

@ -26,21 +26,22 @@ import de.dhbwstuttgart.typeinference.result.ResultSet;
public class TestInferWildcardsMap
{
private String resourcePath;
private String resourceFilePath;
private String resourceDirPath;
@Before
public void setup () {
resourcePath = System.getProperty("user.dir")
+ "/src/test/resources/inferWildcards/TestClassWildcardsMap.java";
resourceDirPath = System.getProperty("user.dir") + "/src/test/resources/inferWildcards";
resourceFilePath = resourceDirPath + "/TestClassWildcardsMap.java";
}
private JavaTXCompiler getStandardCompiler () throws ClassNotFoundException, IOException {
File[] files1 = { new File(resourcePath) };
File[] files1 = { new File(resourceFilePath) };
return new JavaTXCompiler(files1);
}
private JavaTXCompilerWildcards getWildcardsCompiler () throws ClassNotFoundException, IOException {
File[] files1 = { new File(resourcePath) };
File[] files1 = { new File(resourceFilePath) };
return new JavaTXCompilerWildcards(files1);
}
@ -99,5 +100,17 @@ public class TestInferWildcardsMap
List<ResultSet> typeInference = wildcardsCompiler.typeInference();
System.out.println(typeInference);
assertThat("Type Inference Results containing the correct Wildcard results", typeInference,
CoreMatchers.anything());
}
@Test
public void testGenrationBytecode () throws ClassNotFoundException, IOException {
JavaTXCompilerWildcards wildcardsCompiler = getWildcardsCompiler();
wildcardsCompiler.generateBytecode(new File(resourceDirPath + "/generatedBC"));
assertThat("Generation Succeeded", null, CoreMatchers.anything());
}
}

View File

@ -26,21 +26,23 @@ import de.dhbwstuttgart.typeinference.result.ResultSet;
public class TestInferWildcardsMapNested
{
private String resourcePath;
private String resourceFilePath;
private String resourceDirPath;
@Before
public void setup () {
resourcePath = System.getProperty("user.dir")
+ "/src/test/resources/inferWildcards/TestClassWildcardsMapNested.java";
resourceDirPath = System.getProperty("user.dir") + "/src/test/resources/inferWildcards";
resourceFilePath = resourceDirPath + "/TestClassWildcardsMapNested.java";
}
private JavaTXCompiler getStandardCompiler () throws ClassNotFoundException, IOException {
File[] files1 = { new File(resourcePath) };
File[] files1 = { new File(resourceFilePath) };
return new JavaTXCompiler(files1);
}
private JavaTXCompilerWildcards getWildcardsCompiler () throws ClassNotFoundException, IOException {
File[] files1 = { new File(resourcePath) };
File[] files1 = { new File(resourceFilePath) };
return new JavaTXCompilerWildcards(files1);
}
@ -99,5 +101,17 @@ public class TestInferWildcardsMapNested
List<ResultSet> typeInference = wildcardsCompiler.typeInference();
System.out.println(typeInference);
assertThat("Type Inference Results containing the correct Wildcard results", typeInference,
CoreMatchers.anything());
}
@Test
public void testGenrationBytecode () throws ClassNotFoundException, IOException {
JavaTXCompilerWildcards wildcardsCompiler = getWildcardsCompiler();
wildcardsCompiler.generateBytecode(new File(resourceDirPath + "/generatedBC"));
assertThat("Generation Succeeded", null, CoreMatchers.anything());
}
}

View File

@ -26,21 +26,22 @@ import de.dhbwstuttgart.typeinference.result.ResultSet;
public class TestInferWildcardsNested
{
private String resourcePath;
private String resourceFilePath;
private String resourceDirPath;
@Before
public void setup () {
resourcePath = System.getProperty("user.dir")
+ "/src/test/resources/inferWildcards/TestClassWildcardsNested.java";
resourceDirPath = System.getProperty("user.dir") + "/src/test/resources/inferWildcards";
resourceFilePath = resourceDirPath + "/TestClassWildcardsNested.java";
}
private JavaTXCompiler getStandardCompiler () throws ClassNotFoundException, IOException {
File[] files1 = { new File(resourcePath) };
File[] files1 = { new File(resourceFilePath) };
return new JavaTXCompiler(files1);
}
private JavaTXCompilerWildcards getWildcardsCompiler () throws ClassNotFoundException, IOException {
File[] files1 = { new File(resourcePath) };
File[] files1 = { new File(resourceFilePath) };
return new JavaTXCompilerWildcards(files1);
}
@ -99,5 +100,18 @@ public class TestInferWildcardsNested
List<ResultSet> typeInference = wildcardsCompiler.typeInference();
System.out.println(typeInference);
assertThat("Type Inference Results containing the correct Wildcard results", typeInference,
CoreMatchers.anything());
}
@Test
public void testGenrationBytecode () throws ClassNotFoundException, IOException {
JavaTXCompilerWildcards wildcardsCompiler = getWildcardsCompiler();
wildcardsCompiler.generateBytecode(new File(resourceDirPath + "/generatedBC"));
assertThat("Generation Succeeded", null, CoreMatchers.anything());
}
}

View File

@ -26,21 +26,22 @@ import de.dhbwstuttgart.typeinference.result.ResultSet;
public class TestInferWildcardsParamType
{
private String resourcePath;
private String resourceFilePath;
private String resourceDirPath;
@Before
public void setup () {
resourcePath = System.getProperty("user.dir")
+ "/src/test/resources/inferWildcards/TestClassWildcardsParamType.java";
resourceDirPath = System.getProperty("user.dir") + "/src/test/resources/inferWildcards";
resourceFilePath = resourceDirPath + "/TestClassWildcardsParamType.java";
}
private JavaTXCompiler getStandardCompiler () throws ClassNotFoundException, IOException {
File[] files1 = { new File(resourcePath) };
File[] files1 = { new File(resourceFilePath) };
return new JavaTXCompiler(files1);
}
private JavaTXCompilerWildcards getWildcardsCompiler () throws ClassNotFoundException, IOException {
File[] files1 = { new File(resourcePath) };
File[] files1 = { new File(resourceFilePath) };
return new JavaTXCompilerWildcards(files1);
}
@ -99,5 +100,17 @@ public class TestInferWildcardsParamType
List<ResultSet> typeInference = wildcardsCompiler.typeInference();
System.out.println(typeInference);
assertThat("Type Inference Results containing the correct Wildcard results", typeInference,
CoreMatchers.anything());
}
@Test
public void testGenrationBytecode () throws ClassNotFoundException, IOException {
JavaTXCompilerWildcards wildcardsCompiler = getWildcardsCompiler();
wildcardsCompiler.generateBytecode(new File(resourceDirPath + "/generatedBC"));
assertThat("Generation Succeeded", null, CoreMatchers.anything());
}
}

View File

@ -26,21 +26,22 @@ import de.dhbwstuttgart.typeinference.result.ResultSet;
public class TestInferWildcardsSingle
{
private String resourcePath;
private String resourceFilePath;
private String resourceDirPath;
@Before
public void setup () {
resourcePath = System.getProperty("user.dir")
+ "/src/test/resources/inferWildcards/TestClassWildcardsSingle.java";
resourceDirPath = System.getProperty("user.dir") + "/src/test/resources/inferWildcards";
resourceFilePath = resourceDirPath + "/TestClassWildcardsSingle.java";
}
private JavaTXCompiler getStandardCompiler () throws ClassNotFoundException, IOException {
File[] files1 = { new File(resourcePath) };
File[] files1 = { new File(resourceFilePath) };
return new JavaTXCompiler(files1);
}
private JavaTXCompilerWildcards getWildcardsCompiler () throws ClassNotFoundException, IOException {
File[] files1 = { new File(resourcePath) };
File[] files1 = { new File(resourceFilePath) };
return new JavaTXCompilerWildcards(files1);
}
@ -99,5 +100,17 @@ public class TestInferWildcardsSingle
List<ResultSet> typeInference = wildcardsCompiler.typeInference();
System.out.println(typeInference);
assertThat("Type Inference Results containing the correct Wildcard results", typeInference,
CoreMatchers.anything());
}
@Test
public void testGenrationBytecode () throws ClassNotFoundException, IOException {
JavaTXCompilerWildcards wildcardsCompiler = getWildcardsCompiler();
wildcardsCompiler.generateBytecode(new File(resourceDirPath + "/generatedBC"));
assertThat("Generation Succeeded", null, CoreMatchers.anything());
}
}