From e8c5109fb0865f6a42213780957fabb30304c202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Mon, 17 Jun 2024 04:07:42 +0500 Subject: [PATCH] Add test for #native --- tests/native_test.c | 14 ++++++++++++++ tests/native_test.lb | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 tests/native_test.c create mode 100644 tests/native_test.lb diff --git a/tests/native_test.c b/tests/native_test.c new file mode 100644 index 0000000..d8126e4 --- /dev/null +++ b/tests/native_test.c @@ -0,0 +1,14 @@ +#include +#include + +// Build with +// cc -shared -fPIC native_test.c -o native_test.so +// or +// cc -shared -fPIC native_test.c -o native_test.dll + +int labashka(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), size_t max_size ) { + printf("At %zu, there's %d.\n", len(), pop()); + push(12); + printf("Maximum size is %zu.\n", max_size); + return 0; +} diff --git a/tests/native_test.lb b/tests/native_test.lb new file mode 100644 index 0000000..2a42825 --- /dev/null +++ b/tests/native_test.lb @@ -0,0 +1,3 @@ +@ 0 + push -1 + #native native_test