zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

test_fibonacci_comptime_overflow.zig (278B) - Raw


      1 const expect = @import("std").testing.expect;
      2 
      3 fn fibonacci(index: u32) u32 {
      4     //if (index < 2) return index;
      5     return fibonacci(index - 1) + fibonacci(index - 2);
      6 }
      7 
      8 test "fibonacci" {
      9     try comptime expect(fibonacci(7) == 13);
     10 }
     11 
     12 // test_error=overflow of integer type