Author: Raffael Tfirst <raffael.tfi...@gmail.com>
Branch: py3.5
Changeset: r84597:ac30234331fd
Date: 2016-05-22 22:17 +0200
http://bitbucket.org/pypy/pypy/changeset/ac30234331fd/

Log:    Add gendfa test

diff --git a/dfa_generated.py b/dfa_generated.py
deleted file mode 100644
diff --git a/pypy/interpreter/pyparser/test/test_gendfa.py 
b/pypy/interpreter/pyparser/test/test_gendfa.py
new file mode 100644
--- /dev/null
+++ b/pypy/interpreter/pyparser/test/test_gendfa.py
@@ -0,0 +1,16 @@
+from pypy.interpreter.pyparser.automata import DFA, DEFAULT
+from pypy.interpreter.pyparser.gendfa import output
+
+def test_states():
+    states = [{"\x00": 1}, {"\x01": 0}]
+    d = DFA(states[:], [False, True])
+    assert output('test', DFA, d, states) == """\
+accepts = [False, True]
+states = [
+    # 0
+    {'\\x00': 1},
+    # 1
+    {'\\x01': 0},
+    ]
+test = automata.pypy.interpreter.pyparser.automata.DFA(states, accepts)
+"""
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to