aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-08-22 18:37:42 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-08-22 18:37:42 -0700
commit9043e665a549b87fa73ade7af06682368092d8a9 (patch)
tree452a9948450b7ba8266bff0324e53a23fc0f4bf4 /test/behavior
parent95c43e20b45aafa6b34b0aae927dbabbb0b65e32 (diff)
downloadzig-9043e665a549b87fa73ade7af06682368092d8a9.tar.gz
zig-9043e665a549b87fa73ade7af06682368092d8a9.zip
add behavior test for copying array of vectors
closes #12026
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/vector.zig23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/behavior/vector.zig b/test/behavior/vector.zig
index 863a8030c0..829d20057a 100644
--- a/test/behavior/vector.zig
+++ b/test/behavior/vector.zig
@@ -1111,3 +1111,26 @@ test "loading the second vector from a slice of vectors" {
var a4 = a[1][1];
try expect(a4 == 3);
}
+
+test "array of vectors is copied" {
+ 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 Vec3 = @Vector(3, i32);
+ var points = [_]Vec3{
+ Vec3{ 404, -588, -901 },
+ Vec3{ 528, -643, 409 },
+ Vec3{ -838, 591, 734 },
+ Vec3{ 390, -675, -793 },
+ Vec3{ -537, -823, -458 },
+ Vec3{ -485, -357, 347 },
+ Vec3{ -345, -311, 381 },
+ Vec3{ -661, -816, -575 },
+ };
+ var points2: [20]Vec3 = undefined;
+ points2[0..points.len].* = points;
+ try std.testing.expectEqual(points2[6], Vec3{ -345, -311, 381 });
+}