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.
This commit is contained in:
@@ -13,6 +13,7 @@ test {
|
||||
_ = @import("behavior/byval_arg_var.zig");
|
||||
_ = @import("behavior/bool.zig");
|
||||
_ = @import("behavior/bugs/394.zig");
|
||||
_ = @import("behavior/bugs/421.zig");
|
||||
_ = @import("behavior/bugs/624.zig");
|
||||
_ = @import("behavior/bugs/655.zig");
|
||||
_ = @import("behavior/bugs/656.zig");
|
||||
@@ -34,8 +35,10 @@ test {
|
||||
_ = @import("behavior/bugs/1607.zig");
|
||||
_ = @import("behavior/bugs/1735.zig");
|
||||
_ = @import("behavior/bugs/1741.zig");
|
||||
_ = @import("behavior/bugs/1851.zig");
|
||||
_ = @import("behavior/bugs/1914.zig");
|
||||
_ = @import("behavior/bugs/2006.zig");
|
||||
_ = @import("behavior/bugs/2114.zig");
|
||||
_ = @import("behavior/bugs/2346.zig");
|
||||
_ = @import("behavior/bugs/2578.zig");
|
||||
_ = @import("behavior/bugs/2692.zig");
|
||||
@@ -47,6 +50,7 @@ test {
|
||||
_ = @import("behavior/bugs/3384.zig");
|
||||
_ = @import("behavior/bugs/3586.zig");
|
||||
_ = @import("behavior/bugs/3742.zig");
|
||||
_ = @import("behavior/bugs/3779.zig");
|
||||
_ = @import("behavior/bugs/4328.zig");
|
||||
_ = @import("behavior/bugs/4560.zig");
|
||||
_ = @import("behavior/bugs/4769_a.zig");
|
||||
@@ -61,9 +65,11 @@ test {
|
||||
_ = @import("behavior/bugs/7003.zig");
|
||||
_ = @import("behavior/bugs/7047.zig");
|
||||
_ = @import("behavior/bugs/7250.zig");
|
||||
_ = @import("behavior/bugs/11100.zig");
|
||||
_ = @import("behavior/bugs/9584.zig");
|
||||
_ = @import("behavior/bugs/10147.zig");
|
||||
_ = @import("behavior/bugs/10970.zig");
|
||||
_ = @import("behavior/bugs/11046.zig");
|
||||
_ = @import("behavior/bugs/11100.zig");
|
||||
_ = @import("behavior/bugs/11139.zig");
|
||||
_ = @import("behavior/bugs/11159.zig");
|
||||
_ = @import("behavior/bugs/11162.zig");
|
||||
@@ -73,11 +79,13 @@ test {
|
||||
_ = @import("behavior/bugs/11213.zig");
|
||||
_ = @import("behavior/call.zig");
|
||||
_ = @import("behavior/cast.zig");
|
||||
_ = @import("behavior/cast_int.zig");
|
||||
_ = @import("behavior/comptime_memory.zig");
|
||||
_ = @import("behavior/const_slice_child.zig");
|
||||
_ = @import("behavior/defer.zig");
|
||||
_ = @import("behavior/enum.zig");
|
||||
_ = @import("behavior/error.zig");
|
||||
_ = @import("behavior/eval.zig");
|
||||
_ = @import("behavior/field_parent_ptr.zig");
|
||||
_ = @import("behavior/floatop.zig");
|
||||
_ = @import("behavior/fn_delegation.zig");
|
||||
@@ -90,10 +98,12 @@ test {
|
||||
_ = @import("behavior/if.zig");
|
||||
_ = @import("behavior/import.zig");
|
||||
_ = @import("behavior/incomplete_struct_param_tld.zig");
|
||||
_ = @import("behavior/int128.zig");
|
||||
_ = @import("behavior/int_div.zig");
|
||||
_ = @import("behavior/inttoptr.zig");
|
||||
_ = @import("behavior/ir_block_deps.zig");
|
||||
_ = @import("behavior/math.zig");
|
||||
_ = @import("behavior/maximum_minimum.zig");
|
||||
_ = @import("behavior/member_func.zig");
|
||||
_ = @import("behavior/merge_error_sets.zig");
|
||||
_ = @import("behavior/muladd.zig");
|
||||
@@ -101,21 +111,25 @@ test {
|
||||
_ = @import("behavior/null.zig");
|
||||
_ = @import("behavior/optional.zig");
|
||||
_ = @import("behavior/pointers.zig");
|
||||
_ = @import("behavior/popcount.zig");
|
||||
_ = @import("behavior/prefetch.zig");
|
||||
_ = @import("behavior/ptrcast.zig");
|
||||
_ = @import("behavior/pub_enum.zig");
|
||||
_ = @import("behavior/ref_var_in_if_after_if_2nd_switch_prong.zig");
|
||||
_ = @import("behavior/reflection.zig");
|
||||
_ = @import("behavior/saturating_arithmetic.zig");
|
||||
_ = @import("behavior/shuffle.zig");
|
||||
_ = @import("behavior/sizeof_and_typeof.zig");
|
||||
_ = @import("behavior/slice_sentinel_comptime.zig");
|
||||
_ = @import("behavior/slice.zig");
|
||||
_ = @import("behavior/slice_sentinel_comptime.zig");
|
||||
_ = @import("behavior/src.zig");
|
||||
_ = @import("behavior/struct_contains_null_ptr_itself.zig");
|
||||
_ = @import("behavior/struct.zig");
|
||||
_ = @import("behavior/struct_contains_null_ptr_itself.zig");
|
||||
_ = @import("behavior/switch.zig");
|
||||
_ = @import("behavior/switch_prong_err_enum.zig");
|
||||
_ = @import("behavior/switch_prong_implicit_cast.zig");
|
||||
_ = @import("behavior/switch.zig");
|
||||
_ = @import("behavior/this.zig");
|
||||
_ = @import("behavior/translate_c_macros.zig");
|
||||
_ = @import("behavior/truncate.zig");
|
||||
_ = @import("behavior/try.zig");
|
||||
_ = @import("behavior/tuple.zig");
|
||||
@@ -125,11 +139,13 @@ test {
|
||||
_ = @import("behavior/undefined.zig");
|
||||
_ = @import("behavior/underscore.zig");
|
||||
_ = @import("behavior/union.zig");
|
||||
_ = @import("behavior/union_with_members.zig");
|
||||
_ = @import("behavior/usingnamespace.zig");
|
||||
_ = @import("behavior/var_args.zig");
|
||||
_ = @import("behavior/vector.zig");
|
||||
_ = @import("behavior/void.zig");
|
||||
_ = @import("behavior/while.zig");
|
||||
_ = @import("behavior/widening.zig");
|
||||
|
||||
if (builtin.stage2_arch == .wasm32) {
|
||||
_ = @import("behavior/wasm.zig");
|
||||
@@ -142,46 +158,26 @@ test {
|
||||
if (builtin.zig_backend != .stage2_arm and
|
||||
builtin.zig_backend != .stage2_x86_64 and
|
||||
builtin.zig_backend != .stage2_aarch64 and
|
||||
builtin.zig_backend != .stage2_wasm)
|
||||
builtin.zig_backend != .stage2_wasm and
|
||||
builtin.zig_backend != .stage2_c)
|
||||
{
|
||||
// Tests that pass for stage1, llvm backend, C backend
|
||||
_ = @import("behavior/bugs/421.zig");
|
||||
_ = @import("behavior/bugs/3779.zig");
|
||||
_ = @import("behavior/bugs/9584.zig");
|
||||
_ = @import("behavior/cast_int.zig");
|
||||
_ = @import("behavior/eval.zig");
|
||||
_ = @import("behavior/export.zig");
|
||||
_ = @import("behavior/export_self_referential_type_info.zig");
|
||||
_ = @import("behavior/int128.zig");
|
||||
_ = @import("behavior/popcount.zig");
|
||||
_ = @import("behavior/translate_c_macros.zig");
|
||||
_ = @import("behavior/union_with_members.zig");
|
||||
}
|
||||
|
||||
if (builtin.zig_backend != .stage2_c) {
|
||||
// Tests that pass for stage1 and the llvm backend.
|
||||
_ = @import("behavior/export.zig");
|
||||
_ = @import("behavior/maximum_minimum.zig");
|
||||
_ = @import("behavior/saturating_arithmetic.zig");
|
||||
_ = @import("behavior/widening.zig");
|
||||
_ = @import("behavior/bugs/2114.zig");
|
||||
_ = @import("behavior/bugs/10147.zig");
|
||||
_ = @import("behavior/shuffle.zig");
|
||||
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// Tests that only pass for the stage1 backend.
|
||||
if (builtin.os.tag != .wasi) {
|
||||
_ = @import("behavior/asm.zig");
|
||||
_ = @import("behavior/async_fn.zig");
|
||||
}
|
||||
_ = @import("behavior/await_struct.zig");
|
||||
_ = @import("behavior/bugs/529.zig");
|
||||
_ = @import("behavior/bugs/920.zig");
|
||||
_ = @import("behavior/bugs/1120.zig");
|
||||
_ = @import("behavior/bugs/1851.zig");
|
||||
_ = @import("behavior/bugs/6781.zig");
|
||||
_ = @import("behavior/bugs/7027.zig");
|
||||
_ = @import("behavior/select.zig");
|
||||
_ = @import("behavior/struct_contains_slice_of_itself.zig");
|
||||
}
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// TODO get these tests passing with stage2
|
||||
if (builtin.os.tag != .wasi) {
|
||||
_ = @import("behavior/asm.zig");
|
||||
_ = @import("behavior/async_fn.zig");
|
||||
}
|
||||
_ = @import("behavior/await_struct.zig");
|
||||
_ = @import("behavior/bugs/529.zig");
|
||||
_ = @import("behavior/bugs/920.zig");
|
||||
_ = @import("behavior/bugs/1120.zig");
|
||||
_ = @import("behavior/bugs/6781.zig");
|
||||
_ = @import("behavior/bugs/7027.zig");
|
||||
_ = @import("behavior/select.zig");
|
||||
_ = @import("behavior/struct_contains_slice_of_itself.zig");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
const builtin = @import("builtin");
|
||||
const std = @import("std");
|
||||
|
||||
test "uses correct LLVM builtin" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
var x: u32 = 0x1;
|
||||
var y: @Vector(4, u32) = [_]u32{ 0x1, 0x1, 0x1, 0x1 };
|
||||
// The stage1 compiler used to call the same builtin function for both
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
const builtin = @import("builtin");
|
||||
const std = @import("std");
|
||||
const expect = std.testing.expect;
|
||||
|
||||
test "allocation and looping over 3-byte integer" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .macos) {
|
||||
return error.SkipZigTest; // TODO
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .wasm32) {
|
||||
return error.SkipZigTest; // TODO
|
||||
}
|
||||
|
||||
try expect(@sizeOf(u24) == 4);
|
||||
try expect(@sizeOf([1]u24) == 4);
|
||||
try expect(@alignOf(u24) == 4);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
const builtin = @import("builtin");
|
||||
const std = @import("std");
|
||||
const expect = std.testing.expect;
|
||||
const math = std.math;
|
||||
@@ -7,6 +8,12 @@ fn ctz(x: anytype) usize {
|
||||
}
|
||||
|
||||
test "fixed" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
try testCtz();
|
||||
comptime try testCtz();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ const ptr_tag_name: [*:0]const u8 = tag_name;
|
||||
|
||||
test "@tagName() returns a string literal" {
|
||||
if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
try std.testing.expect(*const [13:0]u8 == @TypeOf(tag_name));
|
||||
try std.testing.expect(std.mem.eql(u8, "TestEnumValue", tag_name));
|
||||
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;
|
||||
|
||||
test "@errorName() returns a string literal" {
|
||||
if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
try std.testing.expect(*const [13:0]u8 == @TypeOf(error_name));
|
||||
try std.testing.expect(std.mem.eql(u8, "TestErrorCode", error_name));
|
||||
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;
|
||||
|
||||
test "@typeName() returns a string literal" {
|
||||
if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
try std.testing.expect(*const [type_name.len:0]u8 == @TypeOf(type_name));
|
||||
try std.testing.expect(std.mem.eql(u8, "behavior.bugs.3779.TestType", type_name));
|
||||
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;
|
||||
const expected_contents = "hello zig\n";
|
||||
|
||||
test "@embedFile() returns a string literal" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
try std.testing.expect(*const [expected_contents.len:0]u8 == @TypeOf(actual_contents));
|
||||
try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents));
|
||||
try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents));
|
||||
@@ -50,6 +62,9 @@ fn testFnForSrc() std.builtin.SourceLocation {
|
||||
}
|
||||
|
||||
test "@src() returns a struct containing 0-terminated string slices" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const src = testFnForSrc();
|
||||
try std.testing.expect([:0]const u8 == @TypeOf(src.file));
|
||||
try std.testing.expect(std.mem.endsWith(u8, src.file, "3779.zig"));
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
const builtin = @import("builtin");
|
||||
const expect = @import("std").testing.expect;
|
||||
|
||||
test "bitCast to array" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
comptime try testBitCastArray();
|
||||
try testBitCastArray();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
const builtin = @import("builtin");
|
||||
const std = @import("std");
|
||||
|
||||
const A = packed struct {
|
||||
@@ -41,7 +42,13 @@ pub fn b(x: *X) !void {
|
||||
try a(0, 1, 2, 3, 4, x.x.a, x.x.b);
|
||||
}
|
||||
|
||||
test "bug 9584" {
|
||||
test {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
var flags = A{
|
||||
.a = false,
|
||||
.b = true,
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
const builtin = @import("builtin");
|
||||
const std = @import("std");
|
||||
const expect = std.testing.expect;
|
||||
const maxInt = std.math.maxInt;
|
||||
|
||||
test "@intCast i32 to u7" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
var x: u128 = maxInt(u128);
|
||||
var y: i32 = 120;
|
||||
var z = x >> @intCast(u7, y);
|
||||
|
||||
@@ -17,6 +17,9 @@ fn unwrapAndAddOne(blah: ?i32) i32 {
|
||||
}
|
||||
const should_be_1235 = unwrapAndAddOne(1234);
|
||||
test "static add one" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
try expect(should_be_1235 == 1235);
|
||||
}
|
||||
|
||||
@@ -65,6 +68,9 @@ fn constExprEvalOnSingleExprBlocksFn(x: i32, b: bool) i32 {
|
||||
}
|
||||
|
||||
test "constant expressions" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
var array: [array_size]u8 = undefined;
|
||||
try expect(@sizeOf(@TypeOf(array)) == 20);
|
||||
}
|
||||
@@ -83,6 +89,9 @@ fn letsTryToCompareBools(a: bool, b: bool) bool {
|
||||
return max(bool, a, b);
|
||||
}
|
||||
test "inlined block and runtime block phi" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try expect(letsTryToCompareBools(true, true));
|
||||
try expect(letsTryToCompareBools(true, false));
|
||||
try expect(letsTryToCompareBools(false, true));
|
||||
@@ -127,6 +136,10 @@ test "pointer to type" {
|
||||
}
|
||||
|
||||
test "a type constructed in a global expression" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
var l: List = undefined;
|
||||
l.array[0] = 10;
|
||||
l.array[1] = 11;
|
||||
@@ -220,6 +233,8 @@ const vertices = [_]Vertex{
|
||||
};
|
||||
|
||||
test "statically initialized list" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try expect(static_point_list[0].x == 1);
|
||||
try expect(static_point_list[0].y == 2);
|
||||
try expect(static_point_list[1].x == 3);
|
||||
@@ -323,6 +338,9 @@ fn doesAlotT(comptime T: type, value: usize) T {
|
||||
}
|
||||
|
||||
test "@setEvalBranchQuota at same scope as generic function call" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try expect(doesAlotT(u32, 2) == 2);
|
||||
}
|
||||
|
||||
@@ -371,6 +389,9 @@ test "return 0 from function that has u0 return type" {
|
||||
}
|
||||
|
||||
test "statically initialized struct" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
st_init_str_foo.x += 1;
|
||||
try expect(st_init_str_foo.x == 14);
|
||||
}
|
||||
@@ -384,6 +405,8 @@ var st_init_str_foo = StInitStrFoo{
|
||||
};
|
||||
|
||||
test "inline for with same type but different values" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
var res: usize = 0;
|
||||
inline for ([_]type{ [2]u8, [1]u8, [2]u8 }) |T| {
|
||||
var a: T = undefined;
|
||||
@@ -416,7 +439,9 @@ fn copyWithPartialInline(s: []u32, b: []u8) void {
|
||||
}
|
||||
|
||||
test "binary math operator in partially inlined function" {
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
var s: [4]u32 = undefined;
|
||||
var b: [16]u8 = undefined;
|
||||
@@ -432,6 +457,12 @@ test "binary math operator in partially inlined function" {
|
||||
}
|
||||
|
||||
test "comptime shl" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
var a: u128 = 3;
|
||||
var b: u7 = 63;
|
||||
var c: u128 = 3 << 63;
|
||||
@@ -456,6 +487,9 @@ test "comptime bitwise operators" {
|
||||
}
|
||||
|
||||
test "comptime shlWithOverflow" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const ct_shifted: u64 = comptime amt: {
|
||||
var amt = @as(u64, 0);
|
||||
_ = @shlWithOverflow(u64, ~@as(u64, 0), 16, &amt);
|
||||
@@ -472,6 +506,9 @@ test "comptime shlWithOverflow" {
|
||||
}
|
||||
|
||||
test "const ptr to variable data changes at runtime" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try expect(foo_ref.name[0] == 'a');
|
||||
foo_ref.name = "b";
|
||||
try expect(foo_ref.name[0] == 'b');
|
||||
@@ -485,6 +522,12 @@ var foo_contents = Foo{ .name = "a" };
|
||||
const foo_ref = &foo_contents;
|
||||
|
||||
test "runtime 128 bit integer division" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
var a: u128 = 152313999999999991610955792383;
|
||||
var b: u128 = 10000000000000000000;
|
||||
var c = a / b;
|
||||
@@ -492,12 +535,17 @@ test "runtime 128 bit integer division" {
|
||||
}
|
||||
|
||||
test "@tagName of @typeInfo" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const str = @tagName(@typeInfo(u8));
|
||||
try expect(std.mem.eql(u8, str, "Int"));
|
||||
}
|
||||
|
||||
test "static eval list init" {
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
try expect(static_vec3.data[2] == 1.0);
|
||||
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 {
|
||||
}
|
||||
|
||||
test "inlined loop has array literal with elided runtime scope on first iteration but not second iteration" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
var runtime = [1]i32{3};
|
||||
comptime var i: usize = 0;
|
||||
inline while (i < 2) : (i += 1) {
|
||||
@@ -548,6 +598,8 @@ const bound_fn = simple_struct.method;
|
||||
|
||||
test "ptr to local array argument at comptime" {
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
comptime {
|
||||
var bytes: [10]u8 = undefined;
|
||||
@@ -583,6 +635,9 @@ fn testCompTimeUIntComparisons(x: u32) void {
|
||||
const hi1 = "hi";
|
||||
const hi2 = hi1;
|
||||
test "const global shares pointer with other same one" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try assertEqualPtrs(&hi1[0], &hi2[0]);
|
||||
comptime try expect(&hi1[0] == &hi2[0]);
|
||||
}
|
||||
@@ -681,8 +736,6 @@ fn loopNTimes(comptime n: usize) void {
|
||||
}
|
||||
|
||||
test "variable inside inline loop that has different types on different iterations" {
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
try testVarInsideInlineLoop(.{ true, @as(u32, 42) });
|
||||
}
|
||||
|
||||
@@ -742,6 +795,9 @@ test "comptime assign int to optional int" {
|
||||
}
|
||||
|
||||
test "two comptime calls with array default initialized to undefined" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
const CrossTarget = struct {
|
||||
dynamic_linker: DynamicLinker = DynamicLinker{},
|
||||
|
||||
@@ -5,6 +5,11 @@ const minInt = std.math.minInt;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
test "uint128" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
var buff: u128 = maxInt(u128);
|
||||
try expect(buff == maxInt(u128));
|
||||
|
||||
@@ -19,6 +24,11 @@ test "uint128" {
|
||||
}
|
||||
|
||||
test "undefined 128 bit int" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
@setRuntimeSafety(true);
|
||||
|
||||
// TODO implement @setRuntimeSafety in stage2
|
||||
@@ -32,6 +42,11 @@ test "undefined 128 bit int" {
|
||||
}
|
||||
|
||||
test "int128" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
var buff: i128 = -1;
|
||||
try expect(buff < 0 and (buff + 1) == 0);
|
||||
try expect(@intCast(i8, buff) == @as(i8, -1));
|
||||
@@ -44,6 +59,11 @@ test "int128" {
|
||||
}
|
||||
|
||||
test "truncate int128" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
var buff: u128 = maxInt(u128);
|
||||
try expect(@truncate(u64, buff) == maxInt(u64));
|
||||
}
|
||||
|
||||
@@ -3,26 +3,31 @@ const builtin = @import("builtin");
|
||||
const mem = std.mem;
|
||||
const expect = std.testing.expect;
|
||||
const expectEqual = std.testing.expectEqual;
|
||||
const Vector = std.meta.Vector;
|
||||
|
||||
test "@maximum" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
try expect(@as(i32, 10) == @maximum(@as(i32, -3), @as(i32, 10)));
|
||||
try expect(@as(f32, 3.2) == @maximum(@as(f32, 3.2), @as(f32, 0.68)));
|
||||
|
||||
var a: Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };
|
||||
var b: Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };
|
||||
var a: @Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };
|
||||
var b: @Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };
|
||||
var x = @maximum(a, b);
|
||||
try expect(mem.eql(i32, &@as([4]i32, x), &[4]i32{ 2147483647, 2147483647, 30, 40 }));
|
||||
|
||||
var c: Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 };
|
||||
var d: Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 };
|
||||
var c: @Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 };
|
||||
var d: @Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 };
|
||||
var y = @maximum(c, d);
|
||||
try expect(mem.eql(f32, &@as([4]f32, y), &[4]f32{ 0, 0.42, -0.64, 7.8 }));
|
||||
|
||||
var e: Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 };
|
||||
var f: Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 };
|
||||
var e: @Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 };
|
||||
var f: @Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 };
|
||||
var z = @maximum(e, f);
|
||||
try expect(mem.eql(f32, &@as([2]f32, z), &[2]f32{ 0, 0 }));
|
||||
}
|
||||
@@ -32,23 +37,29 @@ test "@maximum" {
|
||||
}
|
||||
|
||||
test "@minimum" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
try expect(@as(i32, -3) == @minimum(@as(i32, -3), @as(i32, 10)));
|
||||
try expect(@as(f32, 0.68) == @minimum(@as(f32, 3.2), @as(f32, 0.68)));
|
||||
|
||||
var a: Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };
|
||||
var b: Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };
|
||||
var a: @Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };
|
||||
var b: @Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };
|
||||
var x = @minimum(a, b);
|
||||
try expect(mem.eql(i32, &@as([4]i32, x), &[4]i32{ 1, -2, 3, 4 }));
|
||||
|
||||
var c: Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 };
|
||||
var d: Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 };
|
||||
var c: @Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 };
|
||||
var d: @Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 };
|
||||
var y = @minimum(c, d);
|
||||
try expect(mem.eql(f32, &@as([4]f32, y), &[4]f32{ -0.23, 0.4, -2.4, 0.9 }));
|
||||
|
||||
var e: Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 };
|
||||
var f: Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 };
|
||||
var e: @Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 };
|
||||
var f: @Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 };
|
||||
var z = @maximum(e, f);
|
||||
try expect(mem.eql(f32, &@as([2]f32, z), &[2]f32{ 0, 0 }));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,11 @@ const expect = std.testing.expect;
|
||||
const expectEqual = std.testing.expectEqual;
|
||||
|
||||
test "@popCount integers" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
comptime try testPopCountIntegers();
|
||||
try testPopCountIntegers();
|
||||
}
|
||||
@@ -51,6 +56,10 @@ fn testPopCountIntegers() !void {
|
||||
|
||||
test "@popCount vectors" {
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
comptime try testPopCountVectors();
|
||||
try testPopCountVectors();
|
||||
|
||||
@@ -5,6 +5,12 @@ const maxInt = std.math.maxInt;
|
||||
const expect = std.testing.expect;
|
||||
|
||||
test "saturating add" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
try testSatAdd(i8, -3, 10, 7);
|
||||
@@ -49,6 +55,12 @@ test "saturating add" {
|
||||
}
|
||||
|
||||
test "saturating subtraction" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
try testSatSub(i8, -3, 10, -13);
|
||||
@@ -92,8 +104,20 @@ test "saturating subtraction" {
|
||||
}
|
||||
|
||||
test "saturating multiplication" {
|
||||
// TODO: once #9660 has been solved, remove this line
|
||||
if (builtin.cpu.arch == .wasm32) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
if (builtin.zig_backend == .stage1 and builtin.cpu.arch == .wasm32) {
|
||||
// https://github.com/ziglang/zig/issues/9660
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .wasm32) {
|
||||
// https://github.com/ziglang/zig/issues/9660
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
@@ -129,6 +153,12 @@ test "saturating multiplication" {
|
||||
}
|
||||
|
||||
test "saturating shift-left" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
try testSatShl(i8, 1, 2, 4);
|
||||
@@ -163,6 +193,12 @@ test "saturating shift-left" {
|
||||
}
|
||||
|
||||
test "saturating shl uses the LHS type" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
const lhs_const: u8 = 1;
|
||||
var lhs_var: u8 = 1;
|
||||
|
||||
|
||||
@@ -2,13 +2,18 @@ const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const mem = std.mem;
|
||||
const expect = std.testing.expect;
|
||||
const Vector = std.meta.Vector;
|
||||
|
||||
test "@shuffle int" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
var v: Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };
|
||||
var x: Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };
|
||||
var v: @Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };
|
||||
var x: @Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 };
|
||||
const mask = [4]i32{ 0, ~@as(i32, 2), 3, ~@as(i32, 3) };
|
||||
var res = @shuffle(i32, v, x, mask);
|
||||
try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 2147483647, 3, 40, 4 }));
|
||||
@@ -23,13 +28,13 @@ test "@shuffle int" {
|
||||
try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 40, -2, 30, 2147483647 }));
|
||||
|
||||
// Upcasting of b
|
||||
var v2: Vector(2, i32) = [2]i32{ 2147483647, undefined };
|
||||
var v2: @Vector(2, i32) = [2]i32{ 2147483647, undefined };
|
||||
const mask3 = [4]i32{ ~@as(i32, 0), 2, ~@as(i32, 0), 3 };
|
||||
res = @shuffle(i32, x, v2, mask3);
|
||||
try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 2147483647, 3, 2147483647, 4 }));
|
||||
|
||||
// Upcasting of a
|
||||
var v3: Vector(2, i32) = [2]i32{ 2147483647, -2 };
|
||||
var v3: @Vector(2, i32) = [2]i32{ 2147483647, -2 };
|
||||
const mask4 = [4]i32{ 0, ~@as(i32, 2), 1, ~@as(i32, 3) };
|
||||
res = @shuffle(i32, v3, x, mask4);
|
||||
try expect(mem.eql(i32, &@as([4]i32, res), &[4]i32{ 2147483647, 3, -2, 4 }));
|
||||
@@ -40,10 +45,16 @@ test "@shuffle int" {
|
||||
}
|
||||
|
||||
test "@shuffle bool" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
var x: Vector(4, bool) = [4]bool{ false, true, false, true };
|
||||
var v: Vector(2, bool) = [2]bool{ true, false };
|
||||
var x: @Vector(4, bool) = [4]bool{ false, true, false, true };
|
||||
var v: @Vector(2, bool) = [2]bool{ true, false };
|
||||
const mask = [4]i32{ 0, ~@as(i32, 1), 1, 2 };
|
||||
var res = @shuffle(bool, x, v, mask);
|
||||
try expect(mem.eql(bool, &@as([4]bool, res), &[4]bool{ false, false, true, false }));
|
||||
@@ -54,15 +65,22 @@ test "@shuffle bool" {
|
||||
}
|
||||
|
||||
test "@shuffle bool" {
|
||||
// TODO re-enable when LLVM codegen is fixed
|
||||
// https://github.com/ziglang/zig/issues/3246
|
||||
if (true) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) {
|
||||
// https://github.com/ziglang/zig/issues/3246
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
var x: Vector(3, bool) = [3]bool{ false, true, false };
|
||||
var v: Vector(2, bool) = [2]bool{ true, false };
|
||||
const mask: Vector(4, i32) = [4]i32{ 0, ~@as(i32, 1), 1, 2 };
|
||||
var x: @Vector(3, bool) = [3]bool{ false, true, false };
|
||||
var v: @Vector(2, bool) = [2]bool{ true, false };
|
||||
const mask: @Vector(4, i32) = [4]i32{ 0, ~@as(i32, 1), 1, 2 };
|
||||
var res = @shuffle(bool, x, v, mask);
|
||||
try expect(mem.eql(bool, &@as([4]bool, res), &[4]bool{ false, false, true, false }));
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ test "initializer list expression" {
|
||||
}
|
||||
|
||||
test "sizeof in macros" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try expect(@as(c_int, @sizeOf(u32)) == h.MY_SIZEOF(u32));
|
||||
try expect(@as(c_int, @sizeOf(u32)) == h.MY_SIZEOF2(u32));
|
||||
}
|
||||
@@ -39,13 +41,21 @@ test "reference to a struct type" {
|
||||
}
|
||||
|
||||
test "cast negative integer to pointer" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try expectEqual(@intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))), h.MAP_FAILED);
|
||||
}
|
||||
|
||||
test "casting to union with a macro" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const l: c_long = 42;
|
||||
const d: f64 = 2.0;
|
||||
@@ -58,7 +68,11 @@ test "casting to union with a macro" {
|
||||
}
|
||||
|
||||
test "nested comma operator" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try expectEqual(@as(c_int, 3), h.NESTED_COMMA_OPERATOR);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,11 @@ const ET = union(enum) {
|
||||
};
|
||||
|
||||
test "enum with members" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const a = ET{ .SINT = -42 };
|
||||
const b = ET{ .UINT = 42 };
|
||||
|
||||
@@ -5,6 +5,12 @@ const builtin = @import("builtin");
|
||||
const has_f80_rt = @import("builtin").cpu.arch == .x86_64;
|
||||
|
||||
test "integer widening" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
var a: u8 = 250;
|
||||
var b: u16 = a;
|
||||
var c: u32 = b;
|
||||
@@ -15,12 +21,24 @@ test "integer widening" {
|
||||
}
|
||||
|
||||
test "implicit unsigned integer to signed integer" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
var a: u8 = 250;
|
||||
var b: i16 = a;
|
||||
try expect(b == 250);
|
||||
}
|
||||
|
||||
test "float widening" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
var a: f16 = 12.34;
|
||||
var b: f32 = a;
|
||||
var c: f64 = b;
|
||||
@@ -35,6 +53,12 @@ test "float widening" {
|
||||
}
|
||||
|
||||
test "float widening f16 to f128" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
// TODO https://github.com/ziglang/zig/issues/3282
|
||||
if (builtin.cpu.arch == .aarch64) return error.SkipZigTest;
|
||||
if (builtin.cpu.arch == .powerpc64le) return error.SkipZigTest;
|
||||
@@ -45,6 +69,9 @@ test "float widening f16 to f128" {
|
||||
}
|
||||
|
||||
test "cast small unsigned to larger signed" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
try expect(castSmallUnsignedToLargerSigned1(200) == @as(i16, 200));
|
||||
try expect(castSmallUnsignedToLargerSigned2(9999) == @as(i64, 9999));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user