2014-03-17 19:05:12 +00:00
|
|
|
package parser;
|
|
|
|
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
import java.nio.file.Files;
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
|
2015-05-12 17:49:27 +00:00
|
|
|
import de.dhbwstuttgart.logger.LoggerConfiguration;
|
|
|
|
import de.dhbwstuttgart.logger.Section;
|
|
|
|
import de.dhbwstuttgart.typeinference.Menge;
|
2014-03-17 19:05:12 +00:00
|
|
|
import junit.framework.TestCase;
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
2014-09-02 08:33:54 +00:00
|
|
|
import de.dhbwstuttgart.core.MyCompiler;
|
|
|
|
import de.dhbwstuttgart.core.MyCompilerAPI;
|
|
|
|
|
2014-03-17 19:05:12 +00:00
|
|
|
/**
|
2015-05-12 17:49:27 +00:00
|
|
|
* Dieser Test pr�ft nur, ob .java-Dateien fehlerfrei geparst werden.
|
2014-03-17 19:05:12 +00:00
|
|
|
* Der dabei erstellte Syntaxbaum wird nicht kontrolliert.
|
|
|
|
* @author janulrich
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class GeneralParserTest{
|
|
|
|
private static final String rootDirectory = System.getProperty("user.dir")+"/test/parser/";
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void run(){
|
2015-05-12 17:49:27 +00:00
|
|
|
|
|
|
|
LoggerConfiguration config = new LoggerConfiguration();
|
|
|
|
config.setOutput(Section.PARSER, System.out);
|
|
|
|
|
2015-04-22 19:40:22 +00:00
|
|
|
Menge<String> filenames = new Menge<String>();
|
2014-04-23 10:05:57 +00:00
|
|
|
filenames.add("FieldInitializationTest.jav");
|
2014-07-09 13:07:40 +00:00
|
|
|
filenames.add("ImportTest.jav");
|
|
|
|
filenames.add("BoundedParameter.jav");
|
2014-06-18 07:06:08 +00:00
|
|
|
filenames.add("GenericFieldVarTest.jav");
|
2014-09-18 14:26:02 +00:00
|
|
|
filenames.add("FieldVarTest.jav");
|
2015-05-12 17:49:27 +00:00
|
|
|
MyCompilerAPI compiler = MyCompiler.getAPI(config);
|
2014-03-17 19:05:12 +00:00
|
|
|
try{
|
|
|
|
for(String filename : filenames)
|
|
|
|
compiler.parse(new File(rootDirectory + filename));
|
|
|
|
}catch(Exception exc){
|
|
|
|
exc.printStackTrace();
|
|
|
|
fail();
|
|
|
|
}
|
|
|
|
assertTrue("Tests durchlaufen",filenames.size()>0);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|