Coverage percentages can be floored one hundredth too low

未關閉 適合新手
#98 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
76/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
testing-qa

研究方向

先閱讀 effective_coverage.floor_two_decimals,並追蹤它如何接收已涵蓋行數和總行數。檢查原始百分比和有效百分比計算的測試,接著新增一個 10,000 行中涵蓋 29 行的案例。當報告、摘要、HTML 索引和有效門檻中的百分比都使用精確向下取整後的值時,即告完成。

由索引模型根據 Issue 內容生成。

描述

bug

Found while reviewing the user manual against the implementation at fe013fe.

effective_coverage.floor_two_decimals computes math.floor(value * 100.0) / 100.0 on a float. For some exact ratios the binary representation is slightly below the decimal value, and the result is one hundredth too low.

Reproduction
>>> import math
>>> math.floor(100.0 * 29 / 10000 * 100.0) / 100.0
0.28

29 of 10,000 lines is exactly 0.29 %.

Effect

Raw and effective percentages in report.json, the summary and the HTML index can be 0.01 lower than the exact value. Together with #17 this also affects the effective gate. The error is towards under-reporting.

Expected behavior

Floor with integer arithmetic on covered and total counts, for example (10000 * covered // total) / 100.

主要語言
Python
星號
0
分支
4
平均合併
1 天 16 小時
30 天內合併 PR
16

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

eclipse-score/coverage_tool 的其他 Issue

查看 eclipse-score/coverage_tool 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。