llvm-6502/bindings/python/llvm/tests/test_core.py
Anders Waldenborg e3295cc5be [python] Add negative MemoryBuffer testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153248 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-22 11:23:52 +00:00

24 lines
702 B
Python

from .base import TestBase
from ..core import OpCode
from ..core import MemoryBuffer
class TestCore(TestBase):
def test_opcode(self):
self.assertTrue(hasattr(OpCode, 'Ret'))
self.assertTrue(isinstance(OpCode.Ret, OpCode))
self.assertEqual(OpCode.Ret.value, 1)
op = OpCode.from_value(1)
self.assertTrue(isinstance(op, OpCode))
self.assertEqual(op, OpCode.Ret)
def test_memory_buffer_create_from_file(self):
source = self.get_test_binary()
MemoryBuffer(filename=source)
def test_memory_buffer_failing(self):
with self.assertRaises(Exception):
MemoryBuffer(filename="/hopefully/this/path/doesnt/exist")