test_extract_threads_std_thread_member_pointer_qualified¶
Tests › tests/test_r1_richness.py
What this test is for
Why it exists
std::thread(&Class::method, this): the entry is a member-function pointer. The thread is named by its QUALIFIED entry and the rowid resolves against `definition` — so two classes sharing a method name stay distinct.
Verifies REQ-DDB-SCHEMA-002 REQ-DDB-SCHEMA-003 REQ-DDB-SCHEMA-004
Given
src = tmp_path / "src"src.mkdir()
8 more
(src / "foo.cpp").write_text( "struct Owner { void run(); void start(); };\n" "void Owner::run() {}\n" "void Owner::start() {\n" " worker_ = std::thread(&Owner::run, this);\n" "}\n", )db_path = tmp_path / "clew.db"conn = sqlite3.connect(str(db_path))conn.executescript( """ CREATE TABLE path (name TEXT); CREATE TABLE memberdef ( rowid INTEGER PRIMARY KEY, kind TEXT, name TEXT, definition TEXT, file_id INTEGER, bodyfile_id INTEGER, bodystart INTEGER, bodyend INTEGER ); CREATE TABLE call_edges ( caller_rowid INTEGER, callee_rowid INTEGER, source TEXT, confidence TEXT ); """, )conn.execute("INSERT INTO path (rowid, name) VALUES (1, 'src/foo.cpp')")conn.executemany( "INSERT INTO memberdef (rowid, kind, name, definition, file_id, bodyfile_id, " "bodystart, bodyend) VALUES (?, 'function', ?, ?, 1, 1, ?, ?)", [ (1, "run", "void Owner::run", 2, 2), (2, "start", "void Owner::start", 3, 5), # A decoy `run` on another class — the qualified match must NOT pick it. (3, "run", "void Other::run", 6, 6), ], )conn.commit()conn.close()
When
extract_threads(db_path, tmp_path, None)conn = sqlite3.connect(str(db_path))rows = conn.execute("SELECT name, entry_memberdef_rowid, kind FROM threads").fetchall()conn.close()
Then
- ✓ rows equals [("Owner::run", 1, "pthread")]
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
clew — `main` (clew/cli.py) · 7 of 400 steps
… 70 earlier steps
… 313 later steps
tests/test_r1_richness.py:360 · its file's page
What it checks (1)
assert rows == [("Owner::run", 1, "pthread")]not attributed
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
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.
Requirements it verifies (3)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-SCHEMA-002 | catalog | unknown |
| REQ-DDB-SCHEMA-003 | catalog | unknown |
| REQ-DDB-SCHEMA-004 | catalog | unknown |
Also reaches 10 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-INDEX-002 inferred
- REQ-DDB-PIPE-003 measured
- REQ-DDB-PIPE-004 measured
- REQ-DDB-PIPE-011 measured
- REQ-DDB-PIPE-012 inferred
- REQ-DDB-QUERY-003 measured
- REQ-DDB-QUERY-011 measured
- REQ-DDB-SCHEMA-001 measured
- REQ-DDB-SCHEMA-007 measured
- REQ-DDB-SCHEMA-012 measured