diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2022-10-29 05:58:41 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2022-10-29 05:58:41 -0400 |
| commit | 48a2783969b0a43200514a5b4e9cce57be4e5b46 (patch) | |
| tree | 0f7cc577dd9090938d842250e1d1986d3d05aa0e /test/behavior/vector.zig | |
| parent | e20d2b3151607fe078b43331ea27d5b34f95360b (diff) | |
| parent | 20925b2f5c5c0ae20fdc0574e5d4e5740d17b4d6 (diff) | |
| download | zig-48a2783969b0a43200514a5b4e9cce57be4e5b46.tar.gz zig-48a2783969b0a43200514a5b4e9cce57be4e5b46.zip | |
cbe: implement optional slice representation change
Diffstat (limited to 'test/behavior/vector.zig')
| -rw-r--r-- | test/behavior/vector.zig | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/behavior/vector.zig b/test/behavior/vector.zig index 581d68dcb6..93299498f3 100644 --- a/test/behavior/vector.zig +++ b/test/behavior/vector.zig @@ -1134,3 +1134,39 @@ test "array of vectors is copied" { points2[0..points.len].* = points; try std.testing.expectEqual(points2[6], Vec3{ -345, -311, 381 }); } + +test "byte vector initialized in inline function" { + 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 + + const S = struct { + inline fn boolx4(e0: bool, e1: bool, e2: bool, e3: bool) @Vector(4, bool) { + return .{ e0, e1, e2, e3 }; + } + + fn all(vb: @Vector(4, bool)) bool { + return @reduce(.And, vb); + } + }; + + try expect(S.all(S.boolx4(true, true, true, true))); +} + +test "byte vector initialized in inline function" { + // TODO https://github.com/ziglang/zig/issues/13279 + if (true) return error.SkipZigTest; + + const S = struct { + fn boolx4(e0: bool, e1: bool, e2: bool, e3: bool) @Vector(4, bool) { + return .{ e0, e1, e2, e3 }; + } + + fn all(vb: @Vector(4, bool)) bool { + return @reduce(.And, vb); + } + }; + + try expect(S.all(S.boolx4(true, true, true, true))); +} |
