test_a_cpp_body_attributed_only_by_bodyfile_id_is_not_barren

Tests › tests/test_coverage.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE DECL/DEF DUALITY, and a defect this test was written to catch.

Given

  1. db_path, root = _coverage_db(tmp_path, [("src/unit.cpp", BIG, 0)])
  2. conn = sqlite3.connect(str(db_path))
3 more
  1. for slot in range(33): conn.execute( "INSERT INTO memberdef (kind, name, file_id, bodyfile_id, bodystart, bodyend)" " VALUES ('function', ?, NULL, 1, 1, 9)", (f"method_{slot}",), )
  2. conn.commit()
  3. conn.close()
→

When

  1. coverage = measure_index_coverage(db_path, root)
→

Then

  1. ✓ coverage.barren_files equals 0

tests/test_coverage.py:195 · its file's page

What it checks (1)

  1. assert coverage.barren_files == 0, "bodyfile_id-only attribution must count as a yield" observes measure_index_coverage via coverage

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_a_cpp_body_attributed_only_by_bodyfile_id_is_not_barren→_coverage_db→measure_index_coverage

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

test_a_cpp_body_attributed_only_by_bodyfile_id_is_not_barren · 1 checksmeasure_index_coverage_file_yieldsmemoizedREQ-DDB-INDEX-002 · measuredmeasure_index_coverageREQ-DDB-INDEX-003 · measured
Also reaches 3 requirements

Its run touches their code; that is reach, not proof.