2009-07-02 19:35:46 -04:00
|
|
|
! Copyright (C) 2009 Jeremy Hughes.
|
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2009-07-07 17:45:08 -04:00
|
|
|
USING: alien.inline alien.inline.private io.directories io.files
|
|
|
|
|
kernel namespaces tools.test ;
|
2009-07-02 19:35:46 -04:00
|
|
|
IN: alien.inline.tests
|
|
|
|
|
|
|
|
|
|
C-LIBRARY: const
|
|
|
|
|
|
|
|
|
|
C-FUNCTION: const-int add ( int a, int b )
|
|
|
|
|
return a + b;
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
;C-LIBRARY
|
|
|
|
|
|
|
|
|
|
{ 2 1 } [ add ] must-infer-as
|
|
|
|
|
[ 5 ] [ 2 3 add ] unit-test
|
|
|
|
|
|
2009-07-07 17:45:08 -04:00
|
|
|
DELETE-C-LIBRARY: const
|
2009-07-02 19:35:46 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
C-LIBRARY: cpplib
|
|
|
|
|
|
|
|
|
|
COMPILE-AS-C++
|
|
|
|
|
|
|
|
|
|
C-INCLUDE: <string>
|
|
|
|
|
|
|
|
|
|
C-FUNCTION: const-char* hello ( )
|
|
|
|
|
std::string s("hello world");
|
|
|
|
|
return s.c_str();
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
;C-LIBRARY
|
|
|
|
|
|
|
|
|
|
{ 0 1 } [ hello ] must-infer-as
|
|
|
|
|
[ "hello world" ] [ hello ] unit-test
|
|
|
|
|
|
2009-07-07 17:45:08 -04:00
|
|
|
DELETE-C-LIBRARY: cpplib
|
2009-07-02 19:35:46 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
C-LIBRARY: compile-error
|
|
|
|
|
|
|
|
|
|
C-FUNCTION: char* breakme ( )
|
|
|
|
|
return not a string;
|
|
|
|
|
;
|
|
|
|
|
|
2009-07-02 23:32:00 -04:00
|
|
|
<< [ compile-c-library ] must-fail >>
|
2009-07-02 19:35:46 -04:00
|
|
|
|
2009-07-07 17:45:08 -04:00
|
|
|
DELETE-C-LIBRARY: compile-error
|