aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/embed_top.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/programs/embed_top.zc')
-rw-r--r--tests/programs/embed_top.zc21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/programs/embed_top.zc b/tests/programs/embed_top.zc
new file mode 100644
index 0000000..732566d
--- /dev/null
+++ b/tests/programs/embed_top.zc
@@ -0,0 +1,21 @@
+namespace;
+include rt;
+
+// embed declarations at the top level, the form stage 0 compiles into run-only images.
+embed "tests/data/embed/text.txt" as text;
+embed "tests/data/embed/answer.bin" as int answer;
+embed "tests/data/embed/bytes.bin" as u8[] bytes;
+embed "tests/data/embed/bytes.bin" as i8[8] signed;
+embed "tests/data/embed/text.txt" as char* chars;
+embed "tests/data/embed/bytes.bin" as char[] cs;
+embed "tests/data/embed/shorts.bin" as u16[] shorts;
+fn main() {
+ rt.put_s(text); rt.put_c(32);
+ rt.put_n(answer); rt.put_c(32);
+ rt.put_n(bytes[4]); rt.put_c(32);
+ rt.put_n(signed[4]); rt.put_c(32); rt.put_n(signed[7]); rt.put_c(32);
+ rt.put_n(chars[6]); rt.put_c(32);
+ rt.put_n(cs[4]); rt.put_c(32);
+ rt.put_n(shorts[0] + shorts[1] * 10 + shorts[2] * 100); rt.put_c(10);
+ return 0;
+}