2022-12-13 21:55:59 +00:00
|
|
|
const std = @import("std");
|
|
|
|
const builtin = @import("builtin");
|
|
|
|
|
|
|
|
test "strlit to vector" {
|
|
|
|
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
|
|
|
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
|
|
|
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
|
|
|
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
2023-05-11 06:53:34 +01:00
|
|
|
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
|
2022-12-13 21:55:59 +00:00
|
|
|
|
|
|
|
const strlit = "0123456789abcdef0123456789ABCDEF";
|
|
|
|
const vec_from_strlit: @Vector(32, u8) = strlit.*;
|
|
|
|
const arr_from_vec = @as([32]u8, vec_from_strlit);
|
2023-02-18 03:23:33 +00:00
|
|
|
for (strlit, 0..) |c, i|
|
2022-12-13 21:55:59 +00:00
|
|
|
try std.testing.expect(c == arr_from_vec[i]);
|
|
|
|
try std.testing.expectEqualSlices(u8, strlit, &arr_from_vec);
|
|
|
|
}
|