aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/trace.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 15:52:01 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 15:52:01 +0330
commit7c54e48bca711a6596be4bb17fcaa4330b9928e3 (patch)
treefd426755976847e368fe298db1c7c757f58799b9 /tests/programs/trace.zc
parenttodo: record each agent's state at the end of the session and the merge order (diff)
line tables and backtraces: port agent/line-tables onto main, op 56 on the x86-64 jit, docs, measurements, tests; default genome reservation 0x68000
Diffstat (limited to 'tests/programs/trace.zc')
-rw-r--r--tests/programs/trace.zc36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/programs/trace.zc b/tests/programs/trace.zc
new file mode 100644
index 0000000..c283f75
--- /dev/null
+++ b/tests/programs/trace.zc
@@ -0,0 +1,36 @@
+namespace;
+include rt;
+
+int get(int[?] t, int i) {
+ return t[i];
+}
+
+int sum(int[?] t, int n) {
+ int s = 0, i = 0;
+ while (i < n) {
+ s = s + get(t, i);
+ i++;
+ }
+ return s;
+}
+
+int where() {
+ rt.trace();
+ return 1;
+}
+
+int outer() {
+ int r = where();
+ return r;
+}
+
+int main() {
+ int[?] t = rt.new(int[?]);
+ t.push(1); t.push(2); t.push(3); t.push(4);
+ rt.put_n(outer());
+ rt.put_c(10);
+ rt.put_n(sum(t, 4));
+ rt.put_c(10);
+ rt.put_n(sum(t, 5));
+ return 0;
+}