rust/tests/ui/numbers-arithmetic/div-mod.rs
2024-02-16 20:02:50 +00:00

20 lines
342 B
Rust

//@ run-pass
pub fn main() {
let x: isize = 15;
let y: isize = 5;
assert_eq!(x / 5, 3);
assert_eq!(x / 4, 3);
assert_eq!(x / 3, 5);
assert_eq!(x / y, 3);
assert_eq!(15 / y, 3);
assert_eq!(x % 5, 0);
assert_eq!(x % 4, 3);
assert_eq!(x % 3, 0);
assert_eq!(x % y, 0);
assert_eq!(15 % y, 0);
}