diff options
| author | 2026-10-14 15:49:27 +0330 | |
|---|---|---|
| committer | 2026-10-14 15:49:27 +0330 | |
| commit | 0ff8e8ee280e46f9f0ff06bf0958e91ff29da52e (patch) | |
| tree | f0d8b760771ca31c9e15796c06ead330299ab8e6 /tests/conformance/8-runtime | |
| parent | agent/spec-conformance: unmerged work from previous session (diff) | |
conformance: port the previous agent's suite, fix six expectations, add sections 5 to 8 and appendix b, known.txt, zc0 skips, wire into test.sh
Diffstat (limited to 'tests/conformance/8-runtime')
| -rw-r--r-- | tests/conformance/8-runtime/div_by_zero_no_trap.zc | 6 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/error_line_format.zc | 8 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/errors_do_not_run.zc | 6 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/get_c_reads_input.zc | 6 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/halt_stops.zc | 5 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/index_out_of_range.zc | 6 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/len_w_eq_w.zc | 5 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/new_zeroed.zc | 6 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/no_main_runs_nothing.zc | 6 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/put_c_low_bits.zc | 5 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/put_n_min.zc | 5 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/put_s_bstr.zc | 6 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/put_s_word_string.zc | 5 | ||||
| -rw-r--r-- | tests/conformance/8-runtime/too_many_errors.zc | 32 |
14 files changed, 107 insertions, 0 deletions
diff --git a/tests/conformance/8-runtime/div_by_zero_no_trap.zc b/tests/conformance/8-runtime/div_by_zero_no_trap.zc new file mode 100644 index 0000000..156bb18 --- /dev/null +++ b/tests/conformance/8-runtime/div_by_zero_no_trap.zc @@ -0,0 +1,6 @@ +// expect: ok/ +// spec 8.4 and 3.4.3 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { int z = 0; int x = 7 / z; rt.put_s("ok"); rt.put_c(10); return 0; } +// zc0: skip diff --git a/tests/conformance/8-runtime/error_line_format.zc b/tests/conformance/8-runtime/error_line_format.zc new file mode 100644 index 0000000..0f45306 --- /dev/null +++ b/tests/conformance/8-runtime/error_line_format.zc @@ -0,0 +1,8 @@ +// expect error: zc: line 6: +// spec 8.2 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { + int x = ; + return 0; } +// zc0: skip diff --git a/tests/conformance/8-runtime/errors_do_not_run.zc b/tests/conformance/8-runtime/errors_do_not_run.zc new file mode 100644 index 0000000..1a789a4 --- /dev/null +++ b/tests/conformance/8-runtime/errors_do_not_run.zc @@ -0,0 +1,6 @@ +// expect error: zc: 1 error +// spec 8.1.2 and 8.2: a unit with errors does not run +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { pn(1); int x = ; return 0; } +// zc0: skip diff --git a/tests/conformance/8-runtime/get_c_reads_input.zc b/tests/conformance/8-runtime/get_c_reads_input.zc new file mode 100644 index 0000000..469d564 --- /dev/null +++ b/tests/conformance/8-runtime/get_c_reads_input.zc @@ -0,0 +1,6 @@ +// expect: 104/105/-1/ +// spec 8.3: input after the backtick line +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { pn(rt.get_c()); pn(rt.get_c()); rt.get_c(); pn(rt.get_c()); return 0; } +`hi diff --git a/tests/conformance/8-runtime/halt_stops.zc b/tests/conformance/8-runtime/halt_stops.zc new file mode 100644 index 0000000..28ae5e4 --- /dev/null +++ b/tests/conformance/8-runtime/halt_stops.zc @@ -0,0 +1,5 @@ +// expect: 1/ +// spec 8.3 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { pn(1); rt.halt(); pn(2); return 0; } diff --git a/tests/conformance/8-runtime/index_out_of_range.zc b/tests/conformance/8-runtime/index_out_of_range.zc new file mode 100644 index 0000000..76938b5 --- /dev/null +++ b/tests/conformance/8-runtime/index_out_of_range.zc @@ -0,0 +1,6 @@ +// expect error: zy: index 5 out of range (length 3) +// spec 8.4 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { int[?] a = rt.new(int[?], 3); int i = 5; pn(a[i]); return 0; } +// zc0: skip diff --git a/tests/conformance/8-runtime/len_w_eq_w.zc b/tests/conformance/8-runtime/len_w_eq_w.zc new file mode 100644 index 0000000..78b1876 --- /dev/null +++ b/tests/conformance/8-runtime/len_w_eq_w.zc @@ -0,0 +1,5 @@ +// expect: 3/1/ +// spec 8.3 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { pn(rt.len_w("abc")); pn(rt.eq_w("ab", "ab") != 0); return 0; } diff --git a/tests/conformance/8-runtime/new_zeroed.zc b/tests/conformance/8-runtime/new_zeroed.zc new file mode 100644 index 0000000..fbdf407 --- /dev/null +++ b/tests/conformance/8-runtime/new_zeroed.zc @@ -0,0 +1,6 @@ +// expect: 0/ +// spec 8.3 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { int* p = rt.new(5); pn(p[4]); return 0; } +// zc0: skip diff --git a/tests/conformance/8-runtime/no_main_runs_nothing.zc b/tests/conformance/8-runtime/no_main_runs_nothing.zc new file mode 100644 index 0000000..91612d0 --- /dev/null +++ b/tests/conformance/8-runtime/no_main_runs_nothing.zc @@ -0,0 +1,6 @@ +// expect: +// spec 8.1.2 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +int f() { rt.put_c(65); return 0; } +// zc0: skip diff --git a/tests/conformance/8-runtime/put_c_low_bits.zc b/tests/conformance/8-runtime/put_c_low_bits.zc new file mode 100644 index 0000000..dfe226e --- /dev/null +++ b/tests/conformance/8-runtime/put_c_low_bits.zc @@ -0,0 +1,5 @@ +// expect: A/ +// spec 8.3 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { rt.put_c(321); rt.put_c(10); return 0; } diff --git a/tests/conformance/8-runtime/put_n_min.zc b/tests/conformance/8-runtime/put_n_min.zc new file mode 100644 index 0000000..012084e --- /dev/null +++ b/tests/conformance/8-runtime/put_n_min.zc @@ -0,0 +1,5 @@ +// expect: -9223372036854775808/ +// spec 8.3 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { pn(-9223372036854775807 - 1); return 0; } diff --git a/tests/conformance/8-runtime/put_s_bstr.zc b/tests/conformance/8-runtime/put_s_bstr.zc new file mode 100644 index 0000000..141f39c --- /dev/null +++ b/tests/conformance/8-runtime/put_s_bstr.zc @@ -0,0 +1,6 @@ +// expect: bs/ +// spec 8.3 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { rt.put_s(b"bs"); rt.put_c(10); return 0; } +// zc0: skip diff --git a/tests/conformance/8-runtime/put_s_word_string.zc b/tests/conformance/8-runtime/put_s_word_string.zc new file mode 100644 index 0000000..b8517c2 --- /dev/null +++ b/tests/conformance/8-runtime/put_s_word_string.zc @@ -0,0 +1,5 @@ +// expect: hey/ +// spec 8.3 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { rt.put_s("hey"); rt.put_c(10); return 0; } diff --git a/tests/conformance/8-runtime/too_many_errors.zc b/tests/conformance/8-runtime/too_many_errors.zc new file mode 100644 index 0000000..4a51501 --- /dev/null +++ b/tests/conformance/8-runtime/too_many_errors.zc @@ -0,0 +1,32 @@ +// expect error: zc: too many errors, stopping +// spec 8.2 +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +fn main() { + undefined_0(); + undefined_1(); + undefined_2(); + undefined_3(); + undefined_4(); + undefined_5(); + undefined_6(); + undefined_7(); + undefined_8(); + undefined_9(); + undefined_10(); + undefined_11(); + undefined_12(); + undefined_13(); + undefined_14(); + undefined_15(); + undefined_16(); + undefined_17(); + undefined_18(); + undefined_19(); + undefined_20(); + undefined_21(); + undefined_22(); + undefined_23(); + undefined_24(); + return 0; } +// zc0: skip |
