mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
13 lines
278 B
Zig
13 lines
278 B
Zig
|
const expect = @import("std").testing.expect;
|
||
|
|
||
|
fn fibonacci(index: u32) u32 {
|
||
|
//if (index < 2) return index;
|
||
|
return fibonacci(index - 1) + fibonacci(index - 2);
|
||
|
}
|
||
|
|
||
|
test "fibonacci" {
|
||
|
try comptime expect(fibonacci(7) == 13);
|
||
|
}
|
||
|
|
||
|
// test_error=overflow of integer type
|