Week 15 0603 Warmup: UVA 11417 with TDD flow - #991
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sum_of_gcd(n).sum_of_gcdingcd.pyusing pairwise GCD accumulation.TDD Flow
test:commit with failing tests first.feat:commit with implementation to make tests pass.Test Cases
n=2->1n=10->67n=1->0(edge case)Test Result
python -m unittest test_gcd.pyRan 3 tests ... OK