diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2019-05-29 13:18:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-29 13:18:49 +0200 |
| commit | 338dd94dbb83ed12467e6e2465308a35d08734d8 (patch) | |
| tree | 54819e8e88eb908e185a73f45b115da3e918a9e2 /test | |
| parent | ab673c1c26d2ab63890ed9ee2777faa778df7b64 (diff) | |
| parent | a15b03b615f9690e852fd8e58c198f50aabf3c63 (diff) | |
| download | miasm-338dd94dbb83ed12467e6e2465308a35d08734d8.tar.gz miasm-338dd94dbb83ed12467e6e2465308a35d08734d8.zip | |
Merge pull request #1016 from WilliamBruneau/fix_python_3_getset_reg
Fix PyGetInt for python 3
Diffstat (limited to 'test')
| -rw-r--r-- | test/jitter/jitcore.py | 47 | ||||
| -rwxr-xr-x | test/test_all.py | 1 |
2 files changed, 48 insertions, 0 deletions
diff --git a/test/jitter/jitcore.py b/test/jitter/jitcore.py new file mode 100644 index 00000000..75360542 --- /dev/null +++ b/test/jitter/jitcore.py @@ -0,0 +1,47 @@ +import sys + +from miasm.analysis.machine import Machine +machine = Machine("x86_64") +jitter = machine.jitter(sys.argv[1]) + +jitter.cpu.RAX = 16565615892967251934 +assert jitter.cpu.RAX == 16565615892967251934 + +jitter.cpu.RAX = -1 +assert jitter.cpu.RAX == 0xffffffffffffffff + +jitter.cpu.RAX = -2 +assert jitter.cpu.RAX == 0xfffffffffffffffe + +jitter.cpu.EAX = -2 +assert jitter.cpu.EAX == 0xfffffffe + +jitter.cpu.RAX = -0xffffffffffffffff +assert jitter.cpu.RAX == 1 + +try: + jitter.cpu.RAX = 0x1ffffffffffffffff +except TypeError: + pass +else: + raise Exception("Should see that 0x1ffffffffffffffff is too big for RAX") + +try: + jitter.cpu.RAX = 0x10000000000000000 +except TypeError: + pass +else: + raise Exception("Should see that 0x10000000000000000 is too big for RAX") + +jitter.cpu.EAX = -0xefffffff +assert jitter.cpu.EAX == 0x10000001 + +jitter.cpu.EAX = -0xFFFFFFFF +assert jitter.cpu.EAX == 1 + +try: + jitter.cpu.EAX = -0x1ffffffff +except TypeError: + pass +else: + raise Exception("Should see that -0x1ffffffff is too big for EAX") diff --git a/test/test_all.py b/test/test_all.py index 1f729a71..ce223211 100755 --- a/test/test_all.py +++ b/test/test_all.py @@ -457,6 +457,7 @@ for i, test_args in enumerate(test_args): for script in ["jitload.py", "vm_mngr.py", "jit_options.py", + "jitcore.py", "test_post_instr.py", "bad_block.py", "jmp_out_mem.py", |