summaryrefslogtreecommitdiff
path: root/tests/interop/test_c_import.zc
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-14 23:59:54 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-14 23:59:54 +0000
commitdcfdc053cb5f9fb4d5eac0a2233c75126b7a8188 (patch)
treef34f30b382fa22d6fd0af46875a5b4b26d00feff /tests/interop/test_c_import.zc
parenta918df69269a39ef7350a645b5db025d66ecb18a (diff)
Added some of the tests.
Diffstat (limited to 'tests/interop/test_c_import.zc')
-rw-r--r--tests/interop/test_c_import.zc26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/interop/test_c_import.zc b/tests/interop/test_c_import.zc
new file mode 100644
index 0000000..ed95bc1
--- /dev/null
+++ b/tests/interop/test_c_import.zc
@@ -0,0 +1,26 @@
+
+import "math.h" as m;
+
+test "test_c_import" {
+ var x = m::sin(0.0);
+
+ if x == 0.0 {
+ println "Success: m::sin(0.0) == 0.0";
+ } else {
+ println "Failure: Unexpected result";
+ exit(1);
+ }
+ }
+}
+
+extern fn abs(x: int) -> int;
+
+test "test_interop_abs" {
+ var x = -10;
+ var y = abs(x);
+ if (y == 10) println "Abs works";
+ else {
+ println "Abs failed";
+ exit(1);
+ }
+}