コード例 #1
0
ファイル: test_immediate.py プロジェクト: AmesianX/Triton
class TestImmediate64(unittest.TestCase):

    """Testing the Immediate class."""

    def setUp(self):
        """Define the arch and Immediate to test."""
        self.Triton = TritonContext()
        self.Triton.setArchitecture(ARCH.X86_64)
        self.imm = Immediate(0x0123456789abcdef, CPUSIZE.QWORD)

    def test_bit_size(self):
        """Check the bitsize."""
        self.assertEqual(self.imm.getBitSize(), 64)

    def test_size(self):
        """Check the size."""
        self.assertEqual(self.imm.getSize(), 8)

    def test_value(self):
        """Check immediate value with different size."""
        self.assertEqual(self.imm.getValue(), 0x0123456789abcdef)

    def test_type(self):
        """Check immadiate type."""
        self.assertEqual(self.imm.getType(), OPERAND.IMM)
コード例 #2
0
ファイル: test_immediate.py プロジェクト: zumb08/Triton
class TestImmediate8(unittest.TestCase):
    """Testing the Immediate class."""
    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 test_bit_size(self):
        """Check the bitsize."""
        self.assertEqual(self.imm.getBitSize(), 8)

    def test_size(self):
        """Check the size."""
        self.assertEqual(self.imm.getSize(), 1)

    def test_value(self):
        """Check immediate value with different size."""
        self.assertEqual(self.imm.getValue(), 0x12)

    def test_type(self):
        """Check immadiate type."""
        self.assertEqual(self.imm.getType(), OPERAND.IMM)

    def test_shift(self):
        """Check immadiate shift type."""
        self.assertEqual(self.imm.getShiftType(), SHIFT.ARM.INVALID)
コード例 #3
0
class TestImmediate32(unittest.TestCase):

    """Testing the Immediate class."""

    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_bit_size(self):
        """Check the bitsize."""
        self.assertEqual(self.imm.getBitSize(), 32)

    def test_size(self):
        """Check the size."""
        self.assertEqual(self.imm.getSize(), 4)

    def test_value(self):
        """Check immediate value with different size."""
        self.assertEqual(self.imm.getValue(), 0x12345678)

    def test_type(self):
        """Check immadiate type."""
        self.assertEqual(self.imm.getType(), OPERAND.IMM)
コード例 #4
0
ファイル: test_immediate.py プロジェクト: AmesianX/Triton
 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)
コード例 #5
0
ファイル: test_immediate.py プロジェクト: Manouchehri/Triton
class TestImmediate16(unittest.TestCase):

    """Testing the Immediate class."""

    def setUp(self):
        """Define the arch and Immediate to test."""
        setArchitecture(ARCH.X86_64)
        self.imm = Immediate(0x1234, CPUSIZE.WORD)

    def test_bit_size(self):
        """Check the bitsize."""
        self.assertEqual(self.imm.getBitSize(), 16)

    def test_size(self):
        """Check the size."""
        self.assertEqual(self.imm.getSize(), 2)

    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_type(self):
        """Check immadiate type."""
        self.assertEqual(self.imm.getType(), OPERAND.IMM)
コード例 #6
0
ファイル: test_immediate.py プロジェクト: zc0nf/Triton
class TestImmediate16(unittest.TestCase):
    """Testing the Immediate class."""
    def setUp(self):
        """Define the arch and Immediate to test."""
        setArchitecture(ARCH.X86_64)
        self.imm = Immediate(0x1234, CPUSIZE.WORD)

    def test_bit_size(self):
        """Check the bitsize."""
        self.assertEqual(self.imm.getBitSize(), 16)

    def test_size(self):
        """Check the size."""
        self.assertEqual(self.imm.getSize(), 2)

    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_type(self):
        """Check immadiate type."""
        self.assertEqual(self.imm.getType(), OPERAND.IMM)
コード例 #7
0
ファイル: test_immediate.py プロジェクト: zumb08/Triton
 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)
コード例 #8
0
ファイル: test_immediate.py プロジェクト: zumb08/Triton
class TestNegativeImmediate(unittest.TestCase):
    """Testing the Immediate class."""
    def setUp(self):
        self.Triton = TritonContext()
        self.Triton.setArchitecture(ARCH.X86_64)

    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)
コード例 #9
0
ファイル: test_immediate.py プロジェクト: AmesianX/Triton
class TestNegativeImmediate(unittest.TestCase):

    """Testing the Immediate class."""

    def setUp(self):
        self.Triton = TritonContext()
        self.Triton.setArchitecture(ARCH.X86_64)

    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)
コード例 #10
0
ファイル: test_immediate.py プロジェクト: zc0nf/Triton
class TestImmediate64(unittest.TestCase):
    """Testing the Immediate class."""
    def setUp(self):
        """Define the arch and Immediate to test."""
        setArchitecture(ARCH.X86_64)
        self.imm = Immediate(0x0123456789abcdef, CPUSIZE.QWORD)

    def test_bit_size(self):
        """Check the bitsize."""
        self.assertEqual(self.imm.getBitSize(), 64)

    def test_size(self):
        """Check the size."""
        self.assertEqual(self.imm.getSize(), 8)

    def test_value(self):
        """Check immediate value with different size."""
        self.assertEqual(self.imm.getValue(), 0x0123456789abcdef)

    def test_type(self):
        """Check immadiate type."""
        self.assertEqual(self.imm.getType(), OPERAND.IMM)
コード例 #11
0
ファイル: test_immediate.py プロジェクト: zumb08/Triton
 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)
コード例 #12
0
ファイル: test_immediate.py プロジェクト: zc0nf/Triton
 def setUp(self):
     """Define the arch and Immediate to test."""
     setArchitecture(ARCH.X86_64)
     self.imm = Immediate(0x12345678, CPUSIZE.DWORD)
コード例 #13
0
ファイル: test_immediate.py プロジェクト: AmesianX/Triton
 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)
コード例 #14
0
ファイル: test_immediate.py プロジェクト: Manouchehri/Triton
 def setUp(self):
     """Define the arch and Immediate to test."""
     setArchitecture(ARCH.X86_64)
     self.imm = Immediate(0x0123456789abcdef, CPUSIZE.QWORD)
コード例 #15
0
ファイル: test_immediate.py プロジェクト: zumb08/Triton
 def setUp(self):
     """Define the arch and Immediate to test."""
     self.Triton = TritonContext()
     self.Triton.setArchitecture(ARCH.X86_64)
     self.imm = Immediate(0x0123456789abcdef, CPUSIZE.QWORD)
コード例 #16
0
ファイル: test_symbolic.py プロジェクト: thorstent/Triton
 def test_build_immediate(self):
     """Check symbolic immediate has correct size and evaluation."""
     node = self.Triton.buildSymbolicImmediate(Immediate(
         0x10, CPUSIZE.BYTE))
     self.assertEqual(node.evaluate(), 0x10)
     self.assertEqual(node.getBitvectorSize(), CPUSIZE.BYTE_BIT)
コード例 #17
0
ファイル: test_immediate.py プロジェクト: Manouchehri/Triton
 def setUp(self):
     """Define the arch and Immediate to test."""
     setArchitecture(ARCH.X86_64)
     self.imm = Immediate(0x12, CPUSIZE.BYTE)