145623530a
Adds a small synthetic fixture (tests/fixtures/synthetic_ssdl/) with 5 consumer functions, each containing 3 explicit if-statements. The fixture is self-contained and does not depend on the live src/ tree. The new test tests/test_code_path_audit_ssdl_behavioral.py has 2 tests: - test_effective_codepaths_synthetic: builds an AggregateProfile with 5 consumers pointing at the fixture's 5 functions, calls compute_effective_codepaths, asserts the result is 40 (= 5 consumers x 2^3 branches per function). - test_effective_codepaths_candidate_returns_zero: asserts that an AggregateProfile with is_candidate=True returns 0 (the SSDL early-exit guard for candidate aggregates). This locks down the SSDL effective-codepaths math so future refactors of compute_effective_codepaths() or count_branches_in_function() cannot silently change the formula without a failing test. Verification: - uv run pytest tests/test_code_path_audit_ssdl_behavioral.py -v -> 2 passed
48 lines
506 B
Python
48 lines
506 B
Python
def func_one(x: int) -> int:
|
|
if x > 0:
|
|
x += 1
|
|
if x > 1:
|
|
x += 1
|
|
if x > 2:
|
|
x += 1
|
|
return x
|
|
|
|
|
|
def func_two(x: int) -> int:
|
|
if x > 0:
|
|
x += 1
|
|
if x > 1:
|
|
x += 1
|
|
if x > 2:
|
|
x += 1
|
|
return x
|
|
|
|
|
|
def func_three(x: int) -> int:
|
|
if x > 0:
|
|
x += 1
|
|
if x > 1:
|
|
x += 1
|
|
if x > 2:
|
|
x += 1
|
|
return x
|
|
|
|
|
|
def func_four(x: int) -> int:
|
|
if x > 0:
|
|
x += 1
|
|
if x > 1:
|
|
x += 1
|
|
if x > 2:
|
|
x += 1
|
|
return x
|
|
|
|
|
|
def func_five(x: int) -> int:
|
|
if x > 0:
|
|
x += 1
|
|
if x > 1:
|
|
x += 1
|
|
if x > 2:
|
|
x += 1
|
|
return x |