forked from JavaTX/JavaCompilerCore
weitere Testcases eingefügt
This commit is contained in:
parent
fd5aafb0eb
commit
36fd915248
9
test/plugindevelopment/MartinTestCases/AchimTest1.jav
Executable file
9
test/plugindevelopment/MartinTestCases/AchimTest1.jav
Executable file
@ -0,0 +1,9 @@
|
||||
class Test{
|
||||
test(){
|
||||
return 1;
|
||||
}
|
||||
test2(){
|
||||
i;
|
||||
i = test();
|
||||
}
|
||||
}
|
12
test/plugindevelopment/MartinTestCases/BoundedType.jav
Executable file
12
test/plugindevelopment/MartinTestCases/BoundedType.jav
Executable file
@ -0,0 +1,12 @@
|
||||
class BoundedType {
|
||||
|
||||
<T extends Boolean & Number> m(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Boolean> m1(x) {
|
||||
T y;
|
||||
x = y;
|
||||
return y;
|
||||
}
|
||||
}
|
16
test/plugindevelopment/MartinTestCases/BoundedType1.jav
Executable file
16
test/plugindevelopment/MartinTestCases/BoundedType1.jav
Executable file
@ -0,0 +1,16 @@
|
||||
interface BB<T> { }
|
||||
interface AA extends BB<Integer> {
|
||||
<T> AAm(BB<T> x);
|
||||
}
|
||||
|
||||
interface RR extends BB<String> {
|
||||
}
|
||||
|
||||
class BoundedType1 {
|
||||
|
||||
|
||||
<T1 extends Boolean & Number & AA & RR> m1(AA a) {
|
||||
T1 b;
|
||||
a.AAm(b);
|
||||
}
|
||||
}
|
15
test/plugindevelopment/MartinTestCases/BoundedType2.jav
Executable file
15
test/plugindevelopment/MartinTestCases/BoundedType2.jav
Executable file
@ -0,0 +1,15 @@
|
||||
class BoundedType {
|
||||
<T extends Boolean & Number> m(T x) {
|
||||
r;
|
||||
r=x;
|
||||
return r;
|
||||
}
|
||||
m1(b) { return b; }
|
||||
|
||||
}
|
||||
|
||||
class Id {
|
||||
BoundedType bb;
|
||||
m(x) { return bb.m1(x); }
|
||||
}
|
||||
|
16
test/plugindevelopment/MartinTestCases/OL.jav
Executable file
16
test/plugindevelopment/MartinTestCases/OL.jav
Executable file
@ -0,0 +1,16 @@
|
||||
class OL {
|
||||
|
||||
Integer m(Integer x) { return x + x; }
|
||||
|
||||
Boolean m(Boolean x) {return x || x; }
|
||||
}
|
||||
|
||||
class Main {
|
||||
|
||||
main(x) {
|
||||
ol;
|
||||
ol = new OL();
|
||||
return ol.m(x);
|
||||
}
|
||||
|
||||
}
|
20
test/plugindevelopment/MartinTestCases/OL2.jav
Executable file
20
test/plugindevelopment/MartinTestCases/OL2.jav
Executable file
@ -0,0 +1,20 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class OL2 {
|
||||
|
||||
Integer m(Integer x) { return x + x; }
|
||||
|
||||
Boolean m(Boolean x) {return x || x; }
|
||||
}
|
||||
|
||||
class Main {
|
||||
|
||||
main(x) {
|
||||
ol;
|
||||
ol = new OL2();
|
||||
y;
|
||||
/* y = new Vector<Integer>(); */
|
||||
y.addElement(ol.m(x));
|
||||
}
|
||||
|
||||
}
|
41
test/plugindevelopment/MartinTestCases/Probleme
Executable file
41
test/plugindevelopment/MartinTestCases/Probleme
Executable file
@ -0,0 +1,41 @@
|
||||
- Sequenz-Diagramme fuer TR-Algorithmen
|
||||
- In der GUI werden bei der Auswahl bei Typisierungen mehrerer Klassen immer nur die Typisierung der einzelnen Klasse angepasst (Use-Rase ZweiKlassen.jav)
|
||||
- Bound bleiben in der GUI erhalten auch wenn durch Auswahl die Bounds gar nicht mehr existieren (Use-Rase BoundedType2.jav)
|
||||
- Parameter gehen nicht Matrix Use-Rase
|
||||
- gleiche TypePlaceHolder in unterschiedlichen Intersections werden durch unterschiedliche GentypeVars ersetzt (BoundedType2.jav)
|
||||
- Mail von Juergen, welche Usecases machen ihm Probleme?
|
||||
- UsedId bei bei "extends" in RefType bzw. bei "implements" in Vector<RefType> umwandeln. (siehe mail an Timo)
|
||||
- Roundtrip fuer den Innovator einbauen erledigt 06-06
|
||||
- Schnittstelle mit syntaktischen Angaben fuer den Konstantenpool wird bei unbeboxten Typen nicht richtig erzeugt
|
||||
- Boxing und Unboxing geht noch nicht bei allen primitiven Typen und Operatoren
|
||||
--------------------------------------------------------------------------------------------------
|
||||
- makeFC testen durch Verschiebung von TyploseVaribale yu GentypeVar
|
||||
sind Probleme entstanden PL 06-03-16
|
||||
- Alle UseCases noch mit Vervielfachung testen
|
||||
- Codeerzeugung: called_method
|
||||
- Returntyp void UsecaseThree_pl.jav ERLEDIGT Fehler in Void.java 05-07-31
|
||||
- Parameter in Typen: Werden die �berhaupt betrachtet? UsecaseTwo_pl.jav
|
||||
- Die Argumente bei UsedId Konstruktion f�r die Parameter in dem Attribut paralist von Typen
|
||||
sind immer GenericTypeVars, k�nnten aber auch Typen wie Integer als RefTypes sein.
|
||||
In der Methode wandleGeneric2RefType (MyCompiler) werden nur die GenericTypeVars
|
||||
der Superklassen-Deklarationen angepasst. Hier muessten alle expliziten Typdeklarationen
|
||||
im gesamten abstrakten Syntaxbaum angepasst werden. Koennte ueber eine Registry
|
||||
und die Listener realisiert werden. ERLEDIGT SourceFile.java 05-07-31
|
||||
- getypte Variablen werden nicht richtig gesetzt UsecaseFive_pl.jav ERLEDIGT JavaParser.jay 05-07-30
|
||||
|
||||
- UNIFY funktioniert nicht mit GenericTypeVars UsecaseOne_pl.jav
|
||||
- Einschränkungen bei TRMAPP von noch einbauen.
|
||||
- a.b wird als Expression nicht in InstVar umgewandelt, sondern bleibt LocalOrFieldVar mit UsedId UsecaseNine_pl.jav
|
||||
wird inzwischen bei zwei Identifieren umgewandelt. Mit mehr testen
|
||||
- In Usecase UsecaseNine_pl.jav wird der Parameter bei der Klasse bei b nicht bestimmt.
|
||||
- Braucht man das Field type vom Typ String in InstVar.java?
|
||||
- in Assign stimmt der Typ von Assign nicht (Beispiel Matrix1.jav in bajo)
|
||||
- unifyAndregister in allen Subklassen von ExprStmt durch register ersetzen. erledigt 05-08-21
|
||||
- Class.java: m_MethodIntersectionTypes wird in CTypeReconstructionResult nicht richtig gestetzt.
|
||||
Beispiel Matrix.jav in bajo1_usecases
|
||||
- clone in alle Subklassen von CTypeAssumption ueberpruefen.
|
||||
- Was ist der Unterschied zwischen RefType.clone() und Pair.copyType
|
||||
- in instanceSmaller neuhinzugekommene GENTYPEVARS durch typlose Vars ersetzen.
|
||||
- EST95A anschauen. Insbesondere: Wann ist this View und wann GView?
|
||||
siehe SubtypeingTest this wird immer dynamisch angepasst. Auch in
|
||||
der Theorie aendern
|
11
test/plugindevelopment/MartinTestCases/SMatrix.jav
Executable file
11
test/plugindevelopment/MartinTestCases/SMatrix.jav
Executable file
@ -0,0 +1,11 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class Matrix extends Vector<Vector<Integer>> {
|
||||
|
||||
mul(){
|
||||
Vector<Vector<Integer>> ret1;
|
||||
Vector<A> ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
10
test/plugindevelopment/MartinTestCases/Simple.jav
Executable file
10
test/plugindevelopment/MartinTestCases/Simple.jav
Executable file
@ -0,0 +1,10 @@
|
||||
class Simple {
|
||||
|
||||
simple(a) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
main(a) {
|
||||
return a;
|
||||
}
|
||||
}
|
57
test/plugindevelopment/MartinTestCases/Tester.java
Normal file
57
test/plugindevelopment/MartinTestCases/Tester.java
Normal file
@ -0,0 +1,57 @@
|
||||
package plugindevelopment.MartinTestCases;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import plugindevelopment.TypeInsertTester;
|
||||
import plugindevelopment.TypeInsertTests.MultipleTypesInsertTester;
|
||||
import junit.framework.TestCase;
|
||||
import mycompiler.MyCompiler;
|
||||
import mycompiler.MyCompilerAPI;
|
||||
import mycompiler.myparser.JavaParser.yyException;
|
||||
import mycompiler.mytypereconstruction.TypeinferenceResultSet;
|
||||
import typinferenz.TypeInsertSet;
|
||||
|
||||
public class Tester extends TypeInsertTester{
|
||||
|
||||
public final static String rootDirectory = System.getProperty("user.dir")+"/test/plugindevelopment/MartinTestCases/";
|
||||
|
||||
public static void test(String sourceFileToInfere, Vector<String> mustContain){
|
||||
String gesamterSrc = "";
|
||||
String inferedSource = "";
|
||||
MyCompilerAPI compiler = MyCompiler.getAPI();
|
||||
try {
|
||||
compiler.parse(new File(rootDirectory + sourceFileToInfere));
|
||||
Vector<TypeinferenceResultSet> results = compiler.typeReconstruction();
|
||||
//TestCase.assertTrue("Es darf nicht mehr als eine Lösungsmöglichkeit geben und nicht "+results.size(), results.size()==1);
|
||||
for(TypeinferenceResultSet result : results){
|
||||
Vector<TypeInsertSet> points = result.getTypeInsertionPoints();
|
||||
//TestCase.assertTrue("Es muss mindestens ein TypeInsertSet vorhanden sein", points.size()>0);
|
||||
for(TypeInsertSet point : points){
|
||||
//TestCase.assertTrue("Es muss mindestens ein TypeInsertPoint vorhanden sein", point.points.size()>0);
|
||||
if(point.points.size()>0){
|
||||
inferedSource = point.insertAllTypes(TypeInsertTester.getFileContent(rootDirectory + sourceFileToInfere));
|
||||
System.out.println(inferedSource);
|
||||
gesamterSrc += inferedSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException | yyException e) {
|
||||
e.printStackTrace();
|
||||
TestCase.fail();
|
||||
}
|
||||
for(String containString : mustContain){
|
||||
TestCase.assertTrue("\""+containString+"\" muss in den inferierten Lösungen vorkommen",gesamterSrc.contains(containString));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void runTests(){
|
||||
Tester.test("OL.jav", new Vector<String>());
|
||||
}
|
||||
|
||||
}
|
11
test/plugindevelopment/MartinTestCases/UnifyTest1.jav
Executable file
11
test/plugindevelopment/MartinTestCases/UnifyTest1.jav
Executable file
@ -0,0 +1,11 @@
|
||||
import java.util.Vector;
|
||||
import java.util.Stack;
|
||||
|
||||
|
||||
class Test {
|
||||
public getValue(a){
|
||||
String x;
|
||||
a.addElement(x);
|
||||
}
|
||||
|
||||
}
|
10
test/plugindevelopment/MartinTestCases/UsecaseEight_pl.jav
Executable file
10
test/plugindevelopment/MartinTestCases/UsecaseEight_pl.jav
Executable file
@ -0,0 +1,10 @@
|
||||
class UsecaseEight_pl<A> {
|
||||
|
||||
foo1() {
|
||||
a;
|
||||
b;
|
||||
a = b.foo1();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
9
test/plugindevelopment/MartinTestCases/UsecaseFive_pl.jav
Executable file
9
test/plugindevelopment/MartinTestCases/UsecaseFive_pl.jav
Executable file
@ -0,0 +1,9 @@
|
||||
class UsecaseFive_pl<A> {
|
||||
|
||||
foo() {
|
||||
Vector<Integer> c;
|
||||
c = new Vector<Integer>() ;
|
||||
return c;
|
||||
}
|
||||
|
||||
}
|
9
test/plugindevelopment/MartinTestCases/UsecaseFour_pl.jav
Executable file
9
test/plugindevelopment/MartinTestCases/UsecaseFour_pl.jav
Executable file
@ -0,0 +1,9 @@
|
||||
class UsecaseFour_pl<A> {
|
||||
|
||||
foo() {
|
||||
c;
|
||||
c = new Vector<Integer>() ;
|
||||
return c;
|
||||
}
|
||||
|
||||
}
|
12
test/plugindevelopment/MartinTestCases/UsecaseNine_pl.jav
Executable file
12
test/plugindevelopment/MartinTestCases/UsecaseNine_pl.jav
Executable file
@ -0,0 +1,12 @@
|
||||
class UsecaseNine_pl<A> {
|
||||
|
||||
Integer c;
|
||||
|
||||
foo1() {
|
||||
a;
|
||||
b;
|
||||
a = b.c;
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
20
test/plugindevelopment/MartinTestCases/UsecaseOne_pl.jav
Executable file
20
test/plugindevelopment/MartinTestCases/UsecaseOne_pl.jav
Executable file
@ -0,0 +1,20 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class UsecaseOne_pl<A> {
|
||||
|
||||
A x;
|
||||
|
||||
foo(bar){
|
||||
bar = true;
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
foo1(a) {
|
||||
c;
|
||||
c = new Vector<A>();
|
||||
b;
|
||||
b = new UsecaseOne_pl<A>();
|
||||
return c.addElement(a);
|
||||
}
|
||||
*/
|
||||
}
|
18
test/plugindevelopment/MartinTestCases/UsecaseSeven_pl.jav
Executable file
18
test/plugindevelopment/MartinTestCases/UsecaseSeven_pl.jav
Executable file
@ -0,0 +1,18 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class UsecaseSeven_pl<A> {
|
||||
|
||||
foo(bar){
|
||||
bar = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
foo1(a) {
|
||||
c;
|
||||
c = new Vector<Integer>();
|
||||
b;
|
||||
b = new UsecaseSeven_pl<A>();
|
||||
return c.addElement(a);
|
||||
}
|
||||
|
||||
}
|
5
test/plugindevelopment/MartinTestCases/UsecaseSix_pl.jav
Executable file
5
test/plugindevelopment/MartinTestCases/UsecaseSix_pl.jav
Executable file
@ -0,0 +1,5 @@
|
||||
class uuu {}
|
||||
class vvv<A> {}
|
||||
class UsecaseSix_pl<A> extends Vector<vvv<uuu>> {
|
||||
|
||||
}
|
14
test/plugindevelopment/MartinTestCases/UsecaseTen_pl.jav
Executable file
14
test/plugindevelopment/MartinTestCases/UsecaseTen_pl.jav
Executable file
@ -0,0 +1,14 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class UsecaseTen_pl<A> {
|
||||
|
||||
Vector<Integer> c;
|
||||
|
||||
foo1() {
|
||||
a;
|
||||
b;
|
||||
a = b.c.elementAt(1);
|
||||
return b;
|
||||
}
|
||||
|
||||
}
|
9
test/plugindevelopment/MartinTestCases/UsecaseThree_pl.jav
Executable file
9
test/plugindevelopment/MartinTestCases/UsecaseThree_pl.jav
Executable file
@ -0,0 +1,9 @@
|
||||
class UsecaseThree_pl<A> {
|
||||
|
||||
foo() {
|
||||
c;
|
||||
c = new Vector<A>();
|
||||
return c;
|
||||
}
|
||||
|
||||
}
|
11
test/plugindevelopment/MartinTestCases/UsecaseThree_pl.orig.jav
Executable file
11
test/plugindevelopment/MartinTestCases/UsecaseThree_pl.orig.jav
Executable file
@ -0,0 +1,11 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class UsecaseThree_pl_org {
|
||||
|
||||
Vector foo() {
|
||||
Vector c;
|
||||
c = new Vector();
|
||||
return c;
|
||||
}
|
||||
|
||||
}
|
11
test/plugindevelopment/MartinTestCases/UsecaseTwo_pl.jav
Executable file
11
test/plugindevelopment/MartinTestCases/UsecaseTwo_pl.jav
Executable file
@ -0,0 +1,11 @@
|
||||
class UsecaseTwo_pl<A> {
|
||||
|
||||
foo() {
|
||||
d;
|
||||
d = new UsecaseTwo_pl<A> ();
|
||||
e;
|
||||
e = d.foo();
|
||||
return d;
|
||||
}
|
||||
|
||||
}
|
12
test/plugindevelopment/MartinTestCases/Usecase_MUBTest.jav
Executable file
12
test/plugindevelopment/MartinTestCases/Usecase_MUBTest.jav
Executable file
@ -0,0 +1,12 @@
|
||||
class A<a> { }
|
||||
|
||||
class B<a> extends A<a> {
|
||||
f(Boolean x) {
|
||||
if (x) {
|
||||
return new B<Integer>(); }
|
||||
else {
|
||||
return new A<Integer>(); }
|
||||
}
|
||||
}
|
||||
|
||||
class C<a> extends B<A<a>> {}
|
17
test/plugindevelopment/MartinTestCases/Usecase_MUBTest1.jav
Executable file
17
test/plugindevelopment/MartinTestCases/Usecase_MUBTest1.jav
Executable file
@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
class A<a> { }
|
||||
|
||||
class B<a> extends A<a> {
|
||||
f(Boolean x) {
|
||||
if (x) {
|
||||
return new B<Integer>(); }
|
||||
else {
|
||||
return new A<Integer>(); }
|
||||
}
|
||||
}
|
||||
|
||||
class C<a> extends B<A<a>> {}
|
||||
|
||||
|
||||
|
13
test/plugindevelopment/MartinTestCases/Usecase_MUBTest2.jav
Executable file
13
test/plugindevelopment/MartinTestCases/Usecase_MUBTest2.jav
Executable file
@ -0,0 +1,13 @@
|
||||
class A<a> { }
|
||||
|
||||
class B<a> extends A<a> {
|
||||
f(x) {
|
||||
a;
|
||||
if (x) {
|
||||
return new C<Integer>(); }
|
||||
else {
|
||||
return a; }
|
||||
}
|
||||
}
|
||||
|
||||
class C<a> extends B<A<a>> {}
|
14
test/plugindevelopment/MartinTestCases/Usecase_MUBTest3.jav
Executable file
14
test/plugindevelopment/MartinTestCases/Usecase_MUBTest3.jav
Executable file
@ -0,0 +1,14 @@
|
||||
class A<a> { }
|
||||
|
||||
class B<a> extends A<a> {
|
||||
f(x) {
|
||||
a;
|
||||
b;
|
||||
if (x) {
|
||||
return a; }
|
||||
else {
|
||||
return b; }
|
||||
}
|
||||
}
|
||||
|
||||
class C<a> extends B<A<a>> {}
|
12
test/plugindevelopment/MartinTestCases/Usecase_MUBTest4.jav
Executable file
12
test/plugindevelopment/MartinTestCases/Usecase_MUBTest4.jav
Executable file
@ -0,0 +1,12 @@
|
||||
class A<a> { }
|
||||
|
||||
class B<a> extends A<a> {
|
||||
f(Boolean x) {
|
||||
if (x) {
|
||||
return new B<Integer>(); }
|
||||
else {
|
||||
return new C<Integer>(); }
|
||||
}
|
||||
}
|
||||
|
||||
class C<a> extends B<A<a>> {}
|
12
test/plugindevelopment/MartinTestCases/Usecase_MUBTest5.jav
Executable file
12
test/plugindevelopment/MartinTestCases/Usecase_MUBTest5.jav
Executable file
@ -0,0 +1,12 @@
|
||||
class A<a> { }
|
||||
|
||||
class B<a> extends A<a> {
|
||||
f(Boolean x) {
|
||||
if (x) {
|
||||
return new B<a>(); }
|
||||
else {
|
||||
return new C<Integer>(); }
|
||||
}
|
||||
}
|
||||
|
||||
class C<a> extends B<A<a>> {}
|
9
test/plugindevelopment/MartinTestCases/Usecase_MUBTest6.jav
Executable file
9
test/plugindevelopment/MartinTestCases/Usecase_MUBTest6.jav
Executable file
@ -0,0 +1,9 @@
|
||||
class Test2 {
|
||||
public meth(){
|
||||
if(true) {
|
||||
return(1);
|
||||
}else{
|
||||
return(2);
|
||||
}
|
||||
}
|
||||
}
|
17
test/plugindevelopment/MartinTestCases/ZweiKlassen.jav
Executable file
17
test/plugindevelopment/MartinTestCases/ZweiKlassen.jav
Executable file
@ -0,0 +1,17 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class ZweiKlassen {
|
||||
|
||||
foo() {
|
||||
c;
|
||||
c = new Vector<Integer>() ;
|
||||
return c;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class X {
|
||||
ZweiKlassen bb;
|
||||
|
||||
foo2() { return bb.foo();}
|
||||
}
|
Loading…
Reference in New Issue
Block a user