GeneralParserTest eingefügt
This commit is contained in:
parent
d9cc613600
commit
dd5c8a56ad
@ -7,5 +7,8 @@
|
|||||||
<classpathentry kind="lib" path="lib/guava-10.0.1.jar"/>
|
<classpathentry kind="lib" path="lib/guava-10.0.1.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||||
<classpathentry kind="lib" path="lib/antlr-complete.jar"/>
|
<classpathentry kind="lib" path="lib/antlr-complete.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/reflections-0.9.10-javadoc.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/reflections-0.9.10-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/reflections-0.9.10.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
58
test/strucTypes/GeneralParserTest.java
Normal file
58
test/strucTypes/GeneralParserTest.java
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package strucTypes;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.parser.JavaTXParser;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dieser Test pr�ft nur, ob .java-Dateien fehlerfrei geparst werden.
|
||||||
|
* Der dabei erstellte Syntaxbaum wird nicht kontrolliert.
|
||||||
|
* @author janulrich
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GeneralParserTest{
|
||||||
|
private static final String rootDirectory = System.getProperty("user.dir")+"/test/strucTypes/";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void run(){
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Auflistung aller Files die getestet werden sollen
|
||||||
|
*/
|
||||||
|
List<String> filenames = new ArrayList<String>();
|
||||||
|
//filenames.add("FieldInitializationTest.jav");
|
||||||
|
//filenames.add("ImportTest.jav");
|
||||||
|
//filenames.add("StatementsTest.jav");
|
||||||
|
//filenames.add("ImportTestGeneric.jav");
|
||||||
|
//filenames.add("BoundedParameter.jav");
|
||||||
|
//filenames.add("GenericFieldVarTest.jav");
|
||||||
|
//filenames.add("FieldVarTest.jav");
|
||||||
|
filenames.add("StructuralTypesSimple.jav");
|
||||||
|
JavaTXParser parser = new JavaTXParser();
|
||||||
|
try{
|
||||||
|
for(String filename : filenames) {
|
||||||
|
System.out.println("Teste: "+filename);
|
||||||
|
SourceFile sf = parser.parse(new File(rootDirectory + filename));
|
||||||
|
|
||||||
|
//sf.TypeAlgo();
|
||||||
|
|
||||||
|
//SourceFile sfdebug = sf;
|
||||||
|
|
||||||
|
//TODO: Test ANTLR Parser
|
||||||
|
}
|
||||||
|
}catch(Exception exc){
|
||||||
|
exc.printStackTrace();
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
assertTrue("Tests durchlaufen",filenames.size()>0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
10
test/strucTypes/StructuralTypes.jav
Normal file
10
test/strucTypes/StructuralTypes.jav
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
class A {
|
||||||
|
|
||||||
|
|
||||||
|
mt(x, y, z) { return x.sub(y).add(z); }
|
||||||
|
|
||||||
|
mt2( a, b) {return null; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
16
test/strucTypes/StructuralTypesSimple.jav
Normal file
16
test/strucTypes/StructuralTypesSimple.jav
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
class A {
|
||||||
|
|
||||||
|
|
||||||
|
mt4(a,b,c) { return a.add(b).sub(c) ; }
|
||||||
|
|
||||||
|
mt1(a) {return a; }
|
||||||
|
|
||||||
|
mt2(a) {return a.f; }
|
||||||
|
|
||||||
|
mt3(a) {return a.add(); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user