test_an_operandless_primitive_is_scoped_global_not_unknown

Tests › tests/test_critical_sections.py

passed Passed in the packaged run.

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

  1. parser = Parser("c")
  2. patterns = { "irq_disable": LockPattern( "irq_disable", form="call", kind="mutex", role="acquire", releases="irq_restore" ) }
→

When

  1. sites = _walk_lock_sites(parser.parse(_OPERANDLESS), _OPERANDLESS, patterns)
  2. 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

  1. ✓ len(sites) equals 2
  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)

  1. assert len(sites) == 2, f"both acquisitions must be found, got {len(sites)}" observes _walk_lock_sites via sites
  2. assert site[2] == "global", ( f"an operand-less primitive has no owner to fail to resolve; scope was {site[2]!r}" ) not attributed
  3. assert sorted(site[3] for site in sites) == [7, 14], ( "the acquisition that drops the returned state must be recorded too" ) observes _walk_lock_sites via sites

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_sites

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_an_operandless_primitive_is_scoped_global_not_unknown · 3 checks_walk_lock_sites… 3 calls …enclosingREQ-DDB-PIPE-003 · measured_walk_lock_sites… 3 calls …resolve_sectionREQ-DDB-SCHEMA-011 · measured
Also reaches 2 requirements

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