test_a_declared_macro_wins_over_the_header

Tests › tests/test_preprocessor.py

passed Passed in the packaged run.

What this test is for

Why it exists

Doxygen's behaviour on a duplicated PREDEFINED name is not something to rely on, so the collision is resolved where the rule can be stated: the owner typed one of these by hand and the other was read out of a file.

Given

  1. root = tmp_path / "repo"
  2. root.mkdir()
  3. (root / "cfg.h").write_text("#define WIDTH 8\n#define ONLY_IN_HEADER 1\n", encoding="utf-8")
→

When

  1. config = resolve_preprocessor( root, {SECTION_PREPROCESSOR: {"predefined": ["WIDTH=16"], "config_header": "cfg.h"}}, )
→

Then

  1. ✓ config.macros contains '"WIDTH=16"'
  2. ✓ config.macros does not contain '"WIDTH=8"'
  3. ✓ config.macros contains '"ONLY_IN_HEADER=1"'
  4. ✓ config.source equals SOURCE_BOTH

tests/test_preprocessor.py:607 · its file's page

What it checks (4)

  1. assert '"WIDTH=16"' in config.macros observes resolve_preprocessor via config
  2. assert '"WIDTH=8"' not in config.macros, "the header overrode a hand-written declaration" observes resolve_preprocessor via config
  3. assert '"ONLY_IN_HEADER=1"' in config.macros, "the header's other macros were dropped" observes resolve_preprocessor via config
  4. assert config.source == SOURCE_BOTH observes resolve_preprocessor via config

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_declared_macro_wins_over_the_header→resolve_preprocessor

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_declared_macro_wins_over_the_header · 4 checksresolve_preprocessorREQ-DDB-CONFIG-004 · measuredresolve_preprocessor_resolve_config_header_named_config_headerwithin_repoREQ-DDB-PIPE-014 · measured
Also reaches 2 requirements

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