]>
git.proxmox.com Git - rustc.git/blob - src/test/run-pass-fulldeps/macro-quote-cond.rs
1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // aux-build:cond_plugin.rs
15 #![feature(rustc_private)]
16 #![plugin(cond_plugin)]
18 fn fact(n
: i64) -> i64 {
26 fn fact_cond(n
: i64) -> i64 {
29 (else (n
* fact_cond(n
-1)))
33 fn fib(n
: i64) -> i64 {
41 fn fib_cond(n
: i64) -> i64 {
45 (else (fib_cond(n
-1) + fib_cond(n
-2)))
50 assert_eq
!(fact(3), fact_cond(3));
51 assert_eq
!(fact(5), fact_cond(5));
52 assert_eq
!(fib(5), fib_cond(5));
53 assert_eq
!(fib(8), fib_cond(8));