Skip to content

Week 15 0603 Warmup: UVA 11417 with TDD flow - #991

Merged
AugustChaoTW merged 2 commits into
mainfrom
feature/wk15-0603-fychao
Jun 3, 2026
Merged

AugustChaoTW merged 2 commits into
mainfrom
feature/wk15-0603-fychao

Conversation

@AugustChaoTW

Copy link
Copy Markdown
Contributor

Summary

  • Add failing unit tests for UVA 11417 sum_of_gcd(n).
  • Implement sum_of_gcd in gcd.py using pairwise GCD accumulation.

TDD Flow

  1. test: commit with failing tests first.
  2. feat: commit with implementation to make tests pass.

Test Cases

  • n=2 -> 1
  • n=10 -> 67
  • n=1 -> 0 (edge case)

Test Result

  • Command: python -m unittest test_gcd.py
  • Result: Ran 3 tests ... OK

Copilot AI review requested due to automatic review settings June 3, 2026 03:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

此 PR 以 TDD 流程為 UVA 11417 的核心計算 sum_of_gcd(n) 增加單元測試,並提供對應實作,目標是能正確計算 1 <= i < j <= n 的 gcd(i, j) 總和。

Changes:

  • 新增 sum_of_gcd(n) 的 3 組單元測試(含 n=1 邊界案例)
  • 新增 gcd.py,以雙層迴圈逐對累加 GCD 來實作 sum_of_gcd

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
weeks/week-15/solutions/fychao/0603/test_gcd.py 新增 sum_of_gcd 的基本與邊界單元測試
weeks/week-15/solutions/fychao/0603/gcd.py 新增 sum_of_gcd 的初版計算邏輯

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread weeks/week-15/solutions/fychao/0603/gcd.py
Comment thread weeks/week-15/solutions/fychao/0603/test_gcd.py
@AugustChaoTW
AugustChaoTW merged commit 65a93e4 into main Jun 3, 2026
1 of 2 checks passed
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.

2 participants