alien.marshall.syntax: added tests

db4
Jeremy Hughes 2009-07-08 09:39:39 +12:00
parent 7c1ae71a3e
commit ed65e2ae4c
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
! Copyright (C) 2009 Jeremy Hughes.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.inline alien.marshall.syntax destructors
tools.test ;
IN: alien.marshall.syntax.tests
C-LIBRARY: test
C-MARSHALLED: void outarg1 ( int* a )
*a += 2;
;
C-MARSHALLED: unsigned-long* outarg2 ( unsigned-long a, unsigned-long* b )
unsigned long* x = (unsigned long*) malloc(sizeof(unsigned long));
*b = 10 + *b;
*x = a + *b;
return x;
;
;C-LIBRARY
{ 1 1 } [ outarg1 ] must-infer-as
[ 3 ] [ [ 1 outarg1 ] with-destructors ] unit-test
{ 2 2 } [ outarg2 ] must-infer-as
[ 18 15 ] [ [ 3 5 outarg2 ] with-destructors ] unit-test
DELETE-C-LIBRARY: test