zig/doc/langref/test_coerce_large_to_small.zig

11 lines
234 B
Zig
Raw Normal View History

const std = @import("std");
const expect = std.testing.expect;
test "coercing large integer type to smaller one when value is comptime-known to fit" {
const x: u64 = 255;
const y: u8 = x;
try expect(y == 255);
}
// test