1 USING: interpolate multiline
2 io io.directories io.encodings.ascii io.files
3 io.files.temp io.launcher io.streams.string kernel locals system
5 IN: alien.remote-control.tests
7 : compile-file ( contents -- )
8 "test.c" ascii set-file-contents
9 { "gcc" "-I../" "-L.." "-lfactor" "test.c" }
10 os macosx? cpu x86.64? and [ "-m64" suffix ] when
13 : run-test ( -- line )
14 os windows? "temp/a.exe" "temp/a.out" ?
15 ascii [ readln ] with-process-reader ;
17 :: test-embedding ( code -- line )
22 #include <vm/master.h>
26 int main(int argc, char **argv)
29 default_parameters(&p);
30 p.image_path = STRING_LITERAL("${image}");
32 start_embedded_factor(&p);
39 "resource:temp" [ compile-file ] with-directory
40 "resource:" [ run-test ] with-directory ;
42 ! [ "Done." ] [ "" test-embedding ] unit-test
44 ! [ "Done." ] [ "factor_yield();" test-embedding ] unit-test