summaryrefslogtreecommitdiff
path: root/test/wasm_backend
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm_backend')
-rw-r--r--test/wasm_backend/hello_num.cpp10
-rw-r--r--test/wasm_backend/hello_num.txt1
-rw-r--r--test/wasm_backend/hello_world.cpp8
-rw-r--r--test/wasm_backend/hello_world.txt1
4 files changed, 20 insertions, 0 deletions
diff --git a/test/wasm_backend/hello_num.cpp b/test/wasm_backend/hello_num.cpp
new file mode 100644
index 000000000..d272f11c6
--- /dev/null
+++ b/test/wasm_backend/hello_num.cpp
@@ -0,0 +1,10 @@
+#include <emscripten.h>
+
+int main() {
+ int *x = (int*)8;
+ *x = 123;
+ EM_ASM({
+ Module.print("hello, world " + HEAP32[8>>2] + "!");
+ });
+}
+
diff --git a/test/wasm_backend/hello_num.txt b/test/wasm_backend/hello_num.txt
new file mode 100644
index 000000000..9afd068a4
--- /dev/null
+++ b/test/wasm_backend/hello_num.txt
@@ -0,0 +1 @@
+hello, world 123!
diff --git a/test/wasm_backend/hello_world.cpp b/test/wasm_backend/hello_world.cpp
new file mode 100644
index 000000000..a4a6a025d
--- /dev/null
+++ b/test/wasm_backend/hello_world.cpp
@@ -0,0 +1,8 @@
+#include <emscripten.h>
+
+int main() {
+ EM_ASM({
+ Module.print("hello, world!");
+ });
+}
+
diff --git a/test/wasm_backend/hello_world.txt b/test/wasm_backend/hello_world.txt
new file mode 100644
index 000000000..270c611ee
--- /dev/null
+++ b/test/wasm_backend/hello_world.txt
@@ -0,0 +1 @@
+hello, world!