feat: TUI 速度曲线栏增加实时速度文字 (当前/峰值/平均)

This commit is contained in:
AskaEth committed 2026-08-22 13:29:19 +08:00
1 parent 7b11c33d0c
commit 5b8160358e
2 files changed
+34 -2

No files matched your search

+16
View File
@@ -254,3 +254,19 @@ def test_apply_policy_global_overwrite_keeps_explicit_no():
answers = {"a.txt": "n", "*": "a"}
skipped = transfer.apply_policy(conflicts, "ask", answers)
assert skipped == ["a.txt"]
# ---------- 速度统计 ----------
def test_speed_stats_basic():
h = [10 * 1024 * 1024, 20 * 1024 * 1024, 15 * 1024 * 1024]
cur, peak, avg = transfer.speed_stats(h)
assert cur == 15 * 1024 * 1024
assert peak == 20 * 1024 * 1024
assert avg == 15 * 1024 * 1024
def test_speed_stats_empty():
assert transfer.speed_stats([]) == (0.0, 0.0, 0.0)
def test_speed_stats_single():
cur, peak, avg = transfer.speed_stats([8 * 1024 * 1024])
assert (cur, peak, avg) == (8 * 1024 * 1024, 8 * 1024 * 1024, 8 * 1024 * 1024)