authorgravatar for timonkruiper@gmail.comTimon Kruiper <timonkruiper@gmail.com> 2021-03-24 15:41:32+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-03-24 19:54:03-07:00
logea42ab34abc0408b66ce2c0212afd4f5705e8d43
tree54ddd2108451aa314802e35b0873d4e3ab8ecdab
parent522707622e95ef17b94c7a3d78ca81cadde5274d

stage2: add block test cases llvm backend


1 files changed, 48 insertions(+), 48 deletions(-)

test/stage2/llvm.zig+48-48
...@@ -60,57 +60,57 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -60,57 +60,57 @@ pub fn addCases(ctx: *TestContext) !void {
60 , "");60 , "");
61 }61 }
6262
63 //{63 {
64 // var case = ctx.exeUsingLlvmBackend("blocks", linux_x64);64 var case = ctx.exeUsingLlvmBackend("blocks", linux_x64);
6565
66 // case.addCompareOutput(66 case.addCompareOutput(
67 // \\fn assert(ok: bool) void {67 \\fn assert(ok: bool) void {
68 // \\ if (!ok) unreachable;68 \\ if (!ok) unreachable;
69 // \\}69 \\}
70 // \\70 \\
71 // \\fn foo(ok: bool) i32 {71 \\fn foo(ok: bool) i32 {
72 // \\ const val: i32 = blk: {72 \\ const val: i32 = blk: {
73 // \\ var x: i32 = 1;73 \\ var x: i32 = 1;
74 // \\ if (!ok) break :blk x + 9;74 \\ if (!ok) break :blk x + 9;
75 // \\ break :blk x + 19;75 \\ break :blk x + 19;
76 // \\ };76 \\ };
77 // \\ return val + 10;77 \\ return val + 10;
78 // \\}78 \\}
79 // \\79 \\
80 // \\export fn main() c_int {80 \\export fn main() c_int {
81 // \\ assert(foo(false) == 20);81 \\ assert(foo(false) == 20);
82 // \\ assert(foo(true) == 30);82 \\ assert(foo(true) == 30);
83 // \\ return 0;83 \\ return 0;
84 // \\}84 \\}
85 // , "");85 , "");
86 //}86 }
8787
88 //{88 {
89 // var case = ctx.exeUsingLlvmBackend("nested blocks", linux_x64);89 var case = ctx.exeUsingLlvmBackend("nested blocks", linux_x64);
9090
91 // case.addCompareOutput(91 case.addCompareOutput(
92 // \\fn assert(ok: bool) void {92 \\fn assert(ok: bool) void {
93 // \\ if (!ok) unreachable;93 \\ if (!ok) unreachable;
94 // \\}94 \\}
95 // \\95 \\
96 // \\fn foo(ok: bool) i32 {96 \\fn foo(ok: bool) i32 {
97 // \\ var val: i32 = blk: {97 \\ var val: i32 = blk: {
98 // \\ const val2: i32 = another: {98 \\ const val2: i32 = another: {
99 // \\ if (!ok) break :blk 10;99 \\ if (!ok) break :blk 10;
100 // \\ break :another 10;100 \\ break :another 10;
101 // \\ };101 \\ };
102 // \\ break :blk val2 + 10;102 \\ break :blk val2 + 10;
103 // \\ };103 \\ };
104 // \\ return val;104 \\ return val;
105 // \\}105 \\}
106 // \\106 \\
107 // \\export fn main() c_int {107 \\export fn main() c_int {
108 // \\ assert(foo(false) == 10);108 \\ assert(foo(false) == 10);
109 // \\ assert(foo(true) == 20);109 \\ assert(foo(true) == 20);
110 // \\ return 0;110 \\ return 0;
111 // \\}111 \\}
112 // , "");112 , "");
113 //}113 }
114114
115 {115 {
116 var case = ctx.exeUsingLlvmBackend("while loops", linux_x64);116 var case = ctx.exeUsingLlvmBackend("while loops", linux_x64);