/src/test/run-pass/opeq.rs

http://github.com/jruderman/rust · Rust · 19 lines · 15 code · 3 blank · 1 comment · 4 complexity · fde01a775df8c1ea49c684c183ae9d25 MD5 · raw file

  1. // -*- rust -*-
  2. fn main() {
  3. let mut x: int = 1;
  4. x *= 2;
  5. log(debug, x);
  6. assert (x == 2);
  7. x += 3;
  8. log(debug, x);
  9. assert (x == 5);
  10. x *= x;
  11. log(debug, x);
  12. assert (x == 25);
  13. x /= 5;
  14. log(debug, x);
  15. assert (x == 5);
  16. }