Print the mean of the bugs' own changes as task-bench's All change
CI / tests (pull_request) Successful in 4m28s

This commit is contained in:
2026-11-22 16:52:54 +01:00
parent e687860824
commit e38b6c344b
5 changed files with 68 additions and 18 deletions
+19
View File
@@ -102,6 +102,25 @@ class TableTest(unittest.TestCase):
results = [run(1, "base", 1, True, input_=0, turns=10, seconds=60, reads=0), run(1, "head", 1, False, input_=50, turns=12, seconds=120, reads=2)]
self.assertEqual(table(results, {1: "calc.go:4:7 ARITHMETIC_BASE"})[-1], "| All | change | -1 | - | 0 % | 0 % | 0 % | +2 | +100 % | +2 |")
def test_the_change_is_the_mean_of_the_bugs_own_changes_not_the_change_of_the_pooled_medians(self):
results = [
run(1, "base", 1, True, input_=100, turns=10, seconds=60, reads=3), run(1, "head", 1, True, input_=200, turns=14, seconds=90, reads=5),
run(2, "base", 1, True, input_=1000, turns=20, seconds=60, reads=7), run(2, "head", 1, True, input_=1000, turns=20, seconds=60, reads=7),
]
rows = table(results, {1: "calc.go:4:7 ARITHMETIC_BASE", 2: "pick.go:9:3 ARITHMETIC_BASE"})
self.assertEqual(rows[-3:], [
"| All | base | 2/2 | 550 | 1000 | 5000 | 400 | 15 | 60 | 5 |",
"| All | head | 2/2 | 600 | 1000 | 5000 | 400 | 17 | 75 | 6 |",
"| All | change | 0 | +50 % | 0 % | 0 % | 0 % | +2 | +25 % | +1 |",
])
def test_a_bug_whose_base_measured_zero_is_left_out_of_the_mean_share(self):
results = [
run(1, "base", 1, True, input_=0), run(1, "head", 1, True, input_=50),
run(2, "base", 1, True, input_=100), run(2, "head", 1, True, input_=150),
]
self.assertEqual(table(results, {1: "a.go:1:1 ARITHMETIC_BASE", 2: "b.go:1:1 ARITHMETIC_BASE"})[-1].split(" | ")[3], "+50 %")
def test_a_run_without_figures_counts_as_not_passed_and_a_side_without_any_shows_a_dash(self):
results = [Result(1, "base", 1, False, None), run(1, "head", 1, True)]
self.assertEqual(table(results, {1: "calc.go:4:7 ARITHMETIC_BASE"})[2:], [