zig/doc/langref/test_truncate_builtin.zig

11 lines
189 B
Zig
Raw Normal View History

const std = @import("std");
const expect = std.testing.expect;
test "integer truncation" {
const a: u16 = 0xabcd;
const b: u8 = @truncate(a);
try expect(b == 0xcd);
}
// test