|
@@ -141,10 +141,23 @@ class TestRpnCompile(unittest.TestCase):
|
141
|
141
|
|
142
|
142
|
def test_long_code(self):
|
143
|
143
|
""" Compile long expressions """
|
144
|
|
- for i in range(64,256,2):
|
145
|
|
- for j in range(256,4):
|
146
|
|
- exprs = ' '.join(['+' for _ in range(i)])
|
147
|
|
- expr = pyrpn.RPNExpr(exprs, j)
|
|
144
|
+ for i in range(0x100,0x10000,0x500):
|
|
145
|
+ with self.subTest('Testing expression with %X ops' % i):
|
|
146
|
+ for argc in range(1,32, 8):
|
|
147
|
+ args = [random.randint(0,IMAX) for _ in range(argc)]
|
|
148
|
+ expr = pyrpn.RPNExpr(pyrpn.random_expr(argc, i), argc)
|
|
149
|
+ del(expr)
|
|
150
|
+
|
|
151
|
+ def test_very_long(self):
|
|
152
|
+ """ Compile a very long expression """
|
|
153
|
+ argc = 4
|
|
154
|
+ codelen = 0x500000
|
|
155
|
+ import time
|
|
156
|
+ for i in range(3):
|
|
157
|
+ args = [random.randint(0,IMAX) for _ in range(argc)]
|
|
158
|
+ expr_str = pyrpn.random_expr(argc, codelen)
|
|
159
|
+ expr = pyrpn.RPNExpr(expr_str, argc)
|
|
160
|
+ del(expr)
|
148
|
161
|
|
149
|
162
|
def test_pickling(self):
|
150
|
163
|
""" Pickle & unpickle tests """
|