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