Unify Test
This commit is contained in:
parent
fcac7fb04f
commit
19d0198d2a
16
test/unify/UnifyFilter.jav
Normal file
16
test/unify/UnifyFilter.jav
Normal file
@ -0,0 +1,16 @@
|
||||
class Test{
|
||||
void methode(){
|
||||
var;
|
||||
var.methode();
|
||||
var.methode();
|
||||
}
|
||||
}
|
||||
|
||||
class Klasse1 {
|
||||
void methode(){
|
||||
}
|
||||
}
|
||||
class Klasse2 {
|
||||
void methode(){
|
||||
}
|
||||
}
|
7058
test/unify/UnifyFilter.jav.log
Normal file
7058
test/unify/UnifyFilter.jav.log
Normal file
File diff suppressed because one or more lines are too long
54
test/unify/UnifyFilter.java
Normal file
54
test/unify/UnifyFilter.java
Normal file
@ -0,0 +1,54 @@
|
||||
package unify;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import de.dhbwstuttgart.core.MyCompiler;
|
||||
import de.dhbwstuttgart.core.MyCompilerAPI;
|
||||
import de.dhbwstuttgart.logger.Logger;
|
||||
import de.dhbwstuttgart.logger.LoggerConfiguration;
|
||||
import de.dhbwstuttgart.logger.Section;
|
||||
import de.dhbwstuttgart.parser.JavaParser.yyException;
|
||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||
import de.dhbwstuttgart.typeinference.Menge;
|
||||
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
|
||||
|
||||
public class UnifyFilter {
|
||||
public final static String rootDirectory = System.getProperty("user.dir")+"/test/unify/";
|
||||
|
||||
private final String testFile = "UnifyFilter.jav";
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
MyCompilerAPI compiler = MyCompiler.getAPI(new LoggerConfiguration().setOutput(Section.UNIFY, System.out));
|
||||
try {
|
||||
compiler.parse(new File(this.rootDirectory+testFile));
|
||||
Menge<TypeinferenceResultSet> ergebnis = compiler.typeReconstruction();
|
||||
//Nichts weiter unternehmen. Nur die Ausgabe des Unifikationsalgorithmus anzeigen.
|
||||
String log = Logger.getWholeLog();
|
||||
//System.out.println(log);
|
||||
writeLogFile(log);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeLogFile(String log){
|
||||
try {
|
||||
PrintWriter writer = new PrintWriter(rootDirectory+testFile+".log", "UTF-8");
|
||||
writer.write(log);
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user