From 73f826415e320f091837e2bcb9ddaab3e7810f13 Mon Sep 17 00:00:00 2001 From: mrexodia <mr.exodia.tpodt@gmail.com> Date: Fri, 20 May 2016 20:35:28 +0200 Subject: [PATCH] added regression test for the issue discovered in #9 --- suite/regress/x86_address.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 suite/regress/x86_address.py diff --git a/suite/regress/x86_address.py b/suite/regress/x86_address.py new file mode 100644 index 0000000..8e259f3 --- /dev/null +++ b/suite/regress/x86_address.py @@ -0,0 +1,27 @@ +#!/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() -- GitLab