2014-03-12 17:28:30 +00:00
|
|
|
package bytecode;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.Vector;
|
|
|
|
|
|
|
|
import junit.framework.TestCase;
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
import sun.misc.IOUtils;
|
|
|
|
import mycompiler.mybytecode.ClassFile;
|
|
|
|
|
|
|
|
public class GeneralTest extends TestCase{
|
|
|
|
@Test
|
|
|
|
public void test(){
|
|
|
|
Vector<ClassFile> cfs = null;
|
|
|
|
try {
|
|
|
|
cfs = BytecodeTester.readFileAndTestCodegen("FieldTest.jav");
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
fail();
|
|
|
|
}
|
|
|
|
assertTrue("Es darf nur eine ClassFile erstellt werden", cfs.size()==1);
|
|
|
|
try {
|
2014-03-13 00:21:02 +00:00
|
|
|
FileOutputStream output = new FileOutputStream(new File(BytecodeTester.rootDirectory+"FieldTest.class"));
|
2014-03-12 17:28:30 +00:00
|
|
|
output.write(cfs.firstElement().getBytecode());
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
fail();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|