2011-09-28 19:07:33 +00:00
|
|
|
fn main() {
|
2012-08-06 19:34:08 +00:00
|
|
|
match 5u {
|
2012-08-14 00:37:08 +00:00
|
|
|
1u..5u => {}
|
2012-08-04 02:59:04 +00:00
|
|
|
_ => fail ~"should match range",
|
2011-09-28 19:07:33 +00:00
|
|
|
}
|
2012-08-06 19:34:08 +00:00
|
|
|
match 5u {
|
2012-08-14 00:37:08 +00:00
|
|
|
6u..7u => fail ~"shouldn't match range",
|
2012-08-04 02:59:04 +00:00
|
|
|
_ => {}
|
2011-09-28 19:07:33 +00:00
|
|
|
}
|
2012-08-23 21:44:58 +00:00
|
|
|
match 5u {
|
2012-08-04 02:59:04 +00:00
|
|
|
1u => fail ~"should match non-first range",
|
2012-08-14 00:37:08 +00:00
|
|
|
2u..6u => {}
|
2012-08-23 21:44:58 +00:00
|
|
|
_ => fail ~"math is broken"
|
2011-09-28 19:07:33 +00:00
|
|
|
}
|
2012-08-06 19:34:08 +00:00
|
|
|
match 'c' {
|
2012-08-14 00:37:08 +00:00
|
|
|
'a'..'z' => {}
|
2012-08-04 02:59:04 +00:00
|
|
|
_ => fail ~"should suppport char ranges"
|
2011-09-28 19:07:33 +00:00
|
|
|
}
|
2012-08-06 19:34:08 +00:00
|
|
|
match -3 {
|
2012-08-14 00:37:08 +00:00
|
|
|
-7..5 => {}
|
2012-08-04 02:59:04 +00:00
|
|
|
_ => fail ~"should match signed range"
|
2011-09-28 19:07:33 +00:00
|
|
|
}
|
2012-08-06 19:34:08 +00:00
|
|
|
match 3.0 {
|
2012-08-14 00:37:08 +00:00
|
|
|
1.0..5.0 => {}
|
2012-08-04 02:59:04 +00:00
|
|
|
_ => fail ~"should match float range"
|
2011-09-28 19:07:33 +00:00
|
|
|
}
|
2012-08-06 19:34:08 +00:00
|
|
|
match -1.5 {
|
2012-08-14 00:37:08 +00:00
|
|
|
-3.6..3.6 => {}
|
2012-08-04 02:59:04 +00:00
|
|
|
_ => fail ~"should match negative float range"
|
2011-09-28 19:07:33 +00:00
|
|
|
}
|
|
|
|
}
|