forked from JavaTX/JavaCompilerCore
3bb14b82a0
Mit dem aktuellen Commit kann eine Klasse mit Typvariablen versehen werden die auf den TypPlaceholdern des Syntaxbaumes Basieren.
64 lines
1.9 KiB
Java
64 lines
1.9 KiB
Java
package strucTypes5;
|
|
|
|
import de.dhbwstuttgart.parser.JavaTXParser;
|
|
import de.dhbwstuttgart.strucTypes5.assumptions.AssumptionMakerGlobal;
|
|
import de.dhbwstuttgart.strucTypes5.assumptions.AssumptionMakerLocal;
|
|
import de.dhbwstuttgart.strucTypes5.typeVars.TypeVarStore;
|
|
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
|
import org.junit.Test;
|
|
|
|
import java.io.File;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import static org.junit.Assert.assertTrue;
|
|
import static org.junit.Assert.fail;
|
|
|
|
/**
|
|
* Dieser Test pr�ft nur, ob .java-Dateien fehlerfrei geparst werden. Der
|
|
* dabei erstellte Syntaxbaum wird nicht kontrolliert.
|
|
*
|
|
* @author janulrich
|
|
*
|
|
*/
|
|
public class AssumptionTest {
|
|
private static final String rootDirectory = System.getProperty("user.dir") + "/test/strucTypes5/";
|
|
|
|
@Test
|
|
public void run() {
|
|
|
|
|
|
List<String> filenames = new ArrayList<String>();
|
|
filenames.add("AssumptionTest.jav");
|
|
|
|
JavaTXParser parser = new JavaTXParser();
|
|
try {
|
|
for (String filename : filenames) {
|
|
|
|
System.out.println("Teste: " + filename);
|
|
|
|
SourceFile sf = parser.parse(new File(rootDirectory + filename));
|
|
|
|
|
|
// Test of the Global Assumption Maker who make mass und fass;
|
|
TypeVarStore typeVarStore = new TypeVarStore();
|
|
AssumptionMakerGlobal makerGlobal = new AssumptionMakerGlobal(sf.getClasses().get(0), typeVarStore );
|
|
System.out.println(typeVarStore.toString());
|
|
System.out.println(makerGlobal.getAssumptionAbstractList().toString()) ;
|
|
|
|
|
|
// Test of the Local AssumptionMaker who only makes the Assumption for an Local Method;
|
|
AssumptionMakerLocal assumptionMakerLocal = new AssumptionMakerLocal(sf.getClasses().get(0).getMethods().get(0) , typeVarStore);
|
|
System.out.println(assumptionMakerLocal.getResultAssumptionList());
|
|
|
|
|
|
}
|
|
|
|
} catch (Exception exc) {
|
|
exc.printStackTrace();
|
|
fail();
|
|
}
|
|
assertTrue("Tests durchlaufen", filenames.size() > 0);
|
|
}
|
|
}
|