zig/test/behavior/cast_int.zig
Jacob Young 525dcaecba behavior: enable stage2_c tests that are currently passing
Also fix C warnings triggered by these tests.
2022-10-25 05:11:28 -04:00

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);
}