zig/test/cases/rem.zig
Alex Rønne Petersen 4dba253cd2
test: pull tests in test/cases/llvm/ up to test/cases/
There is nothing inherently LLVM-specific about any of these.
2025-09-16 23:39:29 +02:00

15 lines
296 B
Zig

fn assert(ok: bool) void {
if (!ok) unreachable;
}
fn rem(lhs: i32, rhs: i32, expected: i32) bool {
return @rem(lhs, rhs) == expected;
}
pub fn main() void {
assert(rem(-5, 3, -2));
assert(rem(5, 3, 2));
}
// run
// backend=selfhosted,llvm
// target=x86_64-linux,x86_64-macos
//