Some more tests
This commit is contained in:
parent
9392afc74c
commit
a24320099c
12
run_tests.py
12
run_tests.py
|
@ -4,7 +4,9 @@ import unittest, subprocess, filecmp, argparse, os.path, os, shutil
|
|||
REFERENCE_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "tests")
|
||||
|
||||
REGEXES_DATA = [ #TODO
|
||||
[r"[a-zA-Z0-9]*"]
|
||||
[r"[a-zA-Z0-9]*"],
|
||||
[r"a", r"a|b"],
|
||||
[r"a|b", r"a"],
|
||||
]
|
||||
|
||||
def make_test(regexes, idx):
|
||||
|
@ -13,10 +15,10 @@ def make_test(regexes, idx):
|
|||
p.communicate(bytes("\n".join(regexes), "utf-8"))
|
||||
self.assertEqual(0, p.returncode)
|
||||
|
||||
self.assertTrue(filecmp.cmp(os.path.join(REFERENCE_DIR, "test_%s.re" % idx), os.path.join(data_dir, "test_%s.re" % idx)))
|
||||
self.assertTrue(filecmp.cmp(os.path.join(REFERENCE_DIR, "test_%s.enfa" % idx), os.path.join(data_dir, "test_%s.enfa" % idx)))
|
||||
self.assertTrue(filecmp.cmp(os.path.join(REFERENCE_DIR, "test_%s.mssc" % idx), os.path.join(data_dir, "test_%s.mssc" % idx)))
|
||||
self.assertTrue(filecmp.cmp(os.path.join(REFERENCE_DIR, "test_%s.min" % idx), os.path.join(data_dir, "test_%s.min" % idx)))
|
||||
self.assertTrue(filecmp.cmp(os.path.join(REFERENCE_DIR, "test_%s.re" % idx), os.path.join(data_dir, "test_%s.re" % idx)), "The regex for testcase %s is incorrect" % idx)
|
||||
self.assertTrue(filecmp.cmp(os.path.join(REFERENCE_DIR, "test_%s.enfa" % idx), os.path.join(data_dir, "test_%s.enfa" % idx)), "The eNFA for testcase %s is incorrect" % idx)
|
||||
self.assertTrue(filecmp.cmp(os.path.join(REFERENCE_DIR, "test_%s.mssc" % idx), os.path.join(data_dir, "test_%s.mssc" % idx)), "The mssc'd DFA for testcase %s is incorrect" % idx)
|
||||
self.assertTrue(filecmp.cmp(os.path.join(REFERENCE_DIR, "test_%s.min" % idx), os.path.join(data_dir, "test_%s.min" % idx)), "The minimized DFA for testcase %s is incorrect" % idx)
|
||||
|
||||
return test
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
digraph {
|
||||
rankdir=LR
|
||||
in [shape=point style=invis]
|
||||
0 [label="0" color=yellow]
|
||||
0 [color=yellow label="0"]
|
||||
1 [label="1"]
|
||||
2 [label="2"]
|
||||
3 [label="3"]
|
||||
4 [label="4" color=green shape=doublecircle]
|
||||
4 [color=green shape=doublecircle label="4\np=0\nac=0"]
|
||||
2 -> 3 [label="0"]
|
||||
2 -> 3 [label="1"]
|
||||
2 -> 3 [label="2"]
|
||||
|
|
BIN
tests/test_0.min
BIN
tests/test_0.min
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,24 @@
|
|||
digraph {
|
||||
rankdir=LR
|
||||
in [shape=point style=invis]
|
||||
0 [color=yellow label="0"]
|
||||
1 [label="1"]
|
||||
2 [color=green shape=doublecircle label="2\np=0\nac=0"]
|
||||
3 [label="3"]
|
||||
4 [label="4"]
|
||||
5 [label="5"]
|
||||
6 [label="6"]
|
||||
7 [label="7"]
|
||||
8 [color=green shape=doublecircle label="8\np=1\nac=1"]
|
||||
1 -> 2 [label="a"]
|
||||
4 -> 5 [label="a"]
|
||||
6 -> 7 [label="b"]
|
||||
0 -> 1 [label="ε"]
|
||||
0 -> 3 [label="ε"]
|
||||
3 -> 4 [label="ε"]
|
||||
3 -> 6 [label="ε"]
|
||||
5 -> 8 [label="ε"]
|
||||
7 -> 8 [label="ε"]
|
||||
in -> 0
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
a
|
||||
(a|b)
|
|
@ -0,0 +1,24 @@
|
|||
digraph {
|
||||
rankdir=LR
|
||||
in [shape=point style=invis]
|
||||
0 [color=yellow label="0"]
|
||||
1 [label="1"]
|
||||
2 [label="2"]
|
||||
3 [label="3"]
|
||||
4 [label="4"]
|
||||
5 [label="5"]
|
||||
6 [color=green shape=doublecircle label="6\np=0\nac=0"]
|
||||
7 [label="7"]
|
||||
8 [color=green shape=doublecircle label="8\np=1\nac=1"]
|
||||
2 -> 3 [label="a"]
|
||||
4 -> 5 [label="b"]
|
||||
7 -> 8 [label="a"]
|
||||
0 -> 1 [label="ε"]
|
||||
0 -> 7 [label="ε"]
|
||||
1 -> 2 [label="ε"]
|
||||
1 -> 4 [label="ε"]
|
||||
3 -> 6 [label="ε"]
|
||||
5 -> 6 [label="ε"]
|
||||
in -> 0
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
(a|b)
|
||||
a
|
Loading…
Reference in New Issue