Skip to content

Fix #1: Add fibonacci function with edge case handling - #3

Draft
s6pa1rta3n-lab wants to merge 1 commit into
gougousongsong:mainfrom
s6pa1rta3n-lab:fix-issue-1
Draft

Fix #1: Add fibonacci function with edge case handling#3
s6pa1rta3n-lab wants to merge 1 commit into
gougousongsong:mainfrom
s6pa1rta3n-lab:fix-issue-1

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Summary

Implements the fibonacci(n) calculation function with strict negative input validation in src/math_utils.py and adds comprehensive test coverage in tests/test_math_utils.py.

Stipulation Compliance Checklist

  • Function name: fibonacci(n)
  • Added to src/math_utils.py
  • Returns nth Fibonacci number (0-indexed)
  • Raises ValueError with exact message "n must be non-negative" when n < 0
  • Added test cases to tests/test_math_utils.py covering normal cases (0, 1, 5, 10)
  • Added test cases for negative input raising ValueError
  • All existing tests continue to pass (6/6 passing)

Verification

pytest tests/ -v

Output:

tests/test_math_utils.py::test_add PASSED                                [ 16%]
tests/test_math_utils.py::test_multiply PASSED                           [ 33%]
tests/test_math_utils.py::test_fibonacci PASSED                          [ 50%]
tests/test_math_utils.py::test_fibonacci_negative PASSED                 [ 66%]
tests/test_string_utils.py::test_reverse_string PASSED                   [ 83%]
tests/test_string_utils.py::test_to_uppercase PASSED                     [100%]

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant