diff --git a/llvm/test_llvmpy.py b/llvm/test_llvmpy.py index 6011a70..7a9c3b6 100644 --- a/llvm/test_llvmpy.py +++ b/llvm/test_llvmpy.py @@ -185,6 +185,22 @@ tests.append(TestAtomic) # --------------------------------------------------------------------------- +class TestConstExpr(unittest.TestCase): + + def test_constexpr_opcode(self): + mod = Module.new('test_constexpr_opcode') + func = mod.add_function(Type.function(Type.void(), []), name="foo") + builder = Builder.new(func.append_basic_block('entry')) + a = builder.inttoptr(Constant.int(Type.int(), 123), + Type.pointer(Type.int())) + self.assertTrue(isinstance(a, lc.ConstantExpr)) + self.assertEqual(a.opcode, lc.OPCODE_INTTOPTR) + self.assertEqual(a.opcode_name, "inttoptr") + +tests.append(TestConstExpr) + +# --------------------------------------------------------------------------- + class TestOperands(unittest.TestCase): # implement a test function test_module = """ diff --git a/test/constexpr.py b/test/constexpr.py deleted file mode 100644 index a1beccd..0000000 --- a/test/constexpr.py +++ /dev/null @@ -1,17 +0,0 @@ -import unittest -from llvm.core import * - -class TestConstExpr(unittest.TestCase): - def test_constexpr_opcode(self): - mod = Module.new('test_constexpr_opcode') - func = mod.add_function(Type.function(Type.void(), []), name="foo") - builder = Builder.new(func.append_basic_block('entry')) - a = builder.inttoptr(Constant.int(Type.int(), 123), - Type.pointer(Type.int())) - self.assertTrue(isinstance(a, ConstantExpr)) - self.assertEqual(a.opcode, OPCODE_INTTOPTR) - self.assertEqual(a.opcode_name, "inttoptr") - -if __name__ == '__main__': - unittest.main() -