00001 package plp.orientadaObjetos1.testes;
00002
00003 import java.io.FileInputStream;
00004 import java.io.InputStream;
00005
00006 import junit.framework.TestCase;
00007 import plp.orientadaObjetos1.Programa;
00008 import plp.orientadaObjetos1.memoria.ContextoCompilacao;
00009 import plp.orientadaObjetos1.memoria.ContextoExecucao;
00010 import plp.orientadaObjetos1.memoria.colecao.ListaValor;
00011
00012 public class TesteGenerics extends TestCase {
00013
00014
00015 public void testDefGenerics() throws Exception {
00016 this.utilTesteTxt("src/plp/orientadaObjetos1/testes/DefGenerics.txt");
00017 }
00018
00019 public void testIntanciaGenerics() throws Exception {
00020 this.utilTesteTxt("src/plp/orientadaObjetos1/testes/InstanciaGenerics.txt");
00021 }
00022
00023 public void testMetodoGenerics() throws Exception {
00024 this.utilTesteTxt("src/plp/orientadaObjetos1/testes/ProcGenerics.txt");
00025 }
00026
00027 public void testListaGenerics() throws Exception {
00028 this.utilTesteTxt("src/plp/orientadaObjetos1/testes/ListaGenerics.txt");
00029 }
00030
00031 public void utilTesteTxt(String fileName) throws Exception {
00032 InputStream file = new FileInputStream(fileName);
00033 AllTests.parser.ReInit(file, null);
00034 Programa p = AllTests.parser.processaEntrada();
00035
00036
00037 ListaValor input = new ListaValor();
00038 ContextoCompilacao cc = new ContextoCompilacao( input);
00039 boolean tipoOk = p.checaTipo( cc);
00040
00041
00042 if (tipoOk) {
00043
00044 ContextoExecucao ce = new ContextoExecucao();
00045 ListaValor output = p.executar( ce);
00046 }
00047 else {
00048 fail();
00049 }
00050 }
00051
00052
00053
00054
00055 }