rust/src/test/run-pass/arith-1.rs
Tim Chevalier aa25f22f19 Use different syntax for checks that matter to typestate
This giant commit changes the syntax of Rust to use "assert" for
"check" expressions that didn't mean anything to the typestate
system, and continue using "check" for checks that are used as
part of typestate checking.

Most of the changes are just replacing "check" with "assert" in test
cases and rustc.
2011-05-02 12:16:29 -07:00

22 lines
748 B
Rust

fn main() -> () {
let int i32_a = 10;
assert (i32_a == 10);
assert (i32_a - 10 == 0);
assert (i32_a / 10 == 1);
assert (i32_a - 20 == -10);
assert (i32_a << 10 == 10240);
assert (i32_a << 16 == 655360);
assert (i32_a * 16 == 160);
assert (i32_a * i32_a * i32_a == 1000);
assert (i32_a * i32_a * i32_a * i32_a == 10000);
assert (((i32_a * i32_a) / i32_a) * i32_a == 100);
assert (i32_a * (i32_a - 1) << 2 + i32_a == 368640);
let int i32_b = 0x10101010;
assert (i32_b + 1 - 1 == i32_b);
assert (i32_b << 1 == i32_b << 1);
assert (i32_b >> 1 == i32_b >> 1);
assert ((i32_b & (i32_b << 1)) == 0);
log ((i32_b | (i32_b << 1)));
assert ((i32_b | (i32_b << 1)) == 0x30303030);
}