From 3b45610f9df4713da2a69ed27825c13eed8b7587 Mon Sep 17 00:00:00 2001 From: TheGeogeo <57634077+TheGeogeo@users.noreply.github.com> Date: Mon, 30 Nov 2026 22:55:55 +0100 Subject: [PATCH] tests: d3d12_ab_compare's sign rule has a test of its own (D3D12-AB-COMPARE-AGREE-TEST) "B faster" or "B slower" needs the interval to leave 0 out and all pairs but at most one to agree in sign. No test caught removing the sign part (the verification of #2783 found it): the odd-run test's interval already held 0. Eight pairs, two against the rest, now give no verdict, and one against the rest still does. --- tests/test_d3d12_ab_compare.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_d3d12_ab_compare.py b/tests/test_d3d12_ab_compare.py index 7d9c15e946..d6fc750cfe 100644 --- a/tests/test_d3d12_ab_compare.py +++ b/tests/test_d3d12_ab_compare.py @@ -37,6 +37,25 @@ def test_a_drift_alone_in_an_unbalanced_order_is_no_effect(self): self.assertAlmostEqual(r["result"]["effect"], 0.0, places=6) self.assertEqual(r["verdict"], "no clear difference") + def test_two_pairs_against_the_rest_give_no_verdict(self): + # Eight pairs: six with B 2 ms faster, two with B 0.1 ms slower. The interval leaves 0 out, but two pairs + # disagree in sign, one more than the rule allows: no verdict. + order = "ABBA" * 4 + b = [18.0] * 6 + [20.1] * 2 + values = [] + for pair in range(8): + a_first = order[2 * pair] == "A" + values += [20.0, b[pair]] if a_first else [b[pair], 20.0] + r = ab.abba(items(order, values)) + e = r["result"] + self.assertEqual(r["method"], "pairs") + self.assertLess(e["ci95"][1], 0) + self.assertEqual((e["agree"], e["k"]), (6, 8)) + self.assertEqual(r["verdict"], "no clear difference") + # One pair against the rest is allowed. + r = ab.abba(items(order, values[:-2] + [18.0, 20.0])) + self.assertEqual(r["verdict"], "B faster") + def test_one_odd_run_gives_no_verdict(self): r = ab.abba(items("ABBAABBA", [20.0, 16.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0])) self.assertEqual(r["verdict"], "no clear difference")