Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_build_immediate(self):
"""Check symbolic immediate has correct size and evaluation."""
node = self.Triton.getImmediateAst(Immediate(0x10, CPUSIZE.BYTE))
self.assertEqual(node.evaluate(), 0x10)
self.assertEqual(node.getBitvectorSize(), CPUSIZE.BYTE_BIT)
def test_value(self):
"""Check immediate value with different size."""
self.imm = Immediate(-4, CPUSIZE.BYTE)
self.assertEqual(self.imm.getValue(), 0xfc)
self.imm = Immediate(-4, CPUSIZE.WORD)
self.assertEqual(self.imm.getValue(), 0xfffc)
self.imm = Immediate(-4, CPUSIZE.DWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffc)
self.imm = Immediate(-4, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffffffffffc)
self.imm = Immediate(0x7123456789abcdef, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0x7123456789abcdef)
self.imm = Immediate(0x8123456789abcdef, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0x8123456789abcdef)
def test_value(self):
"""Check immediate value with different size."""
self.imm = Immediate(-4, CPUSIZE.BYTE)
self.assertEqual(self.imm.getValue(), 0xfc)
self.imm = Immediate(-4, CPUSIZE.WORD)
self.assertEqual(self.imm.getValue(), 0xfffc)
self.imm = Immediate(-4, CPUSIZE.DWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffc)
self.imm = Immediate(-4, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffffffffffc)
self.imm = Immediate(0x7123456789abcdef, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0x7123456789abcdef)
self.imm = Immediate(0x8123456789abcdef, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0x8123456789abcdef)
def test_value(self):
"""Check immediate value with different size."""
self.assertEqual(self.imm.getValue(), 0x1234)
self.imm = Immediate(-4, CPUSIZE.BYTE)
self.assertEqual(self.imm.getValue(), 0xfc)
self.imm = Immediate(-4, CPUSIZE.WORD)
self.assertEqual(self.imm.getValue(), 0xfffc)
self.imm = Immediate(-4, CPUSIZE.DWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffc)
self.imm = Immediate(-4, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffffffffffc)
def test_value(self):
"""Check immediate value with different size."""
self.imm = Immediate(-4, CPUSIZE.BYTE)
self.assertEqual(self.imm.getValue(), 0xfc)
self.imm = Immediate(-4, CPUSIZE.WORD)
self.assertEqual(self.imm.getValue(), 0xfffc)
self.imm = Immediate(-4, CPUSIZE.DWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffc)
self.imm = Immediate(-4, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffffffffffc)
self.imm = Immediate(0x7123456789abcdef, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0x7123456789abcdef)
self.imm = Immediate(0x8123456789abcdef, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0x8123456789abcdef)
def setUp(self):
"""Define the arch and Immediate to test."""
self.Triton = TritonContext()
self.Triton.setArchitecture(ARCH.X86_64)
self.imm = Immediate(0x12, CPUSIZE.BYTE)
def setUp(self):
"""Define the arch and Immediate to test."""
self.Triton = TritonContext()
self.Triton.setArchitecture(ARCH.X86_64)
self.imm = Immediate(0x12345678, CPUSIZE.DWORD)
def test_value(self):
"""Check immediate value with different size."""
self.assertEqual(self.imm.getValue(), 0x1234)
self.imm = Immediate(-4, CPUSIZE.BYTE)
self.assertEqual(self.imm.getValue(), 0xfc)
self.imm = Immediate(-4, CPUSIZE.WORD)
self.assertEqual(self.imm.getValue(), 0xfffc)
self.imm = Immediate(-4, CPUSIZE.DWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffc)
self.imm = Immediate(-4, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffffffffffc)
self.imm = Immediate(-4, CPUSIZE.BYTE)
self.assertEqual(self.imm.getValue(), 0xfc)
self.imm = Immediate(-4, CPUSIZE.WORD)
self.assertEqual(self.imm.getValue(), 0xfffc)
self.imm = Immediate(-4, CPUSIZE.DWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffc)
self.imm = Immediate(-4, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0xfffffffffffffffc)
self.imm = Immediate(0x7123456789abcdef, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0x7123456789abcdef)
self.imm = Immediate(0x8123456789abcdef, CPUSIZE.QWORD)
self.assertEqual(self.imm.getValue(), 0x8123456789abcdef)
def setUp(self):
"""Define the arch and Immediate to test."""
self.Triton = TritonContext()
self.Triton.setArchitecture(ARCH.X86_64)
self.imm = Immediate(0x1234, CPUSIZE.WORD)