package strucTypes5; import de.dhbwstuttgart.parser.JavaTXParser; import de.dhbwstuttgart.strucTypes5.algo.TypeExpr; import de.dhbwstuttgart.strucTypes5.assumptions.AssumptionAbstract; import de.dhbwstuttgart.strucTypes5.assumptions.AssumptionMakerGlobal; import de.dhbwstuttgart.strucTypes5.assumptions.AssumptionMakerLocal; import de.dhbwstuttgart.strucTypes5.assumptions.AssumptionMap; 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 TypeExprTest { private static final String rootDirectory = System.getProperty("user.dir") + "/test/strucTypes5/"; @Test public void run() { List filenames = new ArrayList(); 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()); List assAll = new ArrayList<>(); assAll.addAll(assumptionMakerLocal.getResultAssumptionList()); assAll.addAll(makerGlobal.getAssumptionAbstractList()); AssumptionMap assumptionMap = new AssumptionMap(); assumptionMap.addAll(assAll); TypeExpr typeExpr = new TypeExpr(assumptionMap , sf.getClasses().get(0).getMethods().get(0) , typeVarStore ); System.out.println(typeExpr.getResultConstraints()); System.out.println(typeExpr.getTypeVarStore()); } } catch (Exception exc) { exc.printStackTrace(); fail(); } assertTrue("Tests durchlaufen", filenames.size() > 0); } }