test_truncate_builtin.zig (189B) - Raw
1 const std = @import("std"); 2 const expect = std.testing.expect; 3 4 test "integer truncation" { 5 const a: u16 = 0xabcd; 6 const b: u8 = @truncate(a); 7 try expect(b == 0xcd); 8 } 9 10 // test
zigfork of https://codeberg.org/ziglang/zig | |
| Log | Files | Refs | README | LICENSE |