Ad
  • Custom User Avatar

    Ah yeah I see it more clearly now, thanks :)
    Interesting to see that the solution of ldfritz works because he adds a to the sum instead of b

  • Custom User Avatar

    Assuming the author of this is Kata is also the author of the test cases, it's unlikely that the test case "should return 2 for input 1" is not as he intended. More likely he did not communicate his intentions clearly in the Kata instructions. I have added a comment to this Kata's discussion recommending that the author update and improve the instructions.

  • Default User Avatar

    I intentionally wrote the code this way, that it behave as it behave.
    I think the test case "should return 2 for input 1" is wrong.
    When limit is 1, 2 exceeds the limit, so it should not be taken into account.
    Ok, the instruction says "Generate all of the Fibonacci numbers starting with 1 and 2 and ending on the highest number before exceeding the parameter's value", but this looks a bit like, change the instruction that it fits the code, I would expect:

    Expect(SumEvenFibonacci(0)).To(Equal(0))

    Expect(SumEvenFibonacci(1)).To(Equal(0))

    Expect(SumEvenFibonacci(5)).To(Equal(2)) (interessting case, some of the codes here return 2, some 10)

  • Custom User Avatar

    I had the same thing, looks like for-loop always runs at least once ?
    I'm still a beginner at golang though...