Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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
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.
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)
I had the same thing, looks like for-loop always runs at least once ?
I'm still a beginner at golang though...