aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/test_coerce_large_to_small.zig
blob: 62111af97992ce5a72ae237808d9bae9cd3c433b (plain)
1
2
3
4
5
6
7
8
9
10
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