summaryrefslogtreecommitdiff
path: root/tests/projects
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-04 00:58:57 +0800
committerruki <[email protected]>2021-09-04 00:58:57 +0800
commite13271050f95518e9451a334cad4b99dd0ac0e5c (patch)
tree81578b98e1cfcfb0c5b189502ce48952388d964d /tests/projects
parentc4b3c9836293e77fcfc87b3e8f788cc974b1e59a (diff)
add more pascal tests
Diffstat (limited to 'tests/projects')
-rw-r--r--tests/projects/pascal/console_with_c/src/foo.c7
-rw-r--r--tests/projects/pascal/console_with_c/src/main.pas12
-rw-r--r--tests/projects/pascal/console_with_c/xmake.lua9
3 files changed, 28 insertions, 0 deletions
diff --git a/tests/projects/pascal/console_with_c/src/foo.c b/tests/projects/pascal/console_with_c/src/foo.c
new file mode 100644
index 000000000..66ca7cfb4
--- /dev/null
+++ b/tests/projects/pascal/console_with_c/src/foo.c
@@ -0,0 +1,7 @@
+#include <stdint.h>
+
+extern int64_t fib(int64_t n)
+{
+ return n > 1 ? fib(n - 1) + fib(n - 2) : 1;
+}
+
diff --git a/tests/projects/pascal/console_with_c/src/main.pas b/tests/projects/pascal/console_with_c/src/main.pas
new file mode 100644
index 000000000..ce34e4af9
--- /dev/null
+++ b/tests/projects/pascal/console_with_c/src/main.pas
@@ -0,0 +1,12 @@
+program hello;
+
+function fib(n: Int64): Int64;
+ cdecl; external 'foo';
+
+var
+ Value: Integer;
+begin
+ Value := 5;
+ WriteLn(fib(Value));
+end.
+
diff --git a/tests/projects/pascal/console_with_c/xmake.lua b/tests/projects/pascal/console_with_c/xmake.lua
new file mode 100644
index 000000000..111efc0c9
--- /dev/null
+++ b/tests/projects/pascal/console_with_c/xmake.lua
@@ -0,0 +1,9 @@
+add_rules("mode.debug", "mode.release")
+target("foo")
+ set_kind("static")
+ add_files("src/foo.c")
+
+target("test")
+ set_kind("binary")
+ add_deps("foo")
+ add_files("src/main.pas")