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

test: Add test for is_canonical

parent 4b9069b3
from lib.parsing.parser import Parser
def is_can(dfa: str) -> bool:
parser = Parser()
return parser.str_to_dfa(dfa).is_canonical()
def test_can() -> None:
assert is_can("init=1 (1,a)=1 (1,b)=2 (2,b)=1 (2,a)=1 final={2}")
assert is_can("init=1 (1,b)=3 (1,a)=2 (2,b)=1 (2,a)=1 (3,a)=2 (3,b)=2 final={2}")
assert not is_can("init=1 (1,b)=3 (1,c)=2 (2,b)=1 (2,a)=1 (3,a)=2 (3,b)=2 final={2}")
assert not is_can("init=1 (1,a)=1 (1,b)=2 (2,b)=1 (2,b)=1 (unreach,a)=1 (unreach,b)=unreach final={2}")
Supports Markdown
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