Procházet zdrojové kódy

Added unit tests and script to view profiler stats.

Sander Mathijs van Veen před 14 roky
rodič
revize
07dc9e8d1f
4 změnil soubory, kde provedl 26 přidání a 2 odebrání
  1. 1 1
      external/graph_drawing
  2. 1 1
      external/pybison
  3. 11 0
      tests/test_calc.py
  4. 13 0
      utils/view_profile.py

+ 1 - 1
external/graph_drawing

@@ -1 +1 @@
-Subproject commit a34e48940a4eab2d44db8bdc61ff56648e2e087e
+Subproject commit 4d65a52b8ba0f0ad1843cb5535a485ff372317a3

+ 1 - 1
external/pybison

@@ -1 +1 @@
-Subproject commit 1bd7873dfad2fabac51fab8ed978374502f09034
+Subproject commit 2ae8c15dba13faba38e1a3d1a711cf6d24395a5a

+ 11 - 0
tests/test_calc.py

@@ -53,6 +53,17 @@ class TestCalc(unittest.TestCase):
                        ('ab(c)d',   N('*', L('a'), L('b'), L('c'), L('d'))),
                        #('ab(c)d',   N('*', L('a'), N('*', L('b'),
                        #                              N('*', L('c'), L('d'))))),
+                       ('ab*(c)*d',   N('*', L('a'), L('b'), L('c'), L('d'))),
+                       ('ab*(c)^d',   N('*', L('a'), L('b'),
+                                        N('^', L('c'), L('d')))),
+                      ]
+
+        run_expressions(Parser, expressions)
+
+    def test_pow_nested(self):
+        # a^b^c = a^(b^c) != (a^b)^c
+        expressions = [
+                       ('a^b^c', N('^', L('a'), N('^', L('b'), L('c')))),
                       ]
 
         run_expressions(Parser, expressions)

+ 13 - 0
utils/view_profile.py

@@ -0,0 +1,13 @@
+#!/usr/bin/python
+import sys
+from pstats import Stats
+
+s = Stats(sys.argv[1])
+
+for profile in sys.argv[2:]:
+    s.add(profile)
+
+s.sort_stats('cumulative')
+
+s.print_stats()
+