From 9178cac428c188acc096984e704d5707bdab0a35 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Tue, 3 Mar 2020 18:12:55 -0500 Subject: fixing const param bug --- tests/misc.toc | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'tests') diff --git a/tests/misc.toc b/tests/misc.toc index d66972f..a9f6dc1 100644 --- a/tests/misc.toc +++ b/tests/misc.toc @@ -1,27 +1,29 @@ #include "io.toc", io; -arr_sum ::= fn(n::=, t::=, a:[n]t) t { - total := 0 as t; - for x := a { - total += x; +main ::= fn() { + x ::= 3; + #if x > 2 { + io.puts("Hello!"); + } else { + foo("yes"); } - total -}; -mk_arr ::= fn(x:int, y:int, z:int) a:[3]int { - a[0] = x; - a[1] = y; - a[2] = z; -}; + io.puti(arr_sum(mk_arr(5,89,22))); + io.puti(arr_sum(mk_arr(1,2,3))); + io.puti(arr_sum(mk_arr(z=0, 0, 0))); + + arr_sum ::= fn(n::=, t::=, a:[n]t) t { + total := 0 as t; + for x := a { + total += x; + } + total + }; -main ::= fn() { - x ::= 3; - #if x > 2 { - io.puts("Hello!"); - } else { - foo("yes"); - } - io.puti(arr_sum(mk_arr(5,89,22))); - io.puti(arr_sum(mk_arr(1,2,3))); - io.puti(arr_sum(mk_arr(z=0, 0, 0))); -}; \ No newline at end of file + mk_arr ::= fn(x:int, y:int, z:int) a:[3]int { + a[0] = x; + a[1] = y; + a[2] = z; + }; + +}; -- cgit v1.2.3