aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/vector.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-10-26 00:30:17 +0300
committerAndrew Kelley <andrew@ziglang.org>2022-10-27 21:08:25 -0400
commitd03c47bf85b17f7727d2f1fe5bd497b311c9eba7 (patch)
treefc2008e0adbee552fd72215614eefe7e111dbf5d /test/behavior/vector.zig
parent398a3aae40bc03f6b7c6cd86d78a4cde125f2811 (diff)
downloadzig-d03c47bf85b17f7727d2f1fe5bd497b311c9eba7.tar.gz
zig-d03c47bf85b17f7727d2f1fe5bd497b311c9eba7.zip
Sema: use `runtime_value` instead of creating allocs
Diffstat (limited to 'test/behavior/vector.zig')
-rw-r--r--test/behavior/vector.zig37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/behavior/vector.zig b/test/behavior/vector.zig
index 80fa2021d8..22e12d0808 100644
--- a/test/behavior/vector.zig
+++ b/test/behavior/vector.zig
@@ -1135,3 +1135,40 @@ 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_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
+
+ 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)));
+}