You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
736 B

3 years ago
#!/usr/bin/python
# Test if addr == 0 and addr != 0 produces the same results on a NOP.
# Github issue: #9
# Author: Duncan (mrexodia)
from keystone import *
import regress
class TestX86Intel(regress.RegressTest):
def runTest(self):
# Initialize Keystone engine
ks = Ks(KS_ARCH_X86, KS_MODE_32)
# Assemble with zero addr
encoding1, count1 = ks.asm("nop", 0)
# Assemble with non-zero addr
encoding2, count2 = ks.asm("nop", 0x9123FFE1)
# Assert the result
self.assertEqual(encoding1, [ 0x90 ])
self.assertEqual(count1, 1)
self.assertEqual(encoding1, encoding2)
self.assertEqual(count1, count2)
if __name__ == '__main__':
regress.main()