commit 9043e665a549b87fa73ade7af06682368092d8a9 (tree)
parent 95c43e20b45aafa6b34b0aae927dbabbb0b65e32
Author: Andrew Kelley <andrew@ziglang.org>
Date: Mon, 22 Aug 2022 18:37:42 -0700
add behavior test for copying array of vectors
closes #12026
Diffstat:
1 file changed, 23 insertions(+), 0 deletions(-)
diff --git 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 });
+}