aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/basic.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-02-18 14:08:06 -0500
committerGitHub <noreply@github.com>2022-02-18 14:08:06 -0500
commit60bb1d4e1c262ff36c18cefe974aa2f773483af4 (patch)
tree159ff6e30d4f74006783bfcd76a9de7fd0acedb4 /test/behavior/basic.zig
parent736b9dcdd60b83c07bfbdb69c62facfbe10611f1 (diff)
parent1639fd4c45ee816c7c67963fbff3513a32f5737b (diff)
downloadzig-60bb1d4e1c262ff36c18cefe974aa2f773483af4.tar.gz
zig-60bb1d4e1c262ff36c18cefe974aa2f773483af4.zip
Merge pull request #10906 from topolarity/cbe-array-support
stage2 CBE: Implement 2D array support
Diffstat (limited to 'test/behavior/basic.zig')
-rw-r--r--test/behavior/basic.zig32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
index 61c7de7a23..05c1f1cda3 100644
--- a/test/behavior/basic.zig
+++ b/test/behavior/basic.zig
@@ -436,6 +436,38 @@ test "array 2D const double ptr" {
try testArray2DConstDoublePtr(&rect_2d_vertexes[0][0]);
}
+test "array 2D const double ptr with offset" {
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
+
+ const rect_2d_vertexes = [_][2]f32{
+ [_]f32{ 3.0, 4.239 },
+ [_]f32{ 1.0, 2.0 },
+ };
+ try testArray2DConstDoublePtr(&rect_2d_vertexes[1][0]);
+}
+
+test "array 3D const double ptr with offset" {
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
+
+ const rect_3d_vertexes = [_][2][2]f32{
+ [_][2]f32{
+ [_]f32{ 3.0, 4.239 },
+ [_]f32{ 3.5, 7.2 },
+ },
+ [_][2]f32{
+ [_]f32{ 3.0, 4.239 },
+ [_]f32{ 1.0, 2.0 },
+ },
+ };
+ try testArray2DConstDoublePtr(&rect_3d_vertexes[1][1][0]);
+}
+
fn testArray2DConstDoublePtr(ptr: *const f32) !void {
const ptr2 = @ptrCast([*]const f32, ptr);
try expect(ptr2[0] == 1.0);