test_an_include_guard_is_not_an_option¶
Tests › tests/test_config_defaults.py
What this test is for
Why it exists
`#ifndef FOO_H` / `#define FOO_H` IS "INCLUDE ME ONCE", NOT A FEATURE. Measured on the real mbedtls tree before this exclusion: 39 of 1,206 "on" rows were guards, and nobody asks whether MBEDTLS_CONFIG_H is enabled by default. Left in, they rank EXACT on their own names in the discovery surface and become pure noise — the same reason `kconfig_gates` excludes them from gating sites.
Given
repo = tmp_path / "repo"(repo / "include").mkdir(parents=True)
7 more
(repo / "include" / "guard_config.h").write_text( "#ifndef PROJ_CONFIG_H\n" "#define PROJ_CONFIG_H\n" "#define FEATURE_REAL_OPTION\n" "//#define FEATURE_OFF_OPTION\n" "#endif\n", encoding="utf-8", )db = tmp_path / "guard.db"conn = sqlite3.connect(str(db))conn.execute("CREATE TABLE path (rowid INTEGER PRIMARY KEY, name TEXT)")conn.execute("INSERT INTO path (rowid, name) VALUES (1, 'include/guard_config.h')")conn.commit()conn.close()
When
import_config_defaults(db, repo)conn = sqlite3.connect(str(db))names = {r[0] for r in conn.execute("SELECT macro FROM config_defaults").fetchall()}conn.close()
Then
- ✓ names does not contain "PROJ_CONFIG_H"
- ✓ names contains "FEATURE_REAL_OPTION"
- ✓ names contains "FEATURE_OFF_OPTION"
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_config_defaults.py:229 · its file's page
What it checks (3)
assert "PROJ_CONFIG_H" not in names, "an include guard is not a configuration option"not attributedassert "FEATURE_REAL_OPTION" in namesnot attributedassert "FEATURE_OFF_OPTION" in namesnot 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.
Also reaches 5 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-PIPE-003 measured
- REQ-DDB-PIPE-011 measured
- REQ-DDB-PIPE-012 inferred
- REQ-DDB-PIPE-015 measured
- REQ-DDB-SCHEMA-012 measured