Commit 44bd0954 authored by Vladimír Štill's avatar Vladimír Štill
Browse files

test: Adapt to changes in lib

parent 2b2f6935
Pipeline #95123 passed with stage
in 1 minute and 28 seconds
from lib.common import Nonterminal, Terminal, Eps
from lib.parsing import Parser
import lib.parser
import lib.cfl as cfl
from copy import deepcopy
......@@ -149,12 +149,11 @@ def test_equal():
def test_parser():
parser = Parser()
pg0 = parser.str_to_cfg("S -> aA | ε | aBC | <foo>C; "
"A -> a; "
"B -> b; "
"C -> c\n"
"<foo> -> aaa")
pg0 = lib.parser.cfg("S -> aA | ε | aBC | <foo>C; "
"A -> a; "
"B -> b; "
"C -> c\n"
"<foo> -> aaa")
assert pg0.terminals == {a, b, c}
assert pg0.nonterminals == {S, A, B, C, Nonterminal("<foo>")}
assert pg0.generates("")
......
from lib.parsing import Parser
import lib.parser
from lib.dfa import DFA
def is_can(dfa: str) -> bool:
parser = Parser()
return parse(dfa).is_canonical()
def parse(dfa: str) -> DFA:
parser = Parser()
return parser.str_to_dfa(dfa)
return lib.parser.dfa(dfa)
def to_str(dfa: DFA) -> str:
parser = Parser()
return parser.dfa_to_str(dfa)
return lib.parser.dfa_to_str(dfa)
def test_can() -> None:
ex1 = "init=1 (1,a)=1 (1,b)=2 (2,b)=1 (2,a)=1 final={2}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment