align / code /tests /test_audit_g6_eval_scripts_lean_ceiling.py
viai957's picture
Add files using upload-large-folder tool
201dc77 verified
Raw History Blame Contribute Delete
1.83 kB
"""U11-13: a ceiling run with no known-good evidence must not certify the verifier."""
import importlib.util
import os
import pytest
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def _load():
spec = importlib.util.spec_from_file_location(
"lean_ceiling_under_test", os.path.join(REPO, "scripts", "lean_ceiling_test.py")
)
m = importlib.util.module_from_spec(spec)
spec.loader.exec_module(m)
return m
ADV_PASS = {"n": 61, "accepted": 0, "pass": True}
KG_PASS = {"n": 100, "accepted": 100, "pass": True}
def test_adversarial_only_report_in_a_full_run_fails():
# all-reject verifier: known-good stage skipped (no candidate survived the compile filter)
m = _load()
assert m.ceiling_ok({"adversarial": ADV_PASS}, only=None) is False
def test_both_sides_pass():
m = _load()
assert m.ceiling_ok({"known_good": KG_PASS, "adversarial": ADV_PASS}, only=None) is True
def test_either_side_failing_fails():
m = _load()
assert m.ceiling_ok({"known_good": {**KG_PASS, "pass": False}, "adversarial": ADV_PASS}, only=None) is False
assert m.ceiling_ok({"known_good": KG_PASS, "adversarial": {**ADV_PASS, "pass": False}}, only=None) is False
def test_only_modes_require_their_own_side():
m = _load()
assert m.ceiling_ok({"adversarial": ADV_PASS}, only="adversarial") is True
assert m.ceiling_ok({"known_good": KG_PASS}, only="good") is True
assert m.ceiling_ok({}, only="good") is False
assert m.ceiling_ok({}, only="adversarial") is False
def test_empty_good_results_yield_a_failing_known_good_entry():
m = _load()
entry = m.empty_known_good_entry(candidates=180, excluded=180)
assert entry["pass"] is False and entry["n"] == 0
assert m.ceiling_ok({"known_good": entry, "adversarial": ADV_PASS}, only=None) is False