From ed65e2ae4c386851cf365bb53ba4de9f1db676c7 Mon Sep 17 00:00:00 2001 From: Jeremy Hughes <jedahu@gmail.com> Date: Wed, 8 Jul 2009 09:39:39 +1200 Subject: [PATCH] alien.marshall.syntax: added tests --- .../alien/marshall/syntax/syntax-tests.factor | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 basis/alien/marshall/syntax/syntax-tests.factor diff --git a/basis/alien/marshall/syntax/syntax-tests.factor b/basis/alien/marshall/syntax/syntax-tests.factor new file mode 100644 index 0000000000..f324d6b791 --- /dev/null +++ b/basis/alien/marshall/syntax/syntax-tests.factor @@ -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