Skip to content

第三題:0622-1114405055-解昱齊 - #1334

Open
yuchi-create wants to merge 4 commits into
DevSecOpsLab-CSIE-NPU:mainfrom
yuchi-create:1114405055-week18-q3-digital-root
Open

yuchi-create wants to merge 4 commits into
DevSecOpsLab-CSIE-NPU:mainfrom
yuchi-create:1114405055-week18-q3-digital-root

Conversation

@yuchi-create

Copy link
Copy Markdown

測試紀錄說明

  • test_log_red.txt:紅燈紀錄。測試 test_digital_root.py 先寫完,但此時 digital_root.py 尚未存在,執行 pytest 出現 ModuleNotFoundError: No module named 'digital_root',確認測試在實作前是失敗的。
  • test_log_green.txt:綠燈紀錄。實作 digital_root.py(digit_sum_in_base 換算進位並加總、digital_root 迴圈收斂到一位數,x=0 固定回傳 0)後,重新執行 pytest,15 個測試全數通過,涵蓋:
    • x=0 固定回傳 0
    • x < base(本身已是一位數,不需迭代)
    • 樣例 8、63(base=7)驗算
    • 需兩輪才收斂的大數案例(1,000,000)
    • 接近上限的 x=10^9,確認不會死迴圈
    • base=16 額外驗證進位轉換與輸出邏輯未寫死服務小 base

yuchi-create and others added 4 commits June 22, 2026 20:44
…light)

digital_root module does not exist yet; test_log_red.txt records the
collection error confirming the tests fail before implementation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e=7)

digit_sum_in_base() converts x into base and sums its digits;
digital_root() loops that until a single digit, with x=0 fixed to 0
per spec. test_log_green.txt records all 15 tests passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@yuchi-create
yuchi-create force-pushed the 1114405055-week18-q3-digital-root branch from ea93dae to 32cc6df Compare June 22, 2026 12:58
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