authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-18 15:02:52-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-18 15:02:52-07:00
logad5770eba40e0cc425c7a1eab4d37c6f9788d670
treee849a479217b69c9698ac35782e4f270ce3bbfca
parentd5803441cd0c06d3fb7f11f5cb447c20e0d62d52

organize behavior tests

* Identify the ones that are passing and stop skipping them. * Flatten out the main behavior.zig file and have each individual test disable itself if it is not passing.

17 files changed, 328 insertions(+), 73 deletions(-)

test/behavior.zig+37-41
...@@ -13,6 +13,7 @@ test {...@@ -13,6 +13,7 @@ test {
13 _ = @import("behavior/byval_arg_var.zig");13 _ = @import("behavior/byval_arg_var.zig");
14 _ = @import("behavior/bool.zig");14 _ = @import("behavior/bool.zig");
15 _ = @import("behavior/bugs/394.zig");15 _ = @import("behavior/bugs/394.zig");
16 _ = @import("behavior/bugs/421.zig");
16 _ = @import("behavior/bugs/624.zig");17 _ = @import("behavior/bugs/624.zig");
17 _ = @import("behavior/bugs/655.zig");18 _ = @import("behavior/bugs/655.zig");
18 _ = @import("behavior/bugs/656.zig");19 _ = @import("behavior/bugs/656.zig");
...@@ -34,8 +35,10 @@ test {...@@ -34,8 +35,10 @@ test {
34 _ = @import("behavior/bugs/1607.zig");35 _ = @import("behavior/bugs/1607.zig");
35 _ = @import("behavior/bugs/1735.zig");36 _ = @import("behavior/bugs/1735.zig");
36 _ = @import("behavior/bugs/1741.zig");37 _ = @import("behavior/bugs/1741.zig");
38 _ = @import("behavior/bugs/1851.zig");
37 _ = @import("behavior/bugs/1914.zig");39 _ = @import("behavior/bugs/1914.zig");
38 _ = @import("behavior/bugs/2006.zig");40 _ = @import("behavior/bugs/2006.zig");
41 _ = @import("behavior/bugs/2114.zig");
39 _ = @import("behavior/bugs/2346.zig");42 _ = @import("behavior/bugs/2346.zig");
40 _ = @import("behavior/bugs/2578.zig");43 _ = @import("behavior/bugs/2578.zig");
41 _ = @import("behavior/bugs/2692.zig");44 _ = @import("behavior/bugs/2692.zig");
...@@ -47,6 +50,7 @@ test {...@@ -47,6 +50,7 @@ test {
47 _ = @import("behavior/bugs/3384.zig");50 _ = @import("behavior/bugs/3384.zig");
48 _ = @import("behavior/bugs/3586.zig");51 _ = @import("behavior/bugs/3586.zig");
49 _ = @import("behavior/bugs/3742.zig");52 _ = @import("behavior/bugs/3742.zig");
53 _ = @import("behavior/bugs/3779.zig");
50 _ = @import("behavior/bugs/4328.zig");54 _ = @import("behavior/bugs/4328.zig");
51 _ = @import("behavior/bugs/4560.zig");55 _ = @import("behavior/bugs/4560.zig");
52 _ = @import("behavior/bugs/4769_a.zig");56 _ = @import("behavior/bugs/4769_a.zig");
...@@ -61,9 +65,11 @@ test {...@@ -61,9 +65,11 @@ test {
61 _ = @import("behavior/bugs/7003.zig");65 _ = @import("behavior/bugs/7003.zig");
62 _ = @import("behavior/bugs/7047.zig");66 _ = @import("behavior/bugs/7047.zig");
63 _ = @import("behavior/bugs/7250.zig");67 _ = @import("behavior/bugs/7250.zig");
64 _ = @import("behavior/bugs/11100.zig");68 _ = @import("behavior/bugs/9584.zig");
69 _ = @import("behavior/bugs/10147.zig");
65 _ = @import("behavior/bugs/10970.zig");70 _ = @import("behavior/bugs/10970.zig");
66 _ = @import("behavior/bugs/11046.zig");71 _ = @import("behavior/bugs/11046.zig");
72 _ = @import("behavior/bugs/11100.zig");
67 _ = @import("behavior/bugs/11139.zig");73 _ = @import("behavior/bugs/11139.zig");
68 _ = @import("behavior/bugs/11159.zig");74 _ = @import("behavior/bugs/11159.zig");
69 _ = @import("behavior/bugs/11162.zig");75 _ = @import("behavior/bugs/11162.zig");
...@@ -73,11 +79,13 @@ test {...@@ -73,11 +79,13 @@ test {
73 _ = @import("behavior/bugs/11213.zig");79 _ = @import("behavior/bugs/11213.zig");
74 _ = @import("behavior/call.zig");80 _ = @import("behavior/call.zig");
75 _ = @import("behavior/cast.zig");81 _ = @import("behavior/cast.zig");
82 _ = @import("behavior/cast_int.zig");
76 _ = @import("behavior/comptime_memory.zig");83 _ = @import("behavior/comptime_memory.zig");
77 _ = @import("behavior/const_slice_child.zig");84 _ = @import("behavior/const_slice_child.zig");
78 _ = @import("behavior/defer.zig");85 _ = @import("behavior/defer.zig");
79 _ = @import("behavior/enum.zig");86 _ = @import("behavior/enum.zig");
80 _ = @import("behavior/error.zig");87 _ = @import("behavior/error.zig");
88 _ = @import("behavior/eval.zig");
81 _ = @import("behavior/field_parent_ptr.zig");89 _ = @import("behavior/field_parent_ptr.zig");
82 _ = @import("behavior/floatop.zig");90 _ = @import("behavior/floatop.zig");
83 _ = @import("behavior/fn_delegation.zig");91 _ = @import("behavior/fn_delegation.zig");
...@@ -90,10 +98,12 @@ test {...@@ -90,10 +98,12 @@ test {
90 _ = @import("behavior/if.zig");98 _ = @import("behavior/if.zig");
91 _ = @import("behavior/import.zig");99 _ = @import("behavior/import.zig");
92 _ = @import("behavior/incomplete_struct_param_tld.zig");100 _ = @import("behavior/incomplete_struct_param_tld.zig");
101 _ = @import("behavior/int128.zig");
93 _ = @import("behavior/int_div.zig");102 _ = @import("behavior/int_div.zig");
94 _ = @import("behavior/inttoptr.zig");103 _ = @import("behavior/inttoptr.zig");
95 _ = @import("behavior/ir_block_deps.zig");104 _ = @import("behavior/ir_block_deps.zig");
96 _ = @import("behavior/math.zig");105 _ = @import("behavior/math.zig");
106 _ = @import("behavior/maximum_minimum.zig");
97 _ = @import("behavior/member_func.zig");107 _ = @import("behavior/member_func.zig");
98 _ = @import("behavior/merge_error_sets.zig");108 _ = @import("behavior/merge_error_sets.zig");
99 _ = @import("behavior/muladd.zig");109 _ = @import("behavior/muladd.zig");
...@@ -101,21 +111,25 @@ test {...@@ -101,21 +111,25 @@ test {
101 _ = @import("behavior/null.zig");111 _ = @import("behavior/null.zig");
102 _ = @import("behavior/optional.zig");112 _ = @import("behavior/optional.zig");
103 _ = @import("behavior/pointers.zig");113 _ = @import("behavior/pointers.zig");
114 _ = @import("behavior/popcount.zig");
104 _ = @import("behavior/prefetch.zig");115 _ = @import("behavior/prefetch.zig");
105 _ = @import("behavior/ptrcast.zig");116 _ = @import("behavior/ptrcast.zig");
106 _ = @import("behavior/pub_enum.zig");117 _ = @import("behavior/pub_enum.zig");
107 _ = @import("behavior/ref_var_in_if_after_if_2nd_switch_prong.zig");118 _ = @import("behavior/ref_var_in_if_after_if_2nd_switch_prong.zig");
108 _ = @import("behavior/reflection.zig");119 _ = @import("behavior/reflection.zig");
120 _ = @import("behavior/saturating_arithmetic.zig");
121 _ = @import("behavior/shuffle.zig");
109 _ = @import("behavior/sizeof_and_typeof.zig");122 _ = @import("behavior/sizeof_and_typeof.zig");
110 _ = @import("behavior/slice_sentinel_comptime.zig");
111 _ = @import("behavior/slice.zig");123 _ = @import("behavior/slice.zig");
124 _ = @import("behavior/slice_sentinel_comptime.zig");
112 _ = @import("behavior/src.zig");125 _ = @import("behavior/src.zig");
113 _ = @import("behavior/struct_contains_null_ptr_itself.zig");
114 _ = @import("behavior/struct.zig");126 _ = @import("behavior/struct.zig");
127 _ = @import("behavior/struct_contains_null_ptr_itself.zig");
128 _ = @import("behavior/switch.zig");
115 _ = @import("behavior/switch_prong_err_enum.zig");129 _ = @import("behavior/switch_prong_err_enum.zig");
116 _ = @import("behavior/switch_prong_implicit_cast.zig");130 _ = @import("behavior/switch_prong_implicit_cast.zig");
117 _ = @import("behavior/switch.zig");
118 _ = @import("behavior/this.zig");131 _ = @import("behavior/this.zig");
132 _ = @import("behavior/translate_c_macros.zig");
119 _ = @import("behavior/truncate.zig");133 _ = @import("behavior/truncate.zig");
120 _ = @import("behavior/try.zig");134 _ = @import("behavior/try.zig");
121 _ = @import("behavior/tuple.zig");135 _ = @import("behavior/tuple.zig");
...@@ -125,11 +139,13 @@ test {...@@ -125,11 +139,13 @@ test {
125 _ = @import("behavior/undefined.zig");139 _ = @import("behavior/undefined.zig");
126 _ = @import("behavior/underscore.zig");140 _ = @import("behavior/underscore.zig");
127 _ = @import("behavior/union.zig");141 _ = @import("behavior/union.zig");
142 _ = @import("behavior/union_with_members.zig");
128 _ = @import("behavior/usingnamespace.zig");143 _ = @import("behavior/usingnamespace.zig");
129 _ = @import("behavior/var_args.zig");144 _ = @import("behavior/var_args.zig");
130 _ = @import("behavior/vector.zig");145 _ = @import("behavior/vector.zig");
131 _ = @import("behavior/void.zig");146 _ = @import("behavior/void.zig");
132 _ = @import("behavior/while.zig");147 _ = @import("behavior/while.zig");
148 _ = @import("behavior/widening.zig");
133149
134 if (builtin.stage2_arch == .wasm32) {150 if (builtin.stage2_arch == .wasm32) {
135 _ = @import("behavior/wasm.zig");151 _ = @import("behavior/wasm.zig");
...@@ -142,46 +158,26 @@ test {...@@ -142,46 +158,26 @@ test {
142 if (builtin.zig_backend != .stage2_arm and158 if (builtin.zig_backend != .stage2_arm and
143 builtin.zig_backend != .stage2_x86_64 and159 builtin.zig_backend != .stage2_x86_64 and
144 builtin.zig_backend != .stage2_aarch64 and160 builtin.zig_backend != .stage2_aarch64 and
145 builtin.zig_backend != .stage2_wasm)161 builtin.zig_backend != .stage2_wasm and
162 builtin.zig_backend != .stage2_c)
146 {163 {
147 // Tests that pass for stage1, llvm backend, C backend164 _ = @import("behavior/export.zig");
148 _ = @import("behavior/bugs/421.zig");
149 _ = @import("behavior/bugs/3779.zig");
150 _ = @import("behavior/bugs/9584.zig");
151 _ = @import("behavior/cast_int.zig");
152 _ = @import("behavior/eval.zig");
153 _ = @import("behavior/export_self_referential_type_info.zig");165 _ = @import("behavior/export_self_referential_type_info.zig");
154 _ = @import("behavior/int128.zig");166 }
155 _ = @import("behavior/popcount.zig");
156 _ = @import("behavior/translate_c_macros.zig");
157 _ = @import("behavior/union_with_members.zig");
158
159 if (builtin.zig_backend != .stage2_c) {
160 // Tests that pass for stage1 and the llvm backend.
161 _ = @import("behavior/export.zig");
162 _ = @import("behavior/maximum_minimum.zig");
163 _ = @import("behavior/saturating_arithmetic.zig");
164 _ = @import("behavior/widening.zig");
165 _ = @import("behavior/bugs/2114.zig");
166 _ = @import("behavior/bugs/10147.zig");
167 _ = @import("behavior/shuffle.zig");
168167
169 if (builtin.zig_backend == .stage1) {168 if (builtin.zig_backend == .stage1) {
170 // Tests that only pass for the stage1 backend.169 // TODO get these tests passing with stage2
171 if (builtin.os.tag != .wasi) {170 if (builtin.os.tag != .wasi) {
172 _ = @import("behavior/asm.zig");171 _ = @import("behavior/asm.zig");
173 _ = @import("behavior/async_fn.zig");172 _ = @import("behavior/async_fn.zig");
174 }
175 _ = @import("behavior/await_struct.zig");
176 _ = @import("behavior/bugs/529.zig");
177 _ = @import("behavior/bugs/920.zig");
178 _ = @import("behavior/bugs/1120.zig");
179 _ = @import("behavior/bugs/1851.zig");
180 _ = @import("behavior/bugs/6781.zig");
181 _ = @import("behavior/bugs/7027.zig");
182 _ = @import("behavior/select.zig");
183 _ = @import("behavior/struct_contains_slice_of_itself.zig");
184 }
185 }173 }
174 _ = @import("behavior/await_struct.zig");
175 _ = @import("behavior/bugs/529.zig");
176 _ = @import("behavior/bugs/920.zig");
177 _ = @import("behavior/bugs/1120.zig");
178 _ = @import("behavior/bugs/6781.zig");
179 _ = @import("behavior/bugs/7027.zig");
180 _ = @import("behavior/select.zig");
181 _ = @import("behavior/struct_contains_slice_of_itself.zig");
186 }182 }
187}183}
test/behavior/bugs/10147.zig+7
...@@ -1,6 +1,13 @@...@@ -1,6 +1,13 @@
1const builtin = @import("builtin");
1const std = @import("std");2const std = @import("std");
23
3test "uses correct LLVM builtin" {4test "uses correct LLVM builtin" {
5 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
6 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
7 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
8 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
9 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
10
4 var x: u32 = 0x1;11 var x: u32 = 0x1;
5 var y: @Vector(4, u32) = [_]u32{ 0x1, 0x1, 0x1, 0x1 };12 var y: @Vector(4, u32) = [_]u32{ 0x1, 0x1, 0x1, 0x1 };
6 // The stage1 compiler used to call the same builtin function for both13 // The stage1 compiler used to call the same builtin function for both
test/behavior/bugs/1851.zig+15
...@@ -1,7 +1,22 @@...@@ -1,7 +1,22 @@
1const builtin = @import("builtin");
1const std = @import("std");2const std = @import("std");
2const expect = std.testing.expect;3const expect = std.testing.expect;
34
4test "allocation and looping over 3-byte integer" {5test "allocation and looping over 3-byte integer" {
6 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
7 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
8 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
9 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
10 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
11
12 if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .macos) {
13 return error.SkipZigTest; // TODO
14 }
15
16 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .wasm32) {
17 return error.SkipZigTest; // TODO
18 }
19
5 try expect(@sizeOf(u24) == 4);20 try expect(@sizeOf(u24) == 4);
6 try expect(@sizeOf([1]u24) == 4);21 try expect(@sizeOf([1]u24) == 4);
7 try expect(@alignOf(u24) == 4);22 try expect(@alignOf(u24) == 4);
test/behavior/bugs/2114.zig+7
...@@ -1,3 +1,4 @@...@@ -1,3 +1,4 @@
1const builtin = @import("builtin");
1const std = @import("std");2const std = @import("std");
2const expect = std.testing.expect;3const expect = std.testing.expect;
3const math = std.math;4const math = std.math;
...@@ -7,6 +8,12 @@ fn ctz(x: anytype) usize {...@@ -7,6 +8,12 @@ fn ctz(x: anytype) usize {
7}8}
89
9test "fixed" {10test "fixed" {
11 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
12 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
13 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
14 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
15 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
16
10 try testCtz();17 try testCtz();
11 comptime try testCtz();18 comptime try testCtz();
12}19}
test/behavior/bugs/3779.zig+15
...@@ -7,6 +7,9 @@ const ptr_tag_name: [*:0]const u8 = tag_name;...@@ -7,6 +7,9 @@ const ptr_tag_name: [*:0]const u8 = tag_name;
77
8test "@tagName() returns a string literal" {8test "@tagName() returns a string literal" {
9 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong9 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong
10 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
11 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
12
10 try std.testing.expect(*const [13:0]u8 == @TypeOf(tag_name));13 try std.testing.expect(*const [13:0]u8 == @TypeOf(tag_name));
11 try std.testing.expect(std.mem.eql(u8, "TestEnumValue", tag_name));14 try std.testing.expect(std.mem.eql(u8, "TestEnumValue", tag_name));
12 try std.testing.expect(std.mem.eql(u8, "TestEnumValue", ptr_tag_name[0..tag_name.len]));15 try std.testing.expect(std.mem.eql(u8, "TestEnumValue", ptr_tag_name[0..tag_name.len]));
...@@ -18,6 +21,9 @@ const ptr_error_name: [*:0]const u8 = error_name;...@@ -18,6 +21,9 @@ const ptr_error_name: [*:0]const u8 = error_name;
1821
19test "@errorName() returns a string literal" {22test "@errorName() returns a string literal" {
20 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong23 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong
24 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
25 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
26
21 try std.testing.expect(*const [13:0]u8 == @TypeOf(error_name));27 try std.testing.expect(*const [13:0]u8 == @TypeOf(error_name));
22 try std.testing.expect(std.mem.eql(u8, "TestErrorCode", error_name));28 try std.testing.expect(std.mem.eql(u8, "TestErrorCode", error_name));
23 try std.testing.expect(std.mem.eql(u8, "TestErrorCode", ptr_error_name[0..error_name.len]));29 try std.testing.expect(std.mem.eql(u8, "TestErrorCode", ptr_error_name[0..error_name.len]));
...@@ -29,6 +35,9 @@ const ptr_type_name: [*:0]const u8 = type_name;...@@ -29,6 +35,9 @@ const ptr_type_name: [*:0]const u8 = type_name;
2935
30test "@typeName() returns a string literal" {36test "@typeName() returns a string literal" {
31 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong37 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong
38 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
39 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
40
32 try std.testing.expect(*const [type_name.len:0]u8 == @TypeOf(type_name));41 try std.testing.expect(*const [type_name.len:0]u8 == @TypeOf(type_name));
33 try std.testing.expect(std.mem.eql(u8, "behavior.bugs.3779.TestType", type_name));42 try std.testing.expect(std.mem.eql(u8, "behavior.bugs.3779.TestType", type_name));
34 try std.testing.expect(std.mem.eql(u8, "behavior.bugs.3779.TestType", ptr_type_name[0..type_name.len]));43 try std.testing.expect(std.mem.eql(u8, "behavior.bugs.3779.TestType", ptr_type_name[0..type_name.len]));
...@@ -39,6 +48,9 @@ const ptr_actual_contents: [*:0]const u8 = actual_contents;...@@ -39,6 +48,9 @@ const ptr_actual_contents: [*:0]const u8 = actual_contents;
39const expected_contents = "hello zig\n";48const expected_contents = "hello zig\n";
4049
41test "@embedFile() returns a string literal" {50test "@embedFile() returns a string literal" {
51 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
52 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
53
42 try std.testing.expect(*const [expected_contents.len:0]u8 == @TypeOf(actual_contents));54 try std.testing.expect(*const [expected_contents.len:0]u8 == @TypeOf(actual_contents));
43 try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents));55 try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents));
44 try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents));56 try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents));
...@@ -50,6 +62,9 @@ fn testFnForSrc() std.builtin.SourceLocation {...@@ -50,6 +62,9 @@ fn testFnForSrc() std.builtin.SourceLocation {
50}62}
5163
52test "@src() returns a struct containing 0-terminated string slices" {64test "@src() returns a struct containing 0-terminated string slices" {
65 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
66 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
67
53 const src = testFnForSrc();68 const src = testFnForSrc();
54 try std.testing.expect([:0]const u8 == @TypeOf(src.file));69 try std.testing.expect([:0]const u8 == @TypeOf(src.file));
55 try std.testing.expect(std.mem.endsWith(u8, src.file, "3779.zig"));70 try std.testing.expect(std.mem.endsWith(u8, src.file, "3779.zig"));
test/behavior/bugs/421.zig+6
...@@ -1,6 +1,12 @@...@@ -1,6 +1,12 @@
1const builtin = @import("builtin");
1const expect = @import("std").testing.expect;2const expect = @import("std").testing.expect;
23
3test "bitCast to array" {4test "bitCast to array" {
5 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
6 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
7 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
8 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
9
4 comptime try testBitCastArray();10 comptime try testBitCastArray();
5 try testBitCastArray();11 try testBitCastArray();
6}12}
test/behavior/bugs/9584.zig+8-1
...@@ -1,3 +1,4 @@...@@ -1,3 +1,4 @@
1const builtin = @import("builtin");
1const std = @import("std");2const std = @import("std");
23
3const A = packed struct {4const A = packed struct {
...@@ -41,7 +42,13 @@ pub fn b(x: *X) !void {...@@ -41,7 +42,13 @@ pub fn b(x: *X) !void {
41 try a(0, 1, 2, 3, 4, x.x.a, x.x.b);42 try a(0, 1, 2, 3, 4, x.x.a, x.x.b);
42}43}
4344
44test "bug 9584" {45test {
46 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
47 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
48 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
49 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
50 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
51
45 var flags = A{52 var flags = A{
46 .a = false,53 .a = false,
47 .b = true,54 .b = true,
test/behavior/cast_int.zig+7
...@@ -1,8 +1,15 @@...@@ -1,8 +1,15 @@
1const builtin = @import("builtin");
1const std = @import("std");2const std = @import("std");
2const expect = std.testing.expect;3const expect = std.testing.expect;
3const maxInt = std.math.maxInt;4const maxInt = std.math.maxInt;
45
5test "@intCast i32 to u7" {6test "@intCast i32 to u7" {
7 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
8 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
9 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
10 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
11 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
12
6 var x: u128 = maxInt(u128);13 var x: u128 = maxInt(u128);
7 var y: i32 = 120;14 var y: i32 = 120;
8 var z = x >> @intCast(u7, y);15 var z = x >> @intCast(u7, y);
test/behavior/eval.zig+59-3
...@@ -17,6 +17,9 @@ fn unwrapAndAddOne(blah: ?i32) i32 {...@@ -17,6 +17,9 @@ fn unwrapAndAddOne(blah: ?i32) i32 {
17}17}
18const should_be_1235 = unwrapAndAddOne(1234);18const should_be_1235 = unwrapAndAddOne(1234);
19test "static add one" {19test "static add one" {
20 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
21 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
22
20 try expect(should_be_1235 == 1235);23 try expect(should_be_1235 == 1235);
21}24}
2225
...@@ -65,6 +68,9 @@ fn constExprEvalOnSingleExprBlocksFn(x: i32, b: bool) i32 {...@@ -65,6 +68,9 @@ fn constExprEvalOnSingleExprBlocksFn(x: i32, b: bool) i32 {
65}68}
6669
67test "constant expressions" {70test "constant expressions" {
71 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
72 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
73
68 var array: [array_size]u8 = undefined;74 var array: [array_size]u8 = undefined;
69 try expect(@sizeOf(@TypeOf(array)) == 20);75 try expect(@sizeOf(@TypeOf(array)) == 20);
70}76}
...@@ -83,6 +89,9 @@ fn letsTryToCompareBools(a: bool, b: bool) bool {...@@ -83,6 +89,9 @@ fn letsTryToCompareBools(a: bool, b: bool) bool {
83 return max(bool, a, b);89 return max(bool, a, b);
84}90}
85test "inlined block and runtime block phi" {91test "inlined block and runtime block phi" {
92 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
93 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
94
86 try expect(letsTryToCompareBools(true, true));95 try expect(letsTryToCompareBools(true, true));
87 try expect(letsTryToCompareBools(true, false));96 try expect(letsTryToCompareBools(true, false));
88 try expect(letsTryToCompareBools(false, true));97 try expect(letsTryToCompareBools(false, true));
...@@ -127,6 +136,10 @@ test "pointer to type" {...@@ -127,6 +136,10 @@ test "pointer to type" {
127}136}
128137
129test "a type constructed in a global expression" {138test "a type constructed in a global expression" {
139 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
140 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
141 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
142
130 var l: List = undefined;143 var l: List = undefined;
131 l.array[0] = 10;144 l.array[0] = 10;
132 l.array[1] = 11;145 l.array[1] = 11;
...@@ -220,6 +233,8 @@ const vertices = [_]Vertex{...@@ -220,6 +233,8 @@ const vertices = [_]Vertex{
220};233};
221234
222test "statically initialized list" {235test "statically initialized list" {
236 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
237
223 try expect(static_point_list[0].x == 1);238 try expect(static_point_list[0].x == 1);
224 try expect(static_point_list[0].y == 2);239 try expect(static_point_list[0].y == 2);
225 try expect(static_point_list[1].x == 3);240 try expect(static_point_list[1].x == 3);
...@@ -323,6 +338,9 @@ fn doesAlotT(comptime T: type, value: usize) T {...@@ -323,6 +338,9 @@ fn doesAlotT(comptime T: type, value: usize) T {
323}338}
324339
325test "@setEvalBranchQuota at same scope as generic function call" {340test "@setEvalBranchQuota at same scope as generic function call" {
341 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
342 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
343
326 try expect(doesAlotT(u32, 2) == 2);344 try expect(doesAlotT(u32, 2) == 2);
327}345}
328346
...@@ -371,6 +389,9 @@ test "return 0 from function that has u0 return type" {...@@ -371,6 +389,9 @@ test "return 0 from function that has u0 return type" {
371}389}
372390
373test "statically initialized struct" {391test "statically initialized struct" {
392 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
393 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
394
374 st_init_str_foo.x += 1;395 st_init_str_foo.x += 1;
375 try expect(st_init_str_foo.x == 14);396 try expect(st_init_str_foo.x == 14);
376}397}
...@@ -384,6 +405,8 @@ var st_init_str_foo = StInitStrFoo{...@@ -384,6 +405,8 @@ var st_init_str_foo = StInitStrFoo{
384};405};
385406
386test "inline for with same type but different values" {407test "inline for with same type but different values" {
408 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
409
387 var res: usize = 0;410 var res: usize = 0;
388 inline for ([_]type{ [2]u8, [1]u8, [2]u8 }) |T| {411 inline for ([_]type{ [2]u8, [1]u8, [2]u8 }) |T| {
389 var a: T = undefined;412 var a: T = undefined;
...@@ -416,7 +439,9 @@ fn copyWithPartialInline(s: []u32, b: []u8) void {...@@ -416,7 +439,9 @@ fn copyWithPartialInline(s: []u32, b: []u8) void {
416}439}
417440
418test "binary math operator in partially inlined function" {441test "binary math operator in partially inlined function" {
419 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;442 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
443 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
444 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
420445
421 var s: [4]u32 = undefined;446 var s: [4]u32 = undefined;
422 var b: [16]u8 = undefined;447 var b: [16]u8 = undefined;
...@@ -432,6 +457,12 @@ test "binary math operator in partially inlined function" {...@@ -432,6 +457,12 @@ test "binary math operator in partially inlined function" {
432}457}
433458
434test "comptime shl" {459test "comptime shl" {
460 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
461 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
462 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
463 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
464 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
465
435 var a: u128 = 3;466 var a: u128 = 3;
436 var b: u7 = 63;467 var b: u7 = 63;
437 var c: u128 = 3 << 63;468 var c: u128 = 3 << 63;
...@@ -456,6 +487,9 @@ test "comptime bitwise operators" {...@@ -456,6 +487,9 @@ test "comptime bitwise operators" {
456}487}
457488
458test "comptime shlWithOverflow" {489test "comptime shlWithOverflow" {
490 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
491 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
492
459 const ct_shifted: u64 = comptime amt: {493 const ct_shifted: u64 = comptime amt: {
460 var amt = @as(u64, 0);494 var amt = @as(u64, 0);
461 _ = @shlWithOverflow(u64, ~@as(u64, 0), 16, &amt);495 _ = @shlWithOverflow(u64, ~@as(u64, 0), 16, &amt);
...@@ -472,6 +506,9 @@ test "comptime shlWithOverflow" {...@@ -472,6 +506,9 @@ test "comptime shlWithOverflow" {
472}506}
473507
474test "const ptr to variable data changes at runtime" {508test "const ptr to variable data changes at runtime" {
509 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
510 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
511
475 try expect(foo_ref.name[0] == 'a');512 try expect(foo_ref.name[0] == 'a');
476 foo_ref.name = "b";513 foo_ref.name = "b";
477 try expect(foo_ref.name[0] == 'b');514 try expect(foo_ref.name[0] == 'b');
...@@ -485,6 +522,12 @@ var foo_contents = Foo{ .name = "a" };...@@ -485,6 +522,12 @@ var foo_contents = Foo{ .name = "a" };
485const foo_ref = &foo_contents;522const foo_ref = &foo_contents;
486523
487test "runtime 128 bit integer division" {524test "runtime 128 bit integer division" {
525 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
526 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
527 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
528 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
529 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
530
488 var a: u128 = 152313999999999991610955792383;531 var a: u128 = 152313999999999991610955792383;
489 var b: u128 = 10000000000000000000;532 var b: u128 = 10000000000000000000;
490 var c = a / b;533 var c = a / b;
...@@ -492,12 +535,17 @@ test "runtime 128 bit integer division" {...@@ -492,12 +535,17 @@ test "runtime 128 bit integer division" {
492}535}
493536
494test "@tagName of @typeInfo" {537test "@tagName of @typeInfo" {
538 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
539
495 const str = @tagName(@typeInfo(u8));540 const str = @tagName(@typeInfo(u8));
496 try expect(std.mem.eql(u8, str, "Int"));541 try expect(std.mem.eql(u8, str, "Int"));
497}542}
498543
499test "static eval list init" {544test "static eval list init" {
500 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO545 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
546 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
547 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
548 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
501549
502 try expect(static_vec3.data[2] == 1.0);550 try expect(static_vec3.data[2] == 1.0);
503 try expect(vec3(0.0, 0.0, 3.0).data[2] == 3.0);551 try expect(vec3(0.0, 0.0, 3.0).data[2] == 3.0);
...@@ -513,6 +561,8 @@ pub fn vec3(x: f32, y: f32, z: f32) Vec3 {...@@ -513,6 +561,8 @@ pub fn vec3(x: f32, y: f32, z: f32) Vec3 {
513}561}
514562
515test "inlined loop has array literal with elided runtime scope on first iteration but not second iteration" {563test "inlined loop has array literal with elided runtime scope on first iteration but not second iteration" {
564 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
565
516 var runtime = [1]i32{3};566 var runtime = [1]i32{3};
517 comptime var i: usize = 0;567 comptime var i: usize = 0;
518 inline while (i < 2) : (i += 1) {568 inline while (i < 2) : (i += 1) {
...@@ -548,6 +598,8 @@ const bound_fn = simple_struct.method;...@@ -548,6 +598,8 @@ const bound_fn = simple_struct.method;
548598
549test "ptr to local array argument at comptime" {599test "ptr to local array argument at comptime" {
550 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO600 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
601 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
602 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
551603
552 comptime {604 comptime {
553 var bytes: [10]u8 = undefined;605 var bytes: [10]u8 = undefined;
...@@ -583,6 +635,9 @@ fn testCompTimeUIntComparisons(x: u32) void {...@@ -583,6 +635,9 @@ fn testCompTimeUIntComparisons(x: u32) void {
583const hi1 = "hi";635const hi1 = "hi";
584const hi2 = hi1;636const hi2 = hi1;
585test "const global shares pointer with other same one" {637test "const global shares pointer with other same one" {
638 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
639 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
640
586 try assertEqualPtrs(&hi1[0], &hi2[0]);641 try assertEqualPtrs(&hi1[0], &hi2[0]);
587 comptime try expect(&hi1[0] == &hi2[0]);642 comptime try expect(&hi1[0] == &hi2[0]);
588}643}
...@@ -681,8 +736,6 @@ fn loopNTimes(comptime n: usize) void {...@@ -681,8 +736,6 @@ fn loopNTimes(comptime n: usize) void {
681}736}
682737
683test "variable inside inline loop that has different types on different iterations" {738test "variable inside inline loop that has different types on different iterations" {
684 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
685
686 try testVarInsideInlineLoop(.{ true, @as(u32, 42) });739 try testVarInsideInlineLoop(.{ true, @as(u32, 42) });
687}740}
688741
...@@ -742,6 +795,9 @@ test "comptime assign int to optional int" {...@@ -742,6 +795,9 @@ test "comptime assign int to optional int" {
742}795}
743796
744test "two comptime calls with array default initialized to undefined" {797test "two comptime calls with array default initialized to undefined" {
798 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
799 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
800
745 const S = struct {801 const S = struct {
746 const CrossTarget = struct {802 const CrossTarget = struct {
747 dynamic_linker: DynamicLinker = DynamicLinker{},803 dynamic_linker: DynamicLinker = DynamicLinker{},
test/behavior/int128.zig+20
...@@ -5,6 +5,11 @@ const minInt = std.math.minInt;...@@ -5,6 +5,11 @@ const minInt = std.math.minInt;
5const builtin = @import("builtin");5const builtin = @import("builtin");
66
7test "uint128" {7test "uint128" {
8 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
9 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
10 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
11 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
12
8 var buff: u128 = maxInt(u128);13 var buff: u128 = maxInt(u128);
9 try expect(buff == maxInt(u128));14 try expect(buff == maxInt(u128));
1015
...@@ -19,6 +24,11 @@ test "uint128" {...@@ -19,6 +24,11 @@ test "uint128" {
19}24}
2025
21test "undefined 128 bit int" {26test "undefined 128 bit int" {
27 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
28 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
29 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
30 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
31
22 @setRuntimeSafety(true);32 @setRuntimeSafety(true);
2333
24 // TODO implement @setRuntimeSafety in stage234 // TODO implement @setRuntimeSafety in stage2
...@@ -32,6 +42,11 @@ test "undefined 128 bit int" {...@@ -32,6 +42,11 @@ test "undefined 128 bit int" {
32}42}
3343
34test "int128" {44test "int128" {
45 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
46 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
47 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
48 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
49
35 var buff: i128 = -1;50 var buff: i128 = -1;
36 try expect(buff < 0 and (buff + 1) == 0);51 try expect(buff < 0 and (buff + 1) == 0);
37 try expect(@intCast(i8, buff) == @as(i8, -1));52 try expect(@intCast(i8, buff) == @as(i8, -1));
...@@ -44,6 +59,11 @@ test "int128" {...@@ -44,6 +59,11 @@ test "int128" {
44}59}
4560
46test "truncate int128" {61test "truncate int128" {
62 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
63 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
64 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
65 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
66
47 var buff: u128 = maxInt(u128);67 var buff: u128 = maxInt(u128);
48 try expect(@truncate(u64, buff) == maxInt(u64));68 try expect(@truncate(u64, buff) == maxInt(u64));
49}69}
test/behavior/maximum_minimum.zig+24-13
...@@ -3,26 +3,31 @@ const builtin = @import("builtin");...@@ -3,26 +3,31 @@ const builtin = @import("builtin");
3const mem = std.mem;3const mem = std.mem;
4const expect = std.testing.expect;4const expect = std.testing.expect;
5const expectEqual = std.testing.expectEqual;5const expectEqual = std.testing.expectEqual;
6const Vector = std.meta.Vector;
76
8test "@maximum" {7test "@maximum" {
8 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
9 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
10 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
11 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
12 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
13
9 const S = struct {14 const S = struct {
10 fn doTheTest() !void {15 fn doTheTest() !void {
11 try expect(@as(i32, 10) == @maximum(@as(i32, -3), @as(i32, 10)));16 try expect(@as(i32, 10) == @maximum(@as(i32, -3), @as(i32, 10)));
12 try expect(@as(f32, 3.2) == @maximum(@as(f32, 3.2), @as(f32, 0.68)));17 try expect(@as(f32, 3.2) == @maximum(@as(f32, 3.2), @as(f32, 0.68)));
1318
14 var a: Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };19 var a: @Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };
15 var b: Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };20 var b: @Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };
16 var x = @maximum(a, b);21 var x = @maximum(a, b);
17 try expect(mem.eql(i32, &@as([4]i32, x), &[4]i32{ 2147483647, 2147483647, 30, 40 }));22 try expect(mem.eql(i32, &@as([4]i32, x), &[4]i32{ 2147483647, 2147483647, 30, 40 }));
1823
19 var c: Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 };24 var c: @Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 };
20 var d: Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 };25 var d: @Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 };
21 var y = @maximum(c, d);26 var y = @maximum(c, d);
22 try expect(mem.eql(f32, &@as([4]f32, y), &[4]f32{ 0, 0.42, -0.64, 7.8 }));27 try expect(mem.eql(f32, &@as([4]f32, y), &[4]f32{ 0, 0.42, -0.64, 7.8 }));
2328
24 var e: Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 };29 var e: @Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 };
25 var f: Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 };30 var f: @Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 };
26 var z = @maximum(e, f);31 var z = @maximum(e, f);
27 try expect(mem.eql(f32, &@as([2]f32, z), &[2]f32{ 0, 0 }));32 try expect(mem.eql(f32, &@as([2]f32, z), &[2]f32{ 0, 0 }));
28 }33 }
...@@ -32,23 +37,29 @@ test "@maximum" {...@@ -32,23 +37,29 @@ test "@maximum" {
32}37}
3338
34test "@minimum" {39test "@minimum" {
40 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
41 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
42 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
43 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
44 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
45
35 const S = struct {46 const S = struct {
36 fn doTheTest() !void {47 fn doTheTest() !void {
37 try expect(@as(i32, -3) == @minimum(@as(i32, -3), @as(i32, 10)));48 try expect(@as(i32, -3) == @minimum(@as(i32, -3), @as(i32, 10)));
38 try expect(@as(f32, 0.68) == @minimum(@as(f32, 3.2), @as(f32, 0.68)));49 try expect(@as(f32, 0.68) == @minimum(@as(f32, 3.2), @as(f32, 0.68)));
3950
40 var a: Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };51 var a: @Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };
41 var b: Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };52 var b: @Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };
42 var x = @minimum(a, b);53 var x = @minimum(a, b);
43 try expect(mem.eql(i32, &@as([4]i32, x), &[4]i32{ 1, -2, 3, 4 }));54 try expect(mem.eql(i32, &@as([4]i32, x), &[4]i32{ 1, -2, 3, 4 }));
4455
45 var c: Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 };56 var c: @Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 };
46 var d: Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 };57 var d: @Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 };
47 var y = @minimum(c, d);58 var y = @minimum(c, d);
48 try expect(mem.eql(f32, &@as([4]f32, y), &[4]f32{ -0.23, 0.4, -2.4, 0.9 }));59 try expect(mem.eql(f32, &@as([4]f32, y), &[4]f32{ -0.23, 0.4, -2.4, 0.9 }));
4960
50 var e: Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 };61 var e: @Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 };
51 var f: Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 };62 var f: @Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 };
52 var z = @maximum(e, f);63 var z = @maximum(e, f);
53 try expect(mem.eql(f32, &@as([2]f32, z), &[2]f32{ 0, 0 }));64 try expect(mem.eql(f32, &@as([2]f32, z), &[2]f32{ 0, 0 }));
54 }65 }
test/behavior/popcount.zig+9
...@@ -4,6 +4,11 @@ const expect = std.testing.expect;...@@ -4,6 +4,11 @@ const expect = std.testing.expect;
4const expectEqual = std.testing.expectEqual;4const expectEqual = std.testing.expectEqual;
55
6test "@popCount integers" {6test "@popCount integers" {
7 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
8 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
9 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
10 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
11
7 comptime try testPopCountIntegers();12 comptime try testPopCountIntegers();
8 try testPopCountIntegers();13 try testPopCountIntegers();
9}14}
...@@ -51,6 +56,10 @@ fn testPopCountIntegers() !void {...@@ -51,6 +56,10 @@ fn testPopCountIntegers() !void {
5156
52test "@popCount vectors" {57test "@popCount vectors" {
53 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO58 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
59 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
60 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
61 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
62 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
5463
55 comptime try testPopCountVectors();64 comptime try testPopCountVectors();
56 try testPopCountVectors();65 try testPopCountVectors();
test/behavior/saturating_arithmetic.zig+38-2
...@@ -5,6 +5,12 @@ const maxInt = std.math.maxInt;...@@ -5,6 +5,12 @@ const maxInt = std.math.maxInt;
5const expect = std.testing.expect;5const expect = std.testing.expect;
66
7test "saturating add" {7test "saturating add" {
8 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
9 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
10 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
11 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
12 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
13
8 const S = struct {14 const S = struct {
9 fn doTheTest() !void {15 fn doTheTest() !void {
10 try testSatAdd(i8, -3, 10, 7);16 try testSatAdd(i8, -3, 10, 7);
...@@ -49,6 +55,12 @@ test "saturating add" {...@@ -49,6 +55,12 @@ test "saturating add" {
49}55}
5056
51test "saturating subtraction" {57test "saturating subtraction" {
58 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
59 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
60 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
61 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
62 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
63
52 const S = struct {64 const S = struct {
53 fn doTheTest() !void {65 fn doTheTest() !void {
54 try testSatSub(i8, -3, 10, -13);66 try testSatSub(i8, -3, 10, -13);
...@@ -92,8 +104,20 @@ test "saturating subtraction" {...@@ -92,8 +104,20 @@ test "saturating subtraction" {
92}104}
93105
94test "saturating multiplication" {106test "saturating multiplication" {
95 // TODO: once #9660 has been solved, remove this line107 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
96 if (builtin.cpu.arch == .wasm32) return error.SkipZigTest;108 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
109 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
110 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
111 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
112
113 if (builtin.zig_backend == .stage1 and builtin.cpu.arch == .wasm32) {
114 // https://github.com/ziglang/zig/issues/9660
115 return error.SkipZigTest;
116 }
117 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .wasm32) {
118 // https://github.com/ziglang/zig/issues/9660
119 return error.SkipZigTest;
120 }
97121
98 const S = struct {122 const S = struct {
99 fn doTheTest() !void {123 fn doTheTest() !void {
...@@ -129,6 +153,12 @@ test "saturating multiplication" {...@@ -129,6 +153,12 @@ test "saturating multiplication" {
129}153}
130154
131test "saturating shift-left" {155test "saturating shift-left" {
156 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
157 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
158 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
159 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
160 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
161
132 const S = struct {162 const S = struct {
133 fn doTheTest() !void {163 fn doTheTest() !void {
134 try testSatShl(i8, 1, 2, 4);164 try testSatShl(i8, 1, 2, 4);
...@@ -163,6 +193,12 @@ test "saturating shift-left" {...@@ -163,6 +193,12 @@ test "saturating shift-left" {
163}193}
164194
165test "saturating shl uses the LHS type" {195test "saturating shl uses the LHS type" {
196 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
197 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
198 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
199 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
200 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
201
166 const lhs_const: u8 = 1;202 const lhs_const: u8 = 1;
167 var lhs_var: u8 = 1;203 var lhs_var: u8 = 1;
168204
test/behavior/shuffle.zig+31-13
...@@ -2,13 +2,18 @@ const std = @import("std");...@@ -2,13 +2,18 @@ const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const mem = std.mem;3const mem = std.mem;
4const expect = std.testing.expect;4const expect = std.testing.expect;
5const Vector = std.meta.Vector;
65
7test "@shuffle int" {6test "@shuffle int" {
7 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
8 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
9 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
10 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
11 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
12
8 const S = struct {13 const S = struct {
9 fn doTheTest() !void {14 fn doTheTest() !void {
10 var v: Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };15 var v: @Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };
11 var x: Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };16 var x: @Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };
12 const mask = [4]i32{ 0, ~@as(i32, 2), 3, ~@as(i32, 3) };17 const mask = [4]i32{ 0, ~@as(i32, 2), 3, ~@as(i32, 3) };
13 var res = @shuffle(i32, v, x, mask);18 var res = @shuffle(i32, v, x, mask);
14 try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 2147483647, 3, 40, 4 }));19 try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 2147483647, 3, 40, 4 }));
...@@ -23,13 +28,13 @@ test "@shuffle int" {...@@ -23,13 +28,13 @@ test "@shuffle int" {
23 try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 40, -2, 30, 2147483647 }));28 try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 40, -2, 30, 2147483647 }));
2429
25 // Upcasting of b30 // Upcasting of b
26 var v2: Vector(2, i32) = [2]i32{ 2147483647, undefined };31 var v2: @Vector(2, i32) = [2]i32{ 2147483647, undefined };
27 const mask3 = [4]i32{ ~@as(i32, 0), 2, ~@as(i32, 0), 3 };32 const mask3 = [4]i32{ ~@as(i32, 0), 2, ~@as(i32, 0), 3 };
28 res = @shuffle(i32, x, v2, mask3);33 res = @shuffle(i32, x, v2, mask3);
29 try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 2147483647, 3, 2147483647, 4 }));34 try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 2147483647, 3, 2147483647, 4 }));
3035
31 // Upcasting of a36 // Upcasting of a
32 var v3: Vector(2, i32) = [2]i32{ 2147483647, -2 };37 var v3: @Vector(2, i32) = [2]i32{ 2147483647, -2 };
33 const mask4 = [4]i32{ 0, ~@as(i32, 2), 1, ~@as(i32, 3) };38 const mask4 = [4]i32{ 0, ~@as(i32, 2), 1, ~@as(i32, 3) };
34 res = @shuffle(i32, v3, x, mask4);39 res = @shuffle(i32, v3, x, mask4);
35 try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 2147483647, 3, -2, 4 }));40 try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 2147483647, 3, -2, 4 }));
...@@ -40,10 +45,16 @@ test "@shuffle int" {...@@ -40,10 +45,16 @@ test "@shuffle int" {
40}45}
4146
42test "@shuffle bool" {47test "@shuffle bool" {
48 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
49 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
50 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
51 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
52 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
53
43 const S = struct {54 const S = struct {
44 fn doTheTest() !void {55 fn doTheTest() !void {
45 var x: Vector(4, bool) = [4]bool{ false, true, false, true };56 var x: @Vector(4, bool) = [4]bool{ false, true, false, true };
46 var v: Vector(2, bool) = [2]bool{ true, false };57 var v: @Vector(2, bool) = [2]bool{ true, false };
47 const mask = [4]i32{ 0, ~@as(i32, 1), 1, 2 };58 const mask = [4]i32{ 0, ~@as(i32, 1), 1, 2 };
48 var res = @shuffle(bool, x, v, mask);59 var res = @shuffle(bool, x, v, mask);
49 try expect(mem.eql(bool, &@as([4]bool, res), &[4]bool{ false, false, true, false }));60 try expect(mem.eql(bool, &@as([4]bool, res), &[4]bool{ false, false, true, false }));
...@@ -54,15 +65,22 @@ test "@shuffle bool" {...@@ -54,15 +65,22 @@ test "@shuffle bool" {
54}65}
5566
56test "@shuffle bool" {67test "@shuffle bool" {
57 // TODO re-enable when LLVM codegen is fixed68 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
58 // https://github.com/ziglang/zig/issues/324669 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
59 if (true) return error.SkipZigTest;70 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
71 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
72 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
73
74 if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) {
75 // https://github.com/ziglang/zig/issues/3246
76 return error.SkipZigTest;
77 }
6078
61 const S = struct {79 const S = struct {
62 fn doTheTest() !void {80 fn doTheTest() !void {
63 var x: Vector(3, bool) = [3]bool{ false, true, false };81 var x: @Vector(3, bool) = [3]bool{ false, true, false };
64 var v: Vector(2, bool) = [2]bool{ true, false };82 var v: @Vector(2, bool) = [2]bool{ true, false };
65 const mask: Vector(4, i32) = [4]i32{ 0, ~@as(i32, 1), 1, 2 };83 const mask: @Vector(4, i32) = [4]i32{ 0, ~@as(i32, 1), 1, 2 };
66 var res = @shuffle(bool, x, v, mask);84 var res = @shuffle(bool, x, v, mask);
67 try expect(mem.eql(bool, &@as([4]bool, res), &[4]bool{ false, false, true, false }));85 try expect(mem.eql(bool, &@as([4]bool, res), &[4]bool{ false, false, true, false }));
68 }86 }
test/behavior/translate_c_macros.zig+14
...@@ -30,6 +30,8 @@ test "initializer list expression" {...@@ -30,6 +30,8 @@ test "initializer list expression" {
30}30}
3131
32test "sizeof in macros" {32test "sizeof in macros" {
33 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
34
33 try expect(@as(c_int, @sizeOf(u32)) == h.MY_SIZEOF(u32));35 try expect(@as(c_int, @sizeOf(u32)) == h.MY_SIZEOF(u32));
34 try expect(@as(c_int, @sizeOf(u32)) == h.MY_SIZEOF2(u32));36 try expect(@as(c_int, @sizeOf(u32)) == h.MY_SIZEOF2(u32));
35}37}
...@@ -39,13 +41,21 @@ test "reference to a struct type" {...@@ -39,13 +41,21 @@ test "reference to a struct type" {
39}41}
4042
41test "cast negative integer to pointer" {43test "cast negative integer to pointer" {
44 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
45 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
42 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO46 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
47 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
48 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
4349
44 try expectEqual(@intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))), h.MAP_FAILED);50 try expectEqual(@intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))), h.MAP_FAILED);
45}51}
4652
47test "casting to union with a macro" {53test "casting to union with a macro" {
54 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
55 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
48 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO56 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
57 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
58 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
4959
50 const l: c_long = 42;60 const l: c_long = 42;
51 const d: f64 = 2.0;61 const d: f64 = 2.0;
...@@ -58,7 +68,11 @@ test "casting to union with a macro" {...@@ -58,7 +68,11 @@ test "casting to union with a macro" {
58}68}
5969
60test "nested comma operator" {70test "nested comma operator" {
71 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
72 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
61 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO73 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
74 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
75 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
6276
63 try expectEqual(@as(c_int, 3), h.NESTED_COMMA_OPERATOR);77 try expectEqual(@as(c_int, 3), h.NESTED_COMMA_OPERATOR);
64}78}
test/behavior/union_with_members.zig+4
...@@ -17,7 +17,11 @@ const ET = union(enum) {...@@ -17,7 +17,11 @@ const ET = union(enum) {
17};17};
1818
19test "enum with members" {19test "enum with members" {
20 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
21 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
20 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO22 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
23 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
24 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
2125
22 const a = ET{ .SINT = -42 };26 const a = ET{ .SINT = -42 };
23 const b = ET{ .UINT = 42 };27 const b = ET{ .UINT = 42 };
test/behavior/widening.zig+27
...@@ -5,6 +5,12 @@ const builtin = @import("builtin");...@@ -5,6 +5,12 @@ const builtin = @import("builtin");
5const has_f80_rt = @import("builtin").cpu.arch == .x86_64;5const has_f80_rt = @import("builtin").cpu.arch == .x86_64;
66
7test "integer widening" {7test "integer widening" {
8 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
9 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
10 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
11 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
12 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
13
8 var a: u8 = 250;14 var a: u8 = 250;
9 var b: u16 = a;15 var b: u16 = a;
10 var c: u32 = b;16 var c: u32 = b;
...@@ -15,12 +21,24 @@ test "integer widening" {...@@ -15,12 +21,24 @@ test "integer widening" {
15}21}
1622
17test "implicit unsigned integer to signed integer" {23test "implicit unsigned integer to signed integer" {
24 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
25 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
26 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
27 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
28 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
29
18 var a: u8 = 250;30 var a: u8 = 250;
19 var b: i16 = a;31 var b: i16 = a;
20 try expect(b == 250);32 try expect(b == 250);
21}33}
2234
23test "float widening" {35test "float widening" {
36 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
37 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
38 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
39 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
40 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
41
24 var a: f16 = 12.34;42 var a: f16 = 12.34;
25 var b: f32 = a;43 var b: f32 = a;
26 var c: f64 = b;44 var c: f64 = b;
...@@ -35,6 +53,12 @@ test "float widening" {...@@ -35,6 +53,12 @@ test "float widening" {
35}53}
3654
37test "float widening f16 to f128" {55test "float widening f16 to f128" {
56 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
57 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
58 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
59 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
60 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
61
38 // TODO https://github.com/ziglang/zig/issues/328262 // TODO https://github.com/ziglang/zig/issues/3282
39 if (builtin.cpu.arch == .aarch64) return error.SkipZigTest;63 if (builtin.cpu.arch == .aarch64) return error.SkipZigTest;
40 if (builtin.cpu.arch == .powerpc64le) return error.SkipZigTest;64 if (builtin.cpu.arch == .powerpc64le) return error.SkipZigTest;
...@@ -45,6 +69,9 @@ test "float widening f16 to f128" {...@@ -45,6 +69,9 @@ test "float widening f16 to f128" {
45}69}
4670
47test "cast small unsigned to larger signed" {71test "cast small unsigned to larger signed" {
72 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
73 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
74
48 try expect(castSmallUnsignedToLargerSigned1(200) == @as(i16, 200));75 try expect(castSmallUnsignedToLargerSigned1(200) == @as(i16, 200));
49 try expect(castSmallUnsignedToLargerSigned2(9999) == @as(i64, 9999));76 try expect(castSmallUnsignedToLargerSigned2(9999) == @as(i64, 9999));
50}77}