Beispiel #1
0
 def test_matrix_method(self):
     for graph in glob.glob("./data/*"):
         for grammar in glob.glob("./grammars/homsky/*"):
             res = count_res(matrix_method(grammar, graph, test=True))
             print(os.path.basename(graph), os.path.basename(grammar), res)
             self.assertEqual(
                 res, answers_homsky[(os.path.basename(graph),
                                      os.path.basename(grammar))])
Beispiel #2
0
 def test_gll_method(self):
     for graph in glob.glob("./data/*"):
         for grammar in glob.glob("./grammars/automata/*"):
             res = count_res(gll_method(grammar, graph, test=True))
             print(os.path.basename(graph), os.path.basename(grammar), res)
             self.assertEqual(
                 res, answers_automata[(os.path.basename(graph),
                                        os.path.basename(grammar))])
Beispiel #3
0
 def test_matrix_method_method_my(self):
     graph_path = "./myTests/data/"
     grammar_path = "./myTests/grammars/homsky/"
     tests = [
         "small1", "small2", "small3", "ab", "a-loop", "epsilon",
         "expressions", "wwr"
     ]
     for test in tests:
         grammar = grammar_path + test
         graph = graph_path + test + ".dot"
         res = count_res(matrix_method(grammar, graph, test=True))
         print(os.path.basename(graph), os.path.basename(grammar), res)
         self.assertEqual(
             res, answers_homsky[(os.path.basename(graph),
                                  os.path.basename(grammar))])