mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 22:04:21 +00:00
10 lines
189 B
Zig
10 lines
189 B
Zig
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
|