2012-03-10 04:41:24 +00:00
|
|
|
from .base import TestBase
|
2012-03-10 05:50:56 +00:00
|
|
|
from ..core import OpCode
|
|
|
|
from ..core import MemoryBuffer
|
2012-03-10 04:41:24 +00:00
|
|
|
|
|
|
|
class TestCore(TestBase):
|
2012-03-10 05:50:56 +00:00
|
|
|
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)
|
|
|
|
|
2012-03-10 04:41:24 +00:00
|
|
|
def test_memory_buffer_create_from_file(self):
|
|
|
|
source = self.get_test_binary()
|
|
|
|
|
|
|
|
MemoryBuffer(filename=source)
|