2010-06-23 23:03:09 -05:00
|
|
|
// -*- rust -*-
|
|
|
|
|
|
|
|
type rect = rec(int x, int y, int w, int h);
|
|
|
|
|
|
|
|
fn f(rect r, int x, int y, int w, int h) {
|
2011-05-02 13:23:07 -05:00
|
|
|
assert (r.x == x);
|
|
|
|
assert (r.y == y);
|
|
|
|
assert (r.w == w);
|
|
|
|
assert (r.h == h);
|
2010-06-23 23:03:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let rect r = rec(x=10, y=20, w=100, h=200);
|
2011-05-02 13:23:07 -05:00
|
|
|
assert (r.x == 10);
|
|
|
|
assert (r.y == 20);
|
|
|
|
assert (r.w == 100);
|
|
|
|
assert (r.h == 200);
|
2010-06-23 23:03:09 -05:00
|
|
|
let rect r2 = r;
|
|
|
|
let int x = r2.x;
|
2011-05-02 13:23:07 -05:00
|
|
|
assert (x == 10);
|
2010-06-23 23:03:09 -05:00
|
|
|
f(r, 10, 20, 100, 200);
|
|
|
|
f(r2, 10, 20, 100, 200);
|
|
|
|
}
|