aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/arith-1.rs
diff options
context:
space:
mode:
authorMichael Bebenita <[email protected]>2010-08-09 06:53:37 -0700
committerMichael Bebenita <[email protected]>2010-08-09 06:53:37 -0700
commitd647c163fd936c853d76f59ab2c656d554068ab3 (patch)
treec5092621db603321d235ea2bef6ba85e8c2424dd /src/test/run-pass/arith-1.rs
parentAdd Or to the AUTHORS file. (diff)
downloadrust-d647c163fd936c853d76f59ab2c656d554068ab3.tar.xz
rust-d647c163fd936c853d76f59ab2c656d554068ab3.zip
Updated/added test cases.
Diffstat (limited to 'src/test/run-pass/arith-1.rs')
-rw-r--r--src/test/run-pass/arith-1.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/run-pass/arith-1.rs b/src/test/run-pass/arith-1.rs
new file mode 100644
index 00000000..bac6a055
--- /dev/null
+++ b/src/test/run-pass/arith-1.rs
@@ -0,0 +1,22 @@
+fn main() -> () {
+ let int i32_a = 10;
+ check(i32_a == 10);
+ check(i32_a - 10 == 0);
+ check(i32_a / 10 == 1);
+ check(i32_a - 20 == -10);
+ check(i32_a << 10 == 10240);
+ check(i32_a << 16 == 655360);
+ check(i32_a * 16 == 160);
+ check(i32_a * i32_a * i32_a == 1000);
+ check(i32_a * i32_a * i32_a * i32_a == 10000);
+ check(((i32_a * i32_a) / i32_a) * i32_a == 100);
+ check(i32_a * (i32_a - 1) << 2 + i32_a == 368640);
+
+ let int i32_b = 0x10101010;
+ check(i32_b + 1 - 1 == i32_b);
+ check(i32_b << 1 == i32_b << 1);
+ check(i32_b >> 1 == i32_b >> 1);
+ check((i32_b & (i32_b << 1)) == 0);
+ log ((i32_b | (i32_b << 1)));
+ check((i32_b | (i32_b << 1)) == 0x30303030);
+} \ No newline at end of file