mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
525dcaecba
Also fix C warnings triggered by these tests.
17 lines
598 B
Zig
17 lines
598 B
Zig
const builtin = @import("builtin");
|
|
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
const maxInt = std.math.maxInt;
|
|
|
|
test "@intCast i32 to u7" {
|
|
if (builtin.zig_backend == .stage2_wasm) 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
|
|
|
|
var x: u128 = maxInt(u128);
|
|
var y: i32 = 120;
|
|
var z = x >> @intCast(u7, y);
|
|
try expect(z == 0xff);
|
|
}
|