2010-06-24 04:03:09 +00:00
|
|
|
|
2011-06-15 18:19:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
// -*- rust -*-
|
2011-07-27 12:19:39 +00:00
|
|
|
type rect = {x: int, y: int, w: int, h: int};
|
2010-06-24 04:03:09 +00:00
|
|
|
|
2011-07-27 12:19:39 +00:00
|
|
|
fn f(r: rect, x: int, y: int, w: int, h: int) {
|
2011-06-15 18:19:50 +00:00
|
|
|
assert (r.x == x);
|
|
|
|
assert (r.y == y);
|
|
|
|
assert (r.w == w);
|
|
|
|
assert (r.h == h);
|
2010-06-24 04:03:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2011-07-27 12:19:39 +00:00
|
|
|
let r: rect = {x: 10, y: 20, w: 100, h: 200};
|
2011-06-15 18:19:50 +00:00
|
|
|
assert (r.x == 10);
|
|
|
|
assert (r.y == 20);
|
|
|
|
assert (r.w == 100);
|
|
|
|
assert (r.h == 200);
|
2011-07-27 12:19:39 +00:00
|
|
|
let r2: rect = r;
|
|
|
|
let x: int = r2.x;
|
2011-06-15 18:19:50 +00:00
|
|
|
assert (x == 10);
|
|
|
|
f(r, 10, 20, 100, 200);
|
|
|
|
f(r2, 10, 20, 100, 200);
|
|
|
|
}
|