Exemplo n.º 1
0
    def _trataCarregar(self, lista):
        try:
            if lista.isEmpty():
                return

            gr = util.carregar(lista.takeLast())
            self.setarGR(gr)

        except Exception as excecao:
            self.mostrarErro(str(excecao))
Exemplo n.º 2
0
 def testPodeSalvarECarregarUmAutomatoFinitoDoDisco(self):
   afd1 = construirAFDComABOndeBsEhImpar()
   util.salvar(afd1, os.path.join(os.getcwd(), 'teste.af'))
   afd2 = util.carregar(os.path.join(os.getcwd(), 'teste.af'))
   self.assertTrue(util.sao_equivalentes_af(afd1, afd2))
Exemplo n.º 3
0
 def testPodeSalvarECarregarUmaGramaticaRegularDoDisco(self):
   gr1 = util.obter_gramatica_regular(construirAFDComABOndeBsEhImpar())
   util.salvar(gr1, os.path.join(os.getcwd(), 'teste.gr'))
   gr2 = util.carregar(os.path.join(os.getcwd(), 'teste.gr'))
   self.assertTrue(util.sao_equivalentes_af(util.obter_afd(gr1), util.obter_afd(gr2)))
Exemplo n.º 4
0
 def testPodeSalvarECarregarUmaExpressaoRegularDoDisco(self):
   exp = ExpressaoRegular('a*b?.(ab)')
   util.salvar(exp, os.path.join(os.getcwd(), 'teste.exp'))
   exp2 = util.carregar(os.path.join(os.getcwd(), 'teste.exp'))
   self.assertTrue(util.sao_equivalentes_af(exp.obterAFD(), exp2.obterAFD()))