rust/benches/helpers/fibonacci_helper.rs

9 lines
148 B
Rust
Raw Normal View History

2016-05-30 07:05:50 -05:00
#[inline(never)]
pub fn main() {
assert_eq!(fib(10), 55);
}
fn fib(n: usize) -> usize {
if n <= 2 { 1 } else { fib(n - 1) + fib(n - 2) }
2016-05-30 07:05:50 -05:00
}