Skip to content

feat(math_utils): add fibonacci function with edge case handling (Closes #1) - #12

Open
MaaBlock wants to merge 1 commit into
gougousongsong:mainfrom
MaaBlock:fix/fibonacci-edge-case
Open

feat(math_utils): add fibonacci function with edge case handling (Closes #1)#12
MaaBlock wants to merge 1 commit into
gougousongsong:mainfrom
MaaBlock:fix/fibonacci-edge-case

Conversation

@MaaBlock

@MaaBlock MaaBlock commented Sep 3, 2026

Copy link
Copy Markdown

Summary of Changes

Closes #1

This PR delivers the requested fibonacci(n) implementation in src/math_utils.py with comprehensive unit tests in tests/test_math_utils.py.

Requirements Checklist

  • Function name: fibonacci(n) added to src/math_utils.py
  • Returns the nth Fibonacci number (0-indexed)
  • Normal cases: fibonacci(0) == 0, fibonacci(1) == 1, fibonacci(5) == 5, fibonacci(10) == 55, fibonacci(20) == 6765
  • Edge case: If n < 0, raises ValueError with message "n must be non-negative"
  • Comprehensive test coverage added to tests/test_math_utils.py
  • All 6 unit tests in test suite pass cleanly (0.08s)

Verification Evidence

$ python -m pytest tests -v
============================= test session starts =============================
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_normal_cases PASSED             [ 50%]
tests/test_math_utils.py::test_fibonacci_edge_case PASSED                [ 66%]
tests/test_string_utils.py::test_reverse_string PASSED                   [ 83%]
tests/test_string_utils.py::test_to_uppercase PASSED                     [100%]
============================== 6 passed in 0.08s ==============================

Bounty Settlement Routing

  • Primary USDC Address (Polygon / Arbitrum / Base / EVM): 0x267e548ab3444aa0a671914ac7c644306a6b90b4
  • Preferred Network: Polygon (USDC-Polygon)
  • Alternative TRON Address (TRC20 USDT): TWvzvF4FszbXM6qnBS947aNJHfyvA1kdZC

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.

Add fibonacci function with edge case handling

1 participant