Ad
  • 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)