diff options
| author | Camille Mougey <commial@gmail.com> | 2018-11-18 15:15:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-18 15:15:48 +0100 |
| commit | ba4071553ea2e44ce87f58a9377dcc1d29bd81a1 (patch) | |
| tree | 17ac6d584179cfff0dcee0742202f157898e60d3 /test/arch/x86/unit/mn_cmov.py | |
| parent | 3fc672fad2d703e9e36e0e964547e67c674cc4c7 (diff) | |
| parent | 2469b28ae4d73f2a6e813fc250953ae8da36d090 (diff) | |
| download | miasm-ba4071553ea2e44ce87f58a9377dcc1d29bd81a1.tar.gz miasm-ba4071553ea2e44ce87f58a9377dcc1d29bd81a1.zip | |
Merge pull request #885 from serpilliere/x86_reg_tests
Add x86 reg tests
Diffstat (limited to 'test/arch/x86/unit/mn_cmov.py')
| -rw-r--r-- | test/arch/x86/unit/mn_cmov.py | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/test/arch/x86/unit/mn_cmov.py b/test/arch/x86/unit/mn_cmov.py new file mode 100644 index 00000000..29dc0823 --- /dev/null +++ b/test/arch/x86/unit/mn_cmov.py @@ -0,0 +1,72 @@ +import sys +from asm_test import Asm_Test_64 + +class Test_CMOVZ_OK(Asm_Test_64): + TXT = ''' +main: + MOV RAX, 0x8877665544332211 + MOV RBX, RAX + MOV RAX, 0xAABBCCDDEEFF0011 + XOR RCX, RCX + CMOVZ RAX, RBX + RET + ''' + def check(self): + assert self.myjit.cpu.RAX == 0x8877665544332211 + + +class Test_CMOVZ_KO(Asm_Test_64): + TXT = ''' +main: + MOV RAX, 0x8877665544332211 + MOV RBX, RAX + MOV RAX, 0xAABBCCDDEEFF0011 + XOR RCX, RCX + INC RCX + CMOVZ RAX, RBX + RET + ''' + def check(self): + assert self.myjit.cpu.RAX == 0xAABBCCDDEEFF0011 + + +class Test_CMOVZ_OK_64_32(Asm_Test_64): + TXT = ''' +main: + MOV RAX, 0x8877665544332211 + MOV RBX, RAX + MOV RAX, 0xAABBCCDDEEFF0011 + XOR RCX, RCX + CMOVZ EAX, EBX + RET + ''' + def check(self): + assert self.myjit.cpu.RAX == 0x44332211 + + +class Test_CMOVZ_KO_64_32(Asm_Test_64): + TXT = ''' +main: + MOV RAX, 0x8877665544332211 + MOV RBX, RAX + MOV RAX, 0xAABBCCDDEEFF0011 + XOR RCX, RCX + INC RCX + CMOVZ EAX, EBX + RET + ''' + def check(self): + assert self.myjit.cpu.RAX == 0xEEFF0011 + + + +if __name__ == "__main__": + [ + test(*sys.argv[1:])() for test in [ + Test_CMOVZ_OK, + Test_CMOVZ_KO, + Test_CMOVZ_OK_64_32, + Test_CMOVZ_KO_64_32, + ] + ] + |