From 1bf21427852e2d610389e5c103e6f8207e54e790 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 9 Sep 2014 11:05:48 +0800 Subject: [PATCH] test/py2llvm: do all operations in test classes --- test/py2llvm.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/test/py2llvm.py b/test/py2llvm.py index c68ef7c24..c619fd364 100644 --- a/test/py2llvm.py +++ b/test/py2llvm.py @@ -99,28 +99,26 @@ def arith_encode(op, a, b, c, d): return f.numerator*1000 + f.denominator -is_prime_c = CompiledFunction(is_prime, {"x": base_types.VInt()}) -simplify_encode_c = CompiledFunction( - simplify_encode, {"a": base_types.VInt(), "b": base_types.VInt()}) -arith_encode_c = CompiledFunction( - arith_encode, { - "op": base_types.VInt(), - "a": base_types.VInt(), "b": base_types.VInt(), - "c": base_types.VInt(), "d": base_types.VInt()}) - - class CodeGenCase(unittest.TestCase): def test_is_prime(self): + is_prime_c = CompiledFunction(is_prime, {"x": base_types.VInt()}) for i in range(200): self.assertEqual(is_prime_c(i), is_prime(i)) def test_frac_simplify(self): + simplify_encode_c = CompiledFunction( + simplify_encode, {"a": base_types.VInt(), "b": base_types.VInt()}) for a in range(5, 20): for b in range(5, 20): self.assertEqual( simplify_encode_c(a, b), simplify_encode(a, b)) def _test_frac_arith(self, op): + arith_encode_c = CompiledFunction( + arith_encode, { + "op": base_types.VInt(), + "a": base_types.VInt(), "b": base_types.VInt(), + "c": base_types.VInt(), "d": base_types.VInt()}) for a in range(5, 10): for b in range(5, 10): for c in range(5, 10):