]> hydra-www.ietfng.org Git - dyna2/commitdiff
added post processors tests.
authorTim Vieira <tim.f.vieira@gmail.com>
Tue, 6 Aug 2013 20:12:56 +0000 (16:12 -0400)
committerTim Vieira <tim.f.vieira@gmail.com>
Tue, 6 Aug 2013 20:12:56 +0000 (16:12 -0400)
.coveragerc
src/Dyna/Backend/Python/debug.py
src/Dyna/Backend/Python/post/__init__.py
src/Dyna/Backend/Python/post/draw_circuit.py
test/repl/post.dynadoc [new file with mode: 0644]

index 26f642086e0f2fac0b4c259d5673c2d5b5750b5c..20c10dceca0e6fd84731a49f8665c536ecbd0caa 100644 (file)
@@ -28,6 +28,3 @@ exclude_lines =
 
 
 ignore_errors = True
-
-[html]
-directory = coverage_html_report
index e095aeefee1e66a7712902ac4810c2d95307dcbc..8f4ffe233c8ee3a79492dc17388e0cf76baf196b 100644 (file)
@@ -4,7 +4,7 @@ Generates a visual representation of a Dyna program's rules after the
 normalization process.
 """
 
-import re, os, shutil, webbrowser
+import re, os, webbrowser
 from collections import defaultdict
 from utils import read_anf, path
 from config import dynahome
@@ -36,9 +36,6 @@ else:
         return pretty, offset
 
 
-cssfile = dynahome / 'src' / 'Dyna' / 'Backend' / 'Python' / 'debug-pygments.css'
-jsfile = dynahome / 'external' / 'prototype-1.6.0.3.js'
-
 class Edge(object):
     def __init__(self, head, label, body):
         self.head = head
@@ -234,17 +231,9 @@ def main(dynafile, browser=True):
 
     dynafile = path(dynafile)
 
-#    if not os.path.exists(cssfile) or not os.path.exists(jsfile):
-#        print 'Debug must be run from the root of the Dyna source tree.'
-#       return
-
     d = dynafile + '.d'
     d.mkdir_p()
 
-    # XXX: this is sort of silly
-    #shutil.copyfile(cssfile, d + '/debug-pygments.css')
-    #shutil.copyfile(jsfile, d + '/prototype.js')
-
     with file(d / 'index.html', 'wb') as html:
 
         print >> html, HEADING
index c6ecaacd32499eec7ee805ac44662e77879c68b2..135c869a45b4c4800cbb7e704ddb1fa2e4717e56 100644 (file)
@@ -1,5 +1,5 @@
 import re
-from utils import get_module
+from utils import get_module, true, false, null
 
 available = 'trace', 'dump_solution', 'draw_circuit', 'graph', 'save', 'draw'
 
index 71b8e8231febcad7288e09d314e8a363ce3d6890..a704ce06a0c6c92538b354239ea3981df0eef125 100644 (file)
@@ -116,14 +116,14 @@ class draw_circuit(object):
                 if cls == 'edge':
                     # split on arrow ->
                     u, v = x.split('&#45;&gt;')
-                    print 'edge:', i, u, v
+#                    print 'edge:', i, u, v
                 else:
                     if x in E:
-                        print 'crux', i, x,
+#                        print 'crux', i, x,
                         rule = interp.rules[int(E[x].label)]
                         x = '%s   %% rule %s' % (rule.src, rule.index)
-                    else:
-                        print 'node:', i, x
+#                    else:
+#                        print 'node:', i, x
 
                 return '<g id="%s" class="%s"><title>%s</title>%s</g>' % (i, cls, x, q)
 
diff --git a/test/repl/post.dynadoc b/test/repl/post.dynadoc
new file mode 100644 (file)
index 0000000..14c7335
--- /dev/null
@@ -0,0 +1,20 @@
+> a :- b.
+| b :- c.
+| b :- d.
+| c.
+
+Changes
+=======
+a = true.
+b = true.
+c = true.
+
+> post draw_circuit("circuit.html", open=false)
+
+> post dump_solution()
+
+Solution
+========
+a.
+b.
+c.