cpu.x86: add some alien-assembly unit tests

db4
Slava Pestov 2010-01-07 17:59:17 +13:00
parent 46a1b1cc46
commit 0f29fed1f1
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,7 @@
IN: cpu.x86.32.tests
USING: alien alien.c-types tools.test cpu.x86.assembler
cpu.x86.assembler.operands ;
: assembly-test-1 ( -- x ) int { } "cdecl" [ EAX 3 MOV ] alien-assembly ;
[ 3 ] [ assembly-test-1 ] unit-test

View File

@ -0,0 +1,15 @@
USING: alien alien.c-types cpu.architecture cpu.x86.64
cpu.x86.assembler cpu.x86.assembler.operands tools.test ;
IN: cpu.x86.64.tests
: assembly-test-1 ( -- x ) int { } "cdecl" [ RAX 3 MOV ] alien-assembly ;
[ 3 ] [ assembly-test-1 ] unit-test
: assembly-test-2 ( a b -- x )
int { int int } "cdecl" [
param-reg-0 param-reg-1 ADD
int-regs return-reg param-reg-0 MOV
] alien-assembly ;
[ 23 ] [ 17 6 assembly-test-2 ] unit-test