diff options
Diffstat (limited to 'tests/ui/numbers-arithmetic/div-mod.rs')
-rw-r--r-- | tests/ui/numbers-arithmetic/div-mod.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/numbers-arithmetic/div-mod.rs b/tests/ui/numbers-arithmetic/div-mod.rs new file mode 100644 index 000000000..acb92a7df --- /dev/null +++ b/tests/ui/numbers-arithmetic/div-mod.rs @@ -0,0 +1,19 @@ +// 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); +} |