Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fja
eval
Commits
44bd0954
Commit
44bd0954
authored
Jun 09, 2021
by
Vladimír Štill
Browse files
test: Adapt to changes in lib
parent
2b2f6935
Pipeline
#95123
passed with stage
in 1 minute and 28 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test_cfl_cfg.py
View file @
44bd0954
from
lib.common
import
Nonterminal
,
Terminal
,
Eps
from
lib.parsing
import
P
arser
import
lib.p
arser
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
(
""
)
...
...
test_reg.py
View file @
44bd0954
from
lib.parsing
import
P
arser
import
lib.p
arser
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}"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment