test_an_operandless_primitive_is_scoped_global_not_unknown¶
Tests › tests/test_critical_sections.py
What this test is for
Why it exists
gh#47 part 3. `_class_scope` reports an unresolved scope as `unknown` "rather than silently collapsing into a global", which is right for a mutex whose OWNER could not be found — the identity exists and we failed to resolve it.
Given
parser = Parser("c")patterns = { "irq_disable": LockPattern( "irq_disable", form="call", kind="mutex", role="acquire", releases="irq_restore" ) }
When
sites = _walk_lock_sites(parser.parse(_OPERANDLESS), _OPERANDLESS, patterns)for site in sites: assert site[2] == "global", ( f"an operand-less primitive has no owner to fail to resolve; scope was {site[2]!r}" )
Then
- ✓ len(sites) equals 2
- ✓ sorted(site[3] for site in sites) equals [7, 14]
tests/test_critical_sections.py:746 · its file's page
What it checks (3)
assert len(sites) == 2, f"both acquisitions must be found, got {len(sites)}"observes_walk_lock_sitesviasitesassert site[2] == "global", ( f"an operand-less primitive has no owner to fail to resolve; scope was {site[2]!r}" )not attributedassert sorted(site[3] for site in sites) == [7, 14], ( "the acquisition that drops the returned state must be recorded too" )observes_walk_lock_sitesviasites
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_an_operandless_primitive_is_scoped_global_not_unknown→_walk_lock_sitesWhat 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 2 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-PIPE-003 measured
- REQ-DDB-SCHEMA-011 measured