test_guard_edge_cases.py

tests/guard/test_guard_edge_cases.py

Edge case tests covering capability analysis findings.

test_a_changed_signature_with_a_bump_is_clean

test_guard_edge_cases.TestChangedSignature.test_a_changed_signature_with_a_bump_is_clean(self)

tests/guard/test_guard_edge_cases.py:553

Show on the map →

Called by none

Calls _sig, _stale

Checks

  • assert (_stale(_sig("int x", "1", "return x;"), _sig("int x, int y", "2", "return x * y;")) == [] )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_a_changed_signature_with_a_bump_is_clean → _stale → check_version_staleness
REQ-DDB-GUARD-018measuredtest_a_changed_signature_with_a_bump_is_clean → _stale → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_a_changed_signature_with_a_bump_is_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_a_changed_signature_with_a_bump_is_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_a_changed_signature_with_a_bump_is_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_a_changed_signature_with_a_bump_is_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_a_changed_signature_with_a_bump_is_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 6 lines
    def test_a_changed_signature_with_a_bump_is_clean(self):
        assert (
            _stale(_sig("int x", "1", "return x;"), _sig("int x, int y", "2", "return x * y;"))
            == []
        )
Activity · 1 steps
lines 554–557assert ( _stale(_sig("int x", "1", "return x;"), _sig("int x, int y", "2", "return x * y;")) == [] )

test_a_changed_signature_without_a_bump_is_stale

test_guard_edge_cases.TestChangedSignature.test_a_changed_signature_without_a_bump_is_stale(self)

tests/guard/test_guard_edge_cases.py:547

Show on the map →

Called by none

Calls _sig, _stale

Checks

  • assert [v.check for v in violations] == ["version"], violations

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_a_changed_signature_without_a_bump_is_stale → _stale → check_version_staleness
REQ-DDB-GUARD-018measuredtest_a_changed_signature_without_a_bump_is_stale → _stale → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_a_changed_signature_without_a_bump_is_stale → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_a_changed_signature_without_a_bump_is_stale → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_a_changed_signature_without_a_bump_is_stale → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_a_changed_signature_without_a_bump_is_stale → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_a_changed_signature_without_a_bump_is_stale → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 6 lines
    def test_a_changed_signature_without_a_bump_is_stale(self):
        violations = _stale(
            _sig("int x", "1", "return x;"), _sig("int x, int y", "1", "return x * y;")
        )
        assert [v.check for v in violations] == ["version"], violations
Activity · 2 steps
lines 548–550violations = _stale( _sig("int x", "1", "return x;"), _sig("int x, int y", "1", "return x * y;") )lines 551–551assert [v.check for v in violations] == ["version"], violations

test_added_copy_leaves_existing_copies_clean

test_guard_edge_cases.TestPreprocessorDuplicates.test_added_copy_leaves_existing_copies_clean(self)

tests/guard/test_guard_edge_cases.py:520

Show on the map →

Called by none

Calls _copy, _stale

Checks

  • assert _stale(head, current) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_added_copy_leaves_existing_copies_clean → _stale → check_version_staleness
REQ-DDB-GUARD-018measuredtest_added_copy_leaves_existing_copies_clean → _stale → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_added_copy_leaves_existing_copies_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_added_copy_leaves_existing_copies_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_added_copy_leaves_existing_copies_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_added_copy_leaves_existing_copies_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_added_copy_leaves_existing_copies_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 5 lines
    def test_added_copy_leaves_existing_copies_clean(self):
        head = _copy("#ifdef X", "1", "return 1;") + "#endif\n"
        current = head + _copy("#ifdef Y", "1", "return 5;") + "#endif\n"
        assert _stale(head, current) == []
Activity · 3 steps
lines 521–521head = _copy("#ifdef X", "1", "return 1;") + "#endif\n"lines 522–522current = head + _copy("#ifdef Y", "1", "return 5;") + "#endif\n"lines 523–523assert _stale(head, current) == []

test_an_overload_set_keeps_the_exact_match

test_guard_edge_cases.TestChangedSignature.test_an_overload_set_keeps_the_exact_match(self)

tests/guard/test_guard_edge_cases.py:559

Show on the map →

Called by none

Calls _sig, _stale

Checks

  • assert _stale(head, current) == [], "an overload's new sibling is new, as #11 requires"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_an_overload_set_keeps_the_exact_match → _stale → check_version_staleness
REQ-DDB-GUARD-018measuredtest_an_overload_set_keeps_the_exact_match → _stale → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_an_overload_set_keeps_the_exact_match → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_an_overload_set_keeps_the_exact_match → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_an_overload_set_keeps_the_exact_match → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_an_overload_set_keeps_the_exact_match → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_an_overload_set_keeps_the_exact_match → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 4 lines
    def test_an_overload_set_keeps_the_exact_match(self):
        head = _sig("int x", "1", "return x;") + _sig("double x", "1", "return 0;")
        current = _sig("int x", "1", "return x;") + _sig("float x", "1", "return 1;")
        assert _stale(head, current) == [], "an overload's new sibling is new, as #11 requires"

1 more lines, not shown

Activity · 3 steps
lines 560–560head = _sig("int x", "1", "return x;") + _sig("double x", "1", "return 0;")lines 561–561current = _sig("int x", "1", "return x;") + _sig("float x", "1", "return 1;")lines 562–562assert _stale(head, current) == [], "an overload's new sibling is new, as #11 requires"

test_attribute_inline

test_guard_edge_cases.TestGccAttributes.test_attribute_inline(self)

__attribute__ on same line as other content still works.

tests/guard/test_guard_edge_cases.py:345

Show on the map →

Called by none

Calls parse_c

Checks

  • assert len(functions) == 1
  • assert functions[0].doxygen is not None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_attribute_inline → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_attribute_inline → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_attribute_inline → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_attribute_inline → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_attribute_inline → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_attribute_inline → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 16 lines
    def test_attribute_inline(self):
        """__attribute__ on same line as other content still works."""
        content = dedent("""\
            /**
             * @brief Inlined helper.
             * @version 1.0
             */
            __attribute__((always_inline))
            void inline_helper(void) {
                fast_stuff();
            }
        """)
        functions = parse_c(content)
        assert len(functions) == 1
        assert functions[0].doxygen is not None
Activity · 4 steps
lines 347–356content = dedent("""\ /** * @brief Inlined helper. * @version 1.0 */ __attribute__((always_inline)) void inline_helper(void) { fast_stuff(); } """)lines 357–357functions = parse_c(content)lines 358–358assert len(functions) == 1lines 359–359assert functions[0].doxygen is not None

test_attribute_unused

test_guard_edge_cases.TestGccAttributes.test_attribute_unused(self)

tests/guard/test_guard_edge_cases.py:328

Show on the map →

Called by none

Calls parse_c

Checks

  • assert "unused_callback" in names
  • assert names["unused_callback"].doxygen is not None
  • assert "version" in names["unused_callback"].doxygen.tags

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_attribute_unused → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_attribute_unused → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_attribute_unused → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_attribute_unused → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_attribute_unused → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_attribute_unused → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 9 lines
    def test_attribute_unused(self):
        content = (FIXTURES_DIR / "attribute.c").read_text()
        functions = parse_c(content)
        names = {f.name: f for f in functions}

        assert "unused_callback" in names
        assert names["unused_callback"].doxygen is not None
        assert "version" in names["unused_callback"].doxygen.tags
Activity · 6 steps
lines 329–329content = (FIXTURES_DIR / "attribute.c").read_text()lines 330–330functions = parse_c(content)lines 331–331names = {f.name: f for f in functions}lines 333–333assert "unused_callback" in nameslines 334–334assert names["unused_callback"].doxygen is not Nonelines 335–335assert "version" in names["unused_callback"].doxygen.tags

test_attribute_visibility_hidden

test_guard_edge_cases.TestGccAttributes.test_attribute_visibility_hidden(self)

tests/guard/test_guard_edge_cases.py:319

Show on the map →

Called by none

Calls parse_c

Checks

  • assert "queue_inbound_event" in names
  • assert names["queue_inbound_event"].doxygen is not None
  • assert "brief" in names["queue_inbound_event"].doxygen.tags

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_attribute_visibility_hidden → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_attribute_visibility_hidden → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_attribute_visibility_hidden → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_attribute_visibility_hidden → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_attribute_visibility_hidden → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_attribute_visibility_hidden → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 9 lines
    def test_attribute_visibility_hidden(self):
        content = (FIXTURES_DIR / "attribute.c").read_text()
        functions = parse_c(content)
        names = {f.name: f for f in functions}

        assert "queue_inbound_event" in names
        assert names["queue_inbound_event"].doxygen is not None
        assert "brief" in names["queue_inbound_event"].doxygen.tags
Activity · 6 steps
lines 320–320content = (FIXTURES_DIR / "attribute.c").read_text()lines 321–321functions = parse_c(content)lines 322–322names = {f.name: f for f in functions}lines 324–324assert "queue_inbound_event" in nameslines 325–325assert names["queue_inbound_event"].doxygen is not Nonelines 326–326assert "brief" in names["queue_inbound_event"].doxygen.tags

test_bad_tags_all_fail

test_guard_edge_cases.TestTagValidation.test_bad_tags_all_fail(self)

tests/guard/test_guard_edge_cases.py:198

Show on the map →

Called by none

Calls _make_tag_config, check_tags, parse_c

Checks

  • assert len(bad_func_violations) >= 3
  • assert "does not match pattern" in messages
  • assert "does not start with" in messages
  • assert "does not contain" in messages

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-003measuredtest_bad_tags_all_fail → check_tags
REQ-DDB-GUARD-018measuredtest_bad_tags_all_fail → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_bad_tags_all_fail → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_bad_tags_all_fail → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_bad_tags_all_fail → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_bad_tags_all_fail → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_bad_tags_all_fail → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 18 lines
    def test_bad_tags_all_fail(self):
        content = (FIXTURES_DIR / "bad_tags.c").read_text()
        config = self._make_tag_config()
        functions = parse_c(content)

        violations = check_tags(functions, "bad_tags.c", config)
        bad_func_violations = [v for v in violations if "Bad_Tags" in v.message]

        # @req INVALID-FORMAT → pattern fail + missing confidence marker
        # @sends BADPREFIX_EVENT → prefix fail
        # @calls modfunc → contains fail
        assert len(bad_func_violations) >= 3

        messages = " ".join(v.message for v in bad_func_violations)
        assert "does not match pattern" in messages
        assert "does not start with" in messages
        assert "does not contain" in messages
Activity · 10 steps
lines 199–199content = (FIXTURES_DIR / "bad_tags.c").read_text()lines 200–200config = self._make_tag_config()lines 201–201functions = parse_c(content)lines 203–203violations = check_tags(functions, "bad_tags.c", config)lines 204–204bad_func_violations = [v for v in violations if "Bad_Tags" in v.message]lines 209–209assert len(bad_func_violations) >= 3lines 211–211messages = " ".join(v.message for v in bad_func_violations)lines 212–212assert "does not match pattern" in messageslines 213–213assert "does not start with" in messageslines 214–214assert "does not contain" in messages

test_braces_in_strings_body_end

test_guard_edge_cases.TestBracesInStrings.test_braces_in_strings_body_end(self)

Brace counting does not account for braces inside string literals.

tests/guard/test_guard_edge_cases.py:229

Show on the map →

Called by none

Calls parse_c

Checks

  • assert "Braces_In_String" in names
  • assert "After_String_Braces" in names
  • assert braces_func.body_end < after_func.def_line

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_braces_in_strings_body_end → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_braces_in_strings_body_end → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_braces_in_strings_body_end → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_braces_in_strings_body_end → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_braces_in_strings_body_end → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_braces_in_strings_body_end → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 21 lines
    def test_braces_in_strings_body_end(self):
        """Brace counting does not account for braces inside string literals.

        This documents a known limitation. The parser counts ALL braces,
        including those in strings. For most real code this works because
        string braces are balanced (e.g., printf("{}")).
        """
        content = (FIXTURES_DIR / "braces_in_strings.c").read_text()
        functions = parse_c(content)

        names = [f.name for f in functions]
        assert "Braces_In_String" in names
        assert "After_String_Braces" in names

        # With balanced string braces, body end detection still works
        braces_func = [f for f in functions if f.name == "Braces_In_String"][0]
        after_func = [f for f in functions if f.name == "After_String_Braces"][0]

        # Braces_In_String body should end before After_String_Braces starts
        assert braces_func.body_end < after_func.def_line
Activity · 8 steps
lines 236–236content = (FIXTURES_DIR / "braces_in_strings.c").read_text()lines 237–237functions = parse_c(content)lines 239–239names = [f.name for f in functions]lines 240–240assert "Braces_In_String" in nameslines 241–241assert "After_String_Braces" in nameslines 244–244braces_func = [f for f in functions if f.name == "Braces_In_String"][0]lines 245–245after_func = [f for f in functions if f.name == "After_String_Braces"][0]lines 248–248assert braces_func.body_end < after_func.def_line

test_decorative_not_treated_as_doxygen

test_guard_edge_cases.TestDecorativeComments.test_decorative_not_treated_as_doxygen(self)

tests/guard/test_guard_edge_cases.py:16

Show on the map →

Called by none

Calls parse_c

Checks

  • assert names["Documented_After_Decorative"].doxygen is not None
  • assert "brief" in names["Documented_After_Decorative"].doxygen.tags
  • assert names["After_Regular_Comment"].doxygen is None
  • assert names["After_Line_Comment"].doxygen is None
  • assert names["After_Second_Decorative"].doxygen is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_decorative_not_treated_as_doxygen → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_decorative_not_treated_as_doxygen → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_decorative_not_treated_as_doxygen → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_decorative_not_treated_as_doxygen → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_decorative_not_treated_as_doxygen → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_decorative_not_treated_as_doxygen → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 14 lines
    def test_decorative_not_treated_as_doxygen(self):
        content = (FIXTURES_DIR / "mixed_comments.c").read_text()
        functions = parse_c(content)
        names = {f.name: f for f in functions}

        # Decorative block should NOT be associated with the function
        assert names["Documented_After_Decorative"].doxygen is not None
        assert "brief" in names["Documented_After_Decorative"].doxygen.tags

        # Functions after decorative/regular/line comments should have no doxygen
        assert names["After_Regular_Comment"].doxygen is None
        assert names["After_Line_Comment"].doxygen is None
        assert names["After_Second_Decorative"].doxygen is None
Activity · 8 steps
lines 17–17content = (FIXTURES_DIR / "mixed_comments.c").read_text()lines 18–18functions = parse_c(content)lines 19–19names = {f.name: f for f in functions}lines 22–22assert names["Documented_After_Decorative"].doxygen is not Nonelines 23–23assert "brief" in names["Documented_After_Decorative"].doxygen.tagslines 26–26assert names["After_Regular_Comment"].doxygen is Nonelines 27–27assert names["After_Line_Comment"].doxygen is Nonelines 28–28assert names["After_Second_Decorative"].doxygen is None

test_decorative_triggers_presence_violation

test_guard_edge_cases.TestDecorativeComments.test_decorative_triggers_presence_violation(self)

tests/guard/test_guard_edge_cases.py:30

Checks

  • assert len(undoc_violations) == 3

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001inferredtest_decorative_triggers_presence_violation → validate_file → get_file_at_revision → run_git → git_argv
REQ-DDB-CONFIG-009measuredtest_decorative_triggers_presence_violation → validate_file → gate_exclusion
REQ-DDB-GUARD-001measuredtest_decorative_triggers_presence_violation → validate_file
REQ-DDB-GUARD-002inferredtest_decorative_triggers_presence_violation → validate_file → check_version_staleness
REQ-DDB-GUARD-003measuredtest_decorative_triggers_presence_violation → validate_file → check_tags
REQ-DDB-GUARD-004measuredtest_decorative_triggers_presence_violation → validate_file → check_req_coverage
REQ-DDB-GUARD-005measuredtest_decorative_triggers_presence_violation → validate_file → check_return_presence
REQ-DDB-GUARD-006measuredtest_decorative_triggers_presence_violation → validate_file → check_file_presence
REQ-DDB-GUARD-007measuredtest_decorative_triggers_presence_violation → validate_file → check_duplicate_tags
REQ-DDB-GUARD-009inferredtest_decorative_triggers_presence_violation → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version
REQ-DDB-GUARD-011inferredtest_decorative_triggers_presence_violation → validate_file → check_req_coverage → _has_active_requirements → load_requirements_full
REQ-DDB-GUARD-013measuredtest_decorative_triggers_presence_violation → validate_file → unconfigured_language
REQ-DDB-GUARD-014inferredtest_decorative_triggers_presence_violation → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version → parse_version
REQ-DDB-GUARD-016inferredtest_decorative_triggers_presence_violation → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version → _summarise_id
REQ-DDB-GUARD-018measuredtest_decorative_triggers_presence_violation → validate_file → parse_source_file
REQ-DDB-GUARD-019measuredtest_decorative_triggers_presence_violation → validate_file → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_decorative_triggers_presence_violation → validate_file → parse_content_for_file → language_for_file
REQ-DDB-GUARD-021inferredtest_decorative_triggers_presence_violation → validate_file → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-023inferredtest_decorative_triggers_presence_violation → validate_file → get_file_at_revision
REQ-DDB-GUARD-024inferredtest_decorative_triggers_presence_violation → validate_file → check_file_presence → _check_file_block_tags → apply_autobrief
REQ-DDB-GUARD-025measuredtest_decorative_triggers_presence_violation → validate_file → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
REQ-DDB-GUARD-026measuredtest_decorative_triggers_presence_violation → validate_file → check_bus_tags
REQ-DDB-GUARD-027inferredtest_decorative_triggers_presence_violation → validate_file → check_req_exists → _uncheckable
REQ-DDB-PIPE-011measuredtest_decorative_triggers_presence_violation → validate_file → gate_exclusion → binary_file
REQ-DDB-WIKI-054inferredtest_decorative_triggers_presence_violation → validate_file → gate_exclusion → _gate_matcher → load_toolchain_config → _string_list → all
Source · 11 lines
    def test_decorative_triggers_presence_violation(self):
        violations = validate_file(
            str(FIXTURES_DIR / "mixed_comments.c"),
            CONFIG_DEFAULTS,
            no_git=True,
        )
        # 3 undocumented functions: After_Regular_Comment, After_Line_Comment,
        # After_Second_Decorative
        undoc_violations = [v for v in violations if "no doxygen comment" in v.message]
        assert len(undoc_violations) == 3
Activity · 3 steps
lines 31–35violations = validate_file( str(FIXTURES_DIR / "mixed_comments.c"), CONFIG_DEFAULTS, no_git=True, )lines 38–38undoc_violations = [v for v in violations if "no doxygen comment" in v.message]lines 39–39assert len(undoc_violations) == 3

test_double_star_still_matches

test_guard_edge_cases.TestDecorativeComments.test_double_star_still_matches(self)

Ensure /** (exactly two stars) is still recognized.

tests/guard/test_guard_edge_cases.py:41

Show on the map →

Called by none

Calls parse_c

Checks

  • assert len(functions) == 1
  • assert functions[0].doxygen is not None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_double_star_still_matches → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_double_star_still_matches → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_double_star_still_matches → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_double_star_still_matches → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_double_star_still_matches → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_double_star_still_matches → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 11 lines
    def test_double_star_still_matches(self):
        """Ensure /** (exactly two stars) is still recognized."""
        lines = [
            "/** @brief Test. @version 1.0 */",
            "void Func(void) {",
        ]
        functions = parse_c("\n".join(lines))
        assert len(functions) == 1
        assert functions[0].doxygen is not None

Activity · 4 steps
lines 43–46lines = [ "/** @brief Test. @version 1.0 */", "void Func(void) {", ]lines 47–47functions = parse_c("\n".join(lines))lines 48–48assert len(functions) == 1lines 49–49assert functions[0].doxygen is not None

test_first_copy_edited_with_bump_is_clean

test_guard_edge_cases.TestPreprocessorDuplicates.test_first_copy_edited_with_bump_is_clean(self)

tests/guard/test_guard_edge_cases.py:514

Show on the map →

Called by none

Calls _stale

Checks

  • assert _stale(self._BOTH, current) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_first_copy_edited_with_bump_is_clean → _stale → check_version_staleness
REQ-DDB-GUARD-018measuredtest_first_copy_edited_with_bump_is_clean → _stale → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_first_copy_edited_with_bump_is_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_first_copy_edited_with_bump_is_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_first_copy_edited_with_bump_is_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_first_copy_edited_with_bump_is_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_first_copy_edited_with_bump_is_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 6 lines
    def test_first_copy_edited_with_bump_is_clean(self):
        current = self._BOTH.replace("return *old + 1;", "return 9;").replace(
            " * @version 1\n", " * @version 2\n", 1
        )
        assert _stale(self._BOTH, current) == []
Activity · 2 steps
lines 515–517current = self._BOTH.replace("return *old + 1;", "return 9;").replace( " * @version 1\n", " * @version 2\n", 1 )lines 518–518assert _stale(self._BOTH, current) == []

test_first_copy_edited_without_bump_differing_versions_is_flagged

test_guard_edge_cases.TestPreprocessorDuplicates.test_first_copy_edited_without_bump_differing_versions_is_flagged(self)

tests/guard/test_guard_edge_cases.py:503

Show on the map →

Called by none

Calls _copy, _stale

Checks

  • assert len(violations) == 1 and violations[0].line == 7, violations

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_first_copy_edited_without_bump_differing_versions_is_flagged → _stale → check_version_staleness
REQ-DDB-GUARD-018measuredtest_first_copy_edited_without_bump_differing_versions_is_flagged → _stale → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_first_copy_edited_without_bump_differing_versions_is_flagged → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_first_copy_edited_without_bump_differing_versions_is_flagged → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_first_copy_edited_without_bump_differing_versions_is_flagged → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_first_copy_edited_without_bump_differing_versions_is_flagged → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_first_copy_edited_without_bump_differing_versions_is_flagged → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 6 lines
    def test_first_copy_edited_without_bump_differing_versions_is_flagged(self):
        head = _copy("#ifdef X", "1", "return 1;") + _copy("#else", "2", "return 2;") + "#endif\n"
        current = head.replace("return 1;", "return 99;")
        violations = _stale(head, current)
        assert len(violations) == 1 and violations[0].line == 7, violations
Activity · 4 steps
lines 504–504head = _copy("#ifdef X", "1", "return 1;") + _copy("#else", "2", "return 2;") + "#endif\n"lines 505–505current = head.replace("return 1;", "return 99;")lines 506–506violations = _stale(head, current)lines 507–507assert len(violations) == 1 and violations[0].line == 7, violations

test_good_tags_all_pass

test_guard_edge_cases.TestTagValidation.test_good_tags_all_pass(self)

tests/guard/test_guard_edge_cases.py:216

Show on the map →

Called by none

Calls _make_tag_config, check_tags, parse_c

Checks

  • assert good_func_violations == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-003measuredtest_good_tags_all_pass → check_tags
REQ-DDB-GUARD-018measuredtest_good_tags_all_pass → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_good_tags_all_pass → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_good_tags_all_pass → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_good_tags_all_pass → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_good_tags_all_pass → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_good_tags_all_pass → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 10 lines
    def test_good_tags_all_pass(self):
        content = (FIXTURES_DIR / "bad_tags.c").read_text()
        config = self._make_tag_config()
        functions = parse_c(content)

        violations = check_tags(functions, "bad_tags.c", config)
        good_func_violations = [v for v in violations if "Good_Tags" in v.message]
        assert good_func_violations == []

Activity · 6 steps
lines 217–217content = (FIXTURES_DIR / "bad_tags.c").read_text()lines 218–218config = self._make_tag_config()lines 219–219functions = parse_c(content)lines 221–221violations = check_tags(functions, "bad_tags.c", config)lines 222–222good_func_violations = [v for v in violations if "Good_Tags" in v.message]lines 223–223assert good_func_violations == []

test_inline_typedef_return

test_guard_edge_cases.TestTypedefReturnsAndMacroQualifiers.test_inline_typedef_return(self)

tests/guard/test_guard_edge_cases.py:432

Show on the map →

Called by none

Calls parse_c

Checks

  • assert len(functions) == 1
  • assert functions[0].name == "convert_error"
  • assert functions[0].doxygen is not None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_inline_typedef_return → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_inline_typedef_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_inline_typedef_return → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_inline_typedef_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_inline_typedef_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_inline_typedef_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 15 lines
    def test_inline_typedef_return(self):
        content = dedent("""\
            /**
             * @brief Convert error code.
             * @version 1.0
             */
            err_code_t convert_error(int raw) {
                return (err_code_t)raw;
            }
        """)
        functions = parse_c(content)
        assert len(functions) == 1
        assert functions[0].name == "convert_error"
        assert functions[0].doxygen is not None
Activity · 5 steps
lines 433–441content = dedent("""\ /** * @brief Convert error code. * @version 1.0 */ err_code_t convert_error(int raw) { return (err_code_t)raw; } """)lines 442–442functions = parse_c(content)lines 443–443assert len(functions) == 1lines 444–444assert functions[0].name == "convert_error"lines 445–445assert functions[0].doxygen is not None

test_lowercase_typedef_return

test_guard_edge_cases.TestTypedefReturnsAndMacroQualifiers.test_lowercase_typedef_return(self)

tests/guard/test_guard_edge_cases.py:387

Show on the map →

Called by none

Calls parse_c

Checks

  • assert "get_status" in names
  • assert names["get_status"].doxygen is not None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_lowercase_typedef_return → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_lowercase_typedef_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_lowercase_typedef_return → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_lowercase_typedef_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_lowercase_typedef_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_lowercase_typedef_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 7 lines
    def test_lowercase_typedef_return(self):
        content = (FIXTURES_DIR / "typedef_returns.c").read_text()
        functions = parse_c(content)
        names = {f.name: f for f in functions}
        assert "get_status" in names
        assert names["get_status"].doxygen is not None
Activity · 5 steps
lines 388–388content = (FIXTURES_DIR / "typedef_returns.c").read_text()lines 389–389functions = parse_c(content)lines 390–390names = {f.name: f for f in functions}lines 391–391assert "get_status" in nameslines 392–392assert names["get_status"].doxygen is not None

test_modified_overload_flags_only_that_overload

test_guard_edge_cases.TestVersionStaleness.test_modified_overload_flags_only_that_overload(self)

Changing one overload's body must not falsely flag its siblings.

tests/guard/test_guard_edge_cases.py:141

Show on the map →

Called by none

Calls check_version_staleness, parse_cpp

Checks

  • assert len(violations) == 1
  • assert violations[0].line == functions[0].def_line + 1 # the react(EventA) overload

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_modified_overload_flags_only_that_overload → check_version_staleness
REQ-DDB-GUARD-018measuredtest_modified_overload_flags_only_that_overload → parse_cpp → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_modified_overload_flags_only_that_overload → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_modified_overload_flags_only_that_overload → parse_cpp → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_modified_overload_flags_only_that_overload → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_modified_overload_flags_only_that_overload → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_modified_overload_flags_only_that_overload → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 38 lines
    def test_modified_overload_flags_only_that_overload(self):
        """Changing one overload's body must not falsely flag its siblings."""
        head_content = dedent("""\
            class Fsm {
            public:
                /**
                 * @brief Handle event A.
                 * @version 1.0.0
                 */
                virtual void react(EventA const& e) {
                    old_handle_a(e);
                }

                /**
                 * @brief Handle event B.
                 * @version 1.0.0
                 */
                virtual void react(EventB const& e) {
                    handle_b(e);
                }
            };
        """)
        content = head_content.replace("old_handle_a(e);", "new_handle_a(e);")
        functions = parse_cpp(content)
        head_functions = parse_cpp(head_content)

        violations = check_version_staleness(
            functions,
            "fsm.hpp",
            CONFIG_DEFAULTS,
            content,
            head_functions,
            head_content,
        )
        assert len(violations) == 1
        assert violations[0].line == functions[0].def_line + 1  # the react(EventA) overload

Activity · 7 steps
lines 143–162head_content = dedent("""\ class Fsm { public: /** * @brief Handle event A. * @version 1.0.0 */ virtual void react(EventA const& e) { old_handle_a(e); } /** * @brief Handle event B. * @version 1.0.0 */ virtual void react(EventB const& e) { handle_b(e); } }; """)lines 163–163content = head_content.replace("old_handle_a(e);", "new_handle_a(e);")lines 164–164functions = parse_cpp(content)lines 165–165head_functions = parse_cpp(head_content)lines 167–174violations = check_version_staleness( functions, "fsm.hpp", CONFIG_DEFAULTS, content, head_functions, head_content, )lines 175–175assert len(violations) == 1lines 176–176assert violations[0].line == functions[0].def_line + 1

test_multiline_attribute_is_handled_correctly

test_guard_edge_cases.TestGccAttributes.test_multiline_attribute_is_handled_correctly(self)

Multi-line __attribute__ breaks doxygen association (known limitation).

tests/guard/test_guard_edge_cases.py:361

Show on the map →

Called by none

Calls parse_c

Checks

  • assert len(functions) == 1
  • assert functions[0].doxygen is not None
  • assert functions[0].doxygen.tags["brief"] == ["Multi-attr function."]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_multiline_attribute_is_handled_correctly → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_multiline_attribute_is_handled_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_multiline_attribute_is_handled_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_multiline_attribute_is_handled_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_multiline_attribute_is_handled_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_multiline_attribute_is_handled_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 23 lines
    def test_multiline_attribute_is_handled_correctly(self):
        """Multi-line __attribute__ breaks doxygen association (known limitation)."""
        content = dedent("""\
            /**
             * @brief Multi-attr function.
             * @version 1.0
             */
            __attribute__((visibility("hidden"),
                           unused))
            void multi_attr(void) {
                work();
            }
        """)
        functions = parse_c(content)
        assert len(functions) == 1
        # The AST path associates the block through the multi-line attribute. The
        # former assertion (doxygen is None) encoded a regex-path limitation: its
        # backward scan stopped on the attribute's second line and never found */.
        # That limitation does not exist in production.
        assert functions[0].doxygen is not None
        assert functions[0].doxygen.tags["brief"] == ["Multi-attr function."]

Activity · 5 steps
lines 363–373content = dedent("""\ /** * @brief Multi-attr function. * @version 1.0 */ __attribute__((visibility("hidden"), unused)) void multi_attr(void) { work(); } """)lines 374–374functions = parse_c(content)lines 375–375assert len(functions) == 1lines 380–380assert functions[0].doxygen is not Nonelines 381–381assert functions[0].doxygen.tags["brief"] == ["Multi-attr function."]

test_no_false_positives

test_guard_edge_cases.TestTypedefReturnsAndMacroQualifiers.test_no_false_positives(self)

tests/guard/test_guard_edge_cases.py:422

Checks

  • assert len(violations) == 1
  • assert "undocumented_func" in violations[0].message

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001inferredtest_no_false_positives → validate_file → get_file_at_revision → run_git → git_argv
REQ-DDB-CONFIG-009measuredtest_no_false_positives → validate_file → gate_exclusion
REQ-DDB-GUARD-001measuredtest_no_false_positives → validate_file
REQ-DDB-GUARD-002inferredtest_no_false_positives → validate_file → check_version_staleness
REQ-DDB-GUARD-003measuredtest_no_false_positives → validate_file → check_tags
REQ-DDB-GUARD-004measuredtest_no_false_positives → validate_file → check_req_coverage
REQ-DDB-GUARD-005measuredtest_no_false_positives → validate_file → check_return_presence
REQ-DDB-GUARD-006measuredtest_no_false_positives → validate_file → check_file_presence
REQ-DDB-GUARD-007measuredtest_no_false_positives → validate_file → check_duplicate_tags
REQ-DDB-GUARD-009inferredtest_no_false_positives → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version
REQ-DDB-GUARD-011inferredtest_no_false_positives → validate_file → check_req_coverage → _has_active_requirements → load_requirements_full
REQ-DDB-GUARD-013measuredtest_no_false_positives → validate_file → unconfigured_language
REQ-DDB-GUARD-014inferredtest_no_false_positives → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version → parse_version
REQ-DDB-GUARD-016inferredtest_no_false_positives → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version → _summarise_id
REQ-DDB-GUARD-018measuredtest_no_false_positives → validate_file → parse_source_file
REQ-DDB-GUARD-019measuredtest_no_false_positives → validate_file → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_no_false_positives → validate_file → parse_content_for_file → language_for_file
REQ-DDB-GUARD-021inferredtest_no_false_positives → validate_file → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-023inferredtest_no_false_positives → validate_file → get_file_at_revision
REQ-DDB-GUARD-024inferredtest_no_false_positives → validate_file → check_file_presence → _check_file_block_tags → apply_autobrief
REQ-DDB-GUARD-025measuredtest_no_false_positives → validate_file → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
REQ-DDB-GUARD-026measuredtest_no_false_positives → validate_file → check_bus_tags
REQ-DDB-GUARD-027inferredtest_no_false_positives → validate_file → check_req_exists → _uncheckable
REQ-DDB-PIPE-011measuredtest_no_false_positives → validate_file → gate_exclusion → binary_file
REQ-DDB-WIKI-054inferredtest_no_false_positives → validate_file → gate_exclusion → _gate_matcher → load_toolchain_config → _string_list → all
Source · 10 lines
    def test_no_false_positives(self):
        violations = validate_file(
            str(FIXTURES_DIR / "typedef_returns.c"),
            CONFIG_DEFAULTS,
            no_git=True,
        )
        # Only undocumented_func should fail
        assert len(violations) == 1
        assert "undocumented_func" in violations[0].message
Activity · 3 steps
lines 423–427violations = validate_file( str(FIXTURES_DIR / "typedef_returns.c"), CONFIG_DEFAULTS, no_git=True, )lines 429–429assert len(violations) == 1lines 430–430assert "undocumented_func" in violations[0].message

test_no_false_positives_with_attributes

test_guard_edge_cases.TestGccAttributes.test_no_false_positives_with_attributes(self)

tests/guard/test_guard_edge_cases.py:337

Checks

  • assert violations == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001inferredtest_no_false_positives_with_attributes → validate_file → get_file_at_revision → run_git → git_argv
REQ-DDB-CONFIG-009measuredtest_no_false_positives_with_attributes → validate_file → gate_exclusion
REQ-DDB-GUARD-001measuredtest_no_false_positives_with_attributes → validate_file
REQ-DDB-GUARD-002inferredtest_no_false_positives_with_attributes → validate_file → check_version_staleness
REQ-DDB-GUARD-003measuredtest_no_false_positives_with_attributes → validate_file → check_tags
REQ-DDB-GUARD-004measuredtest_no_false_positives_with_attributes → validate_file → check_req_coverage
REQ-DDB-GUARD-005measuredtest_no_false_positives_with_attributes → validate_file → check_return_presence
REQ-DDB-GUARD-006measuredtest_no_false_positives_with_attributes → validate_file → check_file_presence
REQ-DDB-GUARD-007measuredtest_no_false_positives_with_attributes → validate_file → check_duplicate_tags
REQ-DDB-GUARD-009inferredtest_no_false_positives_with_attributes → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version
REQ-DDB-GUARD-011inferredtest_no_false_positives_with_attributes → validate_file → check_req_coverage → _has_active_requirements → load_requirements_full
REQ-DDB-GUARD-013measuredtest_no_false_positives_with_attributes → validate_file → unconfigured_language
REQ-DDB-GUARD-014inferredtest_no_false_positives_with_attributes → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version → parse_version
REQ-DDB-GUARD-016inferredtest_no_false_positives_with_attributes → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version → _summarise_id
REQ-DDB-GUARD-018measuredtest_no_false_positives_with_attributes → validate_file → parse_source_file
REQ-DDB-GUARD-019measuredtest_no_false_positives_with_attributes → validate_file → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_no_false_positives_with_attributes → validate_file → parse_content_for_file → language_for_file
REQ-DDB-GUARD-021inferredtest_no_false_positives_with_attributes → validate_file → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-023inferredtest_no_false_positives_with_attributes → validate_file → get_file_at_revision
REQ-DDB-GUARD-024inferredtest_no_false_positives_with_attributes → validate_file → check_file_presence → _check_file_block_tags → apply_autobrief
REQ-DDB-GUARD-025measuredtest_no_false_positives_with_attributes → validate_file → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
REQ-DDB-GUARD-026measuredtest_no_false_positives_with_attributes → validate_file → check_bus_tags
REQ-DDB-GUARD-027inferredtest_no_false_positives_with_attributes → validate_file → check_req_exists → _uncheckable
REQ-DDB-PIPE-011measuredtest_no_false_positives_with_attributes → validate_file → gate_exclusion → binary_file
REQ-DDB-WIKI-054inferredtest_no_false_positives_with_attributes → validate_file → gate_exclusion → _gate_matcher → load_toolchain_config → _string_list → all
Source · 8 lines
    def test_no_false_positives_with_attributes(self):
        violations = validate_file(
            str(FIXTURES_DIR / "attribute.c"),
            CONFIG_DEFAULTS,
            no_git=True,
        )
        assert violations == []
Activity · 2 steps
lines 338–342violations = validate_file( str(FIXTURES_DIR / "attribute.c"), CONFIG_DEFAULTS, no_git=True, )lines 343–343assert violations == []

test_only_definitions_checked

test_guard_edge_cases.TestForwardDeclarationMix.test_only_definitions_checked(self)

tests/guard/test_guard_edge_cases.py:287

Checks

  • assert violations == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001inferredtest_only_definitions_checked → validate_file → get_file_at_revision → run_git → git_argv
REQ-DDB-CONFIG-009measuredtest_only_definitions_checked → validate_file → gate_exclusion
REQ-DDB-GUARD-001measuredtest_only_definitions_checked → validate_file
REQ-DDB-GUARD-002inferredtest_only_definitions_checked → validate_file → check_version_staleness
REQ-DDB-GUARD-003measuredtest_only_definitions_checked → validate_file → check_tags
REQ-DDB-GUARD-004measuredtest_only_definitions_checked → validate_file → check_req_coverage
REQ-DDB-GUARD-005measuredtest_only_definitions_checked → validate_file → check_return_presence
REQ-DDB-GUARD-006measuredtest_only_definitions_checked → validate_file → check_file_presence
REQ-DDB-GUARD-007measuredtest_only_definitions_checked → validate_file → check_duplicate_tags
REQ-DDB-GUARD-009inferredtest_only_definitions_checked → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version
REQ-DDB-GUARD-011inferredtest_only_definitions_checked → validate_file → check_req_coverage → _has_active_requirements → load_requirements_full
REQ-DDB-GUARD-013measuredtest_only_definitions_checked → validate_file → unconfigured_language
REQ-DDB-GUARD-014inferredtest_only_definitions_checked → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version → parse_version
REQ-DDB-GUARD-016inferredtest_only_definitions_checked → validate_file → check_req_coverage → _has_active_requirements → filter_requirements_by_version → _summarise_id
REQ-DDB-GUARD-018measuredtest_only_definitions_checked → validate_file → parse_source_file
REQ-DDB-GUARD-019measuredtest_only_definitions_checked → validate_file → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_only_definitions_checked → validate_file → parse_content_for_file → language_for_file
REQ-DDB-GUARD-021inferredtest_only_definitions_checked → validate_file → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-023inferredtest_only_definitions_checked → validate_file → get_file_at_revision
REQ-DDB-GUARD-024inferredtest_only_definitions_checked → validate_file → check_file_presence → _check_file_block_tags → apply_autobrief
REQ-DDB-GUARD-025measuredtest_only_definitions_checked → validate_file → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
REQ-DDB-GUARD-026measuredtest_only_definitions_checked → validate_file → check_bus_tags
REQ-DDB-GUARD-027inferredtest_only_definitions_checked → validate_file → check_req_exists → _uncheckable
REQ-DDB-PIPE-011measuredtest_only_definitions_checked → validate_file → gate_exclusion → binary_file
REQ-DDB-WIKI-054inferredtest_only_definitions_checked → validate_file → gate_exclusion → _gate_matcher → load_toolchain_config → _string_list → all
Source · 10 lines
    def test_only_definitions_checked(self):
        violations = validate_file(
            str(FIXTURES_DIR / "forward_decl.c"),
            CONFIG_DEFAULTS,
            no_git=True,
        )
        # Only the definition (Module_Init with doxygen) should be checked.
        # No violations expected since it has @brief and @version.
        assert violations == []
Activity · 2 steps
lines 288–292violations = validate_file( str(FIXTURES_DIR / "forward_decl.c"), CONFIG_DEFAULTS, no_git=True, )lines 295–295assert violations == []

test_removed_copy_leaves_remaining_copy_clean

test_guard_edge_cases.TestPreprocessorDuplicates.test_removed_copy_leaves_remaining_copy_clean(self)

tests/guard/test_guard_edge_cases.py:525

Show on the map →

Called by none

Calls _copy, _stale

Checks

  • assert _stale(self._BOTH, current) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_removed_copy_leaves_remaining_copy_clean → _stale → check_version_staleness
REQ-DDB-GUARD-018measuredtest_removed_copy_leaves_remaining_copy_clean → _stale → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_removed_copy_leaves_remaining_copy_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_removed_copy_leaves_remaining_copy_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_removed_copy_leaves_remaining_copy_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_removed_copy_leaves_remaining_copy_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_removed_copy_leaves_remaining_copy_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 5 lines
    def test_removed_copy_leaves_remaining_copy_clean(self):
        current = _copy("#ifdef FEATURE_X", "1", "return *old + 1;") + "#endif\n"
        assert _stale(self._BOTH, current) == []

Activity · 2 steps
lines 526–526current = _copy("#ifdef FEATURE_X", "1", "return *old + 1;") + "#endif\n"lines 527–527assert _stale(self._BOTH, current) == []

test_second_copy_edited_without_bump_is_flagged_alone

test_guard_edge_cases.TestPreprocessorDuplicates.test_second_copy_edited_without_bump_is_flagged_alone(self)

tests/guard/test_guard_edge_cases.py:509

Show on the map →

Called by none

Calls _stale

Checks

  • assert len(violations) == 1 and violations[0].line == 17, violations

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_second_copy_edited_without_bump_is_flagged_alone → _stale → check_version_staleness
REQ-DDB-GUARD-018measuredtest_second_copy_edited_without_bump_is_flagged_alone → _stale → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_second_copy_edited_without_bump_is_flagged_alone → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_second_copy_edited_without_bump_is_flagged_alone → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_second_copy_edited_without_bump_is_flagged_alone → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_second_copy_edited_without_bump_is_flagged_alone → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_second_copy_edited_without_bump_is_flagged_alone → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 5 lines
    def test_second_copy_edited_without_bump_is_flagged_alone(self):
        current = self._BOTH.replace("return *old + 2;", "return *old + 3;")
        violations = _stale(self._BOTH, current)
        assert len(violations) == 1 and violations[0].line == 17, violations
Activity · 3 steps
lines 510–510current = self._BOTH.replace("return *old + 2;", "return *old + 3;")lines 511–511violations = _stale(self._BOTH, current)lines 512–512assert len(violations) == 1 and violations[0].line == 17, violations

test_stale_version_detected

test_guard_edge_cases.TestVersionStaleness.test_stale_version_detected(self)

tests/guard/test_guard_edge_cases.py:55

Show on the map →

Called by none

Calls check_version_staleness, parse_c

Checks

  • assert len(violations) == 1
  • assert "Stale_Func" in violations[0].message
  • assert "not updated" in violations[0].message

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_stale_version_detected → check_version_staleness
REQ-DDB-GUARD-018measuredtest_stale_version_detected → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_stale_version_detected → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_stale_version_detected → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_stale_version_detected → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_stale_version_detected → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_stale_version_detected → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 21 lines
    def test_stale_version_detected(self):
        content = (FIXTURES_DIR / "stale_version.c").read_text()
        functions = parse_c(content)

        # Simulate: Stale_Func body changed since HEAD, @version was not touched.
        # "new_implementation();" (not the "also_" prefixed one) is unique to Stale_Func.
        head_content = content.replace("    new_implementation();", "    old_implementation();")
        head_functions = parse_c(head_content)

        violations = check_version_staleness(
            functions,
            "stale_version.c",
            CONFIG_DEFAULTS,
            content,
            head_functions,
            head_content,
        )
        assert len(violations) == 1
        assert "Stale_Func" in violations[0].message
        assert "not updated" in violations[0].message
Activity · 8 steps
lines 56–56content = (FIXTURES_DIR / "stale_version.c").read_text()lines 57–57functions = parse_c(content)lines 61–61head_content = content.replace(" new_implementation();", " old_implementation();")lines 62–62head_functions = parse_c(head_content)lines 64–71violations = check_version_staleness( functions, "stale_version.c", CONFIG_DEFAULTS, content, head_functions, head_content, )lines 72–72assert len(violations) == 1lines 73–73assert "Stale_Func" in violations[0].messagelines 74–74assert "not updated" in violations[0].message

test_static_macro_qualifier

test_guard_edge_cases.TestTypedefReturnsAndMacroQualifiers.test_static_macro_qualifier(self)

tests/guard/test_guard_edge_cases.py:401

Show on the map →

Called by none

Calls parse_c

Checks

  • assert "internal_helper" in names
  • assert names["internal_helper"].doxygen is not None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_static_macro_qualifier → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_static_macro_qualifier → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_static_macro_qualifier → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_static_macro_qualifier → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_static_macro_qualifier → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_static_macro_qualifier → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 7 lines
    def test_static_macro_qualifier(self):
        content = (FIXTURES_DIR / "typedef_returns.c").read_text()
        functions = parse_c(content)
        names = {f.name: f for f in functions}
        assert "internal_helper" in names
        assert names["internal_helper"].doxygen is not None
Activity · 5 steps
lines 402–402content = (FIXTURES_DIR / "typedef_returns.c").read_text()lines 403–403functions = parse_c(content)lines 404–404names = {f.name: f for f in functions}lines 405–405assert "internal_helper" in nameslines 406–406assert names["internal_helper"].doxygen is not None

test_struct_qualified_return

test_guard_edge_cases.TestTypedefReturnsAndMacroQualifiers.test_struct_qualified_return(self)

tests/guard/test_guard_edge_cases.py:447

Show on the map →

Called by none

Calls parse_c

Checks

  • assert len(functions) == 1
  • assert functions[0].name == "create_node"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_struct_qualified_return → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_struct_qualified_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_struct_qualified_return → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_struct_qualified_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_struct_qualified_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_struct_qualified_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 15 lines
    def test_struct_qualified_return(self):
        content = dedent("""\
            /**
             * @brief Create a new node.
             * @version 1.0
             */
            struct node* create_node(int value) {
                return allocate(value);
            }
        """)
        functions = parse_c(content)
        assert len(functions) == 1
        assert functions[0].name == "create_node"

Activity · 4 steps
lines 448–456content = dedent("""\ /** * @brief Create a new node. * @version 1.0 */ struct node* create_node(int value) { return allocate(value); } """)lines 457–457functions = parse_c(content)lines 458–458assert len(functions) == 1lines 459–459assert functions[0].name == "create_node"

test_typedef_pointer_return

test_guard_edge_cases.TestTypedefReturnsAndMacroQualifiers.test_typedef_pointer_return(self)

tests/guard/test_guard_edge_cases.py:394

Show on the map →

Called by none

Calls parse_c

Checks

  • assert "find_config" in names
  • assert names["find_config"].doxygen is not None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_typedef_pointer_return → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_typedef_pointer_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_typedef_pointer_return → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_typedef_pointer_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_typedef_pointer_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_typedef_pointer_return → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 7 lines
    def test_typedef_pointer_return(self):
        content = (FIXTURES_DIR / "typedef_returns.c").read_text()
        functions = parse_c(content)
        names = {f.name: f for f in functions}
        assert "find_config" in names
        assert names["find_config"].doxygen is not None
Activity · 5 steps
lines 395–395content = (FIXTURES_DIR / "typedef_returns.c").read_text()lines 396–396functions = parse_c(content)lines 397–397names = {f.name: f for f in functions}lines 398–398assert "find_config" in nameslines 399–399assert names["find_config"].doxygen is not None

test_unbalanced_string_brace_is_handled_correctly

test_guard_edge_cases.TestBracesInStrings.test_unbalanced_string_brace_is_handled_correctly(self)

The AST parser is not confused by an unbalanced brace inside a string.

tests/guard/test_guard_edge_cases.py:250

Show on the map →

Called by none

Calls parse_c

Checks

  • assert unbal.body_end == 6
  • assert unbal.body_end < next_func.def_line

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_unbalanced_string_brace_is_handled_correctly → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_unbalanced_string_brace_is_handled_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_unbalanced_string_brace_is_handled_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_unbalanced_string_brace_is_handled_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_unbalanced_string_brace_is_handled_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_unbalanced_string_brace_is_handled_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 34 lines
    def test_unbalanced_string_brace_is_handled_correctly(self):
        """The AST parser is not confused by an unbalanced brace inside a string.

        This test previously asserted body_end > 6, documenting a "known limitation"
        that only ever existed in the regex path — that path counted every brace in the
        file including those inside string literals. tree-sitter tokenises strings, so
        the limitation does not exist in production. Recorded as a capability, not a
        caveat.
        """
        content = dedent("""\
            /**
             * @brief Problematic function.
             * @version 1.0
             */
            void Unbalanced(void) {
                printf("extra { here");
            }

            /**
             * @brief Should be separate.
             * @version 1.0
             */
            void Next_Func(void) {
                clean();
            }
        """)
        functions = parse_c(content)

        unbal = [f for f in functions if f.name == "Unbalanced"][0]
        next_func = [f for f in functions if f.name == "Next_Func"][0]
        assert unbal.body_end == 6
        assert unbal.body_end < next_func.def_line

Activity · 6 steps
lines 259–275content = dedent("""\ /** * @brief Problematic function. * @version 1.0 */ void Unbalanced(void) { printf("extra { here"); } /** * @brief Should be separate. * @version 1.0 */ void Next_Func(void) { clean(); } """)lines 276–276functions = parse_c(content)lines 278–278unbal = [f for f in functions if f.name == "Unbalanced"][0]lines 279–279next_func = [f for f in functions if f.name == "Next_Func"][0]lines 280–280assert unbal.body_end == 6lines 281–281assert unbal.body_end < next_func.def_line

test_unchanged_ifdef_else_duplicate_is_clean

test_guard_edge_cases.TestPreprocessorDuplicates.test_unchanged_ifdef_else_duplicate_is_clean(self)

tests/guard/test_guard_edge_cases.py:491

Show on the map →

Called by none

Calls none

Checks

  • assert _stale(self._BOTH, self._BOTH) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measured
REQ-DDB-GUARD-018measured
REQ-DDB-GUARD-019measured
REQ-DDB-GUARD-020measured
REQ-DDB-GUARD-025measured
Source · 3 lines
    def test_unchanged_ifdef_else_duplicate_is_clean(self):
        assert _stale(self._BOTH, self._BOTH) == []
Activity · 1 steps
lines 492–492assert _stale(self._BOTH, self._BOTH) == []

test_unchanged_separate_ifdef_blocks_are_clean

test_guard_edge_cases.TestPreprocessorDuplicates.test_unchanged_separate_ifdef_blocks_are_clean(self)

tests/guard/test_guard_edge_cases.py:494

Show on the map →

Called by none

Calls _copy, _stale

Checks

  • assert _stale(src, src) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_unchanged_separate_ifdef_blocks_are_clean → _stale → check_version_staleness
REQ-DDB-GUARD-018measuredtest_unchanged_separate_ifdef_blocks_are_clean → _stale → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_unchanged_separate_ifdef_blocks_are_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_unchanged_separate_ifdef_blocks_are_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_unchanged_separate_ifdef_blocks_are_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_unchanged_separate_ifdef_blocks_are_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_unchanged_separate_ifdef_blocks_are_clean → _stale → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 9 lines
    def test_unchanged_separate_ifdef_blocks_are_clean(self):
        src = (
            _copy("#ifdef A", "1", "return 1;")
            + "#endif\n"
            + _copy("#ifdef B", "1", "return 2;")
            + "#endif\n"
        )
        assert _stale(src, src) == []
Activity · 2 steps
lines 495–500src = ( _copy("#ifdef A", "1", "return 1;") + "#endif\n" + _copy("#ifdef B", "1", "return 2;") + "#endif\n" )lines 501–501assert _stale(src, src) == []

test_undocumented_definition_after_decl

test_guard_edge_cases.TestForwardDeclarationMix.test_undocumented_definition_after_decl(self)

tests/guard/test_guard_edge_cases.py:297

Show on the map →

Called by none

Calls check_presence, parse_c

Checks

  • assert len(functions) == 1
  • assert functions[0].name == "Helper"
  • assert functions[0].doxygen is None
  • assert len(violations) == 1
  • assert "no doxygen comment" in violations[0].message

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_undocumented_definition_after_decl → check_presence
REQ-DDB-GUARD-005inferredtest_undocumented_definition_after_decl → check_presence → _is_void_function
REQ-DDB-GUARD-018measuredtest_undocumented_definition_after_decl → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_undocumented_definition_after_decl → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_undocumented_definition_after_decl → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_undocumented_definition_after_decl → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_undocumented_definition_after_decl → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_undocumented_definition_after_decl → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 19 lines
    def test_undocumented_definition_after_decl(self):
        content = dedent("""\
            void Helper(int x);

            void Helper(int x) {
                do_stuff(x);
            }
        """)
        functions = parse_c(content)
        # Forward declaration skipped, definition found
        assert len(functions) == 1
        assert functions[0].name == "Helper"
        assert functions[0].doxygen is None

        violations = check_presence(functions, "test.c", CONFIG_DEFAULTS)
        assert len(violations) == 1
        assert "no doxygen comment" in violations[0].message

Activity · 8 steps
lines 298–304content = dedent("""\ void Helper(int x); void Helper(int x) { do_stuff(x); } """)lines 305–305functions = parse_c(content)lines 307–307assert len(functions) == 1lines 308–308assert functions[0].name == "Helper"lines 309–309assert functions[0].doxygen is Nonelines 311–311violations = check_presence(functions, "test.c", CONFIG_DEFAULTS)lines 312–312assert len(violations) == 1lines 313–313assert "no doxygen comment" in violations[0].message

test_undocumented_typedef_detected

test_guard_edge_cases.TestTypedefReturnsAndMacroQualifiers.test_undocumented_typedef_detected(self)

tests/guard/test_guard_edge_cases.py:415

Show on the map →

Called by none

Calls parse_c

Checks

  • assert "undocumented_func" in names
  • assert names["undocumented_func"].doxygen is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_undocumented_typedef_detected → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_undocumented_typedef_detected → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_undocumented_typedef_detected → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_undocumented_typedef_detected → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_undocumented_typedef_detected → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_undocumented_typedef_detected → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 7 lines
    def test_undocumented_typedef_detected(self):
        content = (FIXTURES_DIR / "typedef_returns.c").read_text()
        functions = parse_c(content)
        names = {f.name: f for f in functions}
        assert "undocumented_func" in names
        assert names["undocumented_func"].doxygen is None
Activity · 5 steps
lines 416–416content = (FIXTURES_DIR / "typedef_returns.c").read_text()lines 417–417functions = parse_c(content)lines 418–418names = {f.name: f for f in functions}lines 419–419assert "undocumented_func" in nameslines 420–420assert names["undocumented_func"].doxygen is None

test_unmodified_overloads_no_violation

test_guard_edge_cases.TestVersionStaleness.test_unmodified_overloads_no_violation(self)

Regression for #11: same-named overloads (tinyfsm-style react() dispatch) must not collide in the HEAD identity lookup on an otherwise unmodified tree.

tests/guard/test_guard_edge_cases.py:96

Show on the map →

Called by none

Calls check_version_staleness, parse_cpp

Checks

  • assert len(functions) == 3
  • assert violations == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_unmodified_overloads_no_violation → check_version_staleness
REQ-DDB-GUARD-018measuredtest_unmodified_overloads_no_violation → parse_cpp → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_unmodified_overloads_no_violation → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_unmodified_overloads_no_violation → parse_cpp → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_unmodified_overloads_no_violation → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_unmodified_overloads_no_violation → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_unmodified_overloads_no_violation → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 45 lines
    def test_unmodified_overloads_no_violation(self):
        """Regression for #11: same-named overloads (tinyfsm-style react() dispatch)
        must not collide in the HEAD identity lookup on an otherwise unmodified tree."""
        content = dedent("""\
            class RobotMissionFsm {
            public:
                /**
                 * @brief Handle event A.
                 * @version 1.0.0
                 */
                virtual void react(EventA const& e) {
                    handle_a(e);
                }

                /**
                 * @brief Handle event B.
                 * @version 1.0.0
                 */
                virtual void react(EventB const& e) {
                    handle_b(e);
                }

                /**
                 * @brief Handle event C.
                 * @version 1.0.0
                 */
                virtual void react(EventC const& e) {
                    handle_c(e);
                }
            };
        """)
        functions = parse_cpp(content)
        assert len(functions) == 3

        # Unmodified tree: HEAD content is identical to the working tree.
        violations = check_version_staleness(
            functions,
            "robot_mission_fsm.hpp",
            CONFIG_DEFAULTS,
            content,
            functions,
            content,
        )
        assert violations == []
Activity · 5 steps
lines 99–126content = dedent("""\ class RobotMissionFsm { public: /** * @brief Handle event A. * @version 1.0.0 */ virtual void react(EventA const& e) { handle_a(e); } /** * @brief Handle event B. * @version 1.0.0 */ virtual void react(EventB const& e) { handle_b(e); } /** * @brief Handle event C. * @version 1.0.0 */ virtual void react(EventC const& e) { handle_c(e); } }; """)lines 127–127functions = parse_cpp(content)lines 128–128assert len(functions) == 3lines 131–138violations = check_version_staleness( functions, "robot_mission_fsm.hpp", CONFIG_DEFAULTS, content, functions, content, )lines 139–139assert violations == []

test_updated_version_no_violation

test_guard_edge_cases.TestVersionStaleness.test_updated_version_no_violation(self)

tests/guard/test_guard_edge_cases.py:76

Show on the map →

Called by none

Calls check_version_staleness, parse_c

Checks

  • assert violations == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-002measuredtest_updated_version_no_violation → check_version_staleness
REQ-DDB-GUARD-018measuredtest_updated_version_no_violation → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_updated_version_no_violation → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_updated_version_no_violation → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_updated_version_no_violation → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_updated_version_no_violation → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_updated_version_no_violation → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 20 lines
    def test_updated_version_no_violation(self):
        content = (FIXTURES_DIR / "stale_version.c").read_text()
        functions = parse_c(content)

        # Simulate: Updated_Func body changed AND @version was bumped since HEAD.
        head_content = content.replace(
            "also_new_implementation();", "also_old_implementation();"
        ).replace("@version 1.1", "@version 1.0")
        head_functions = parse_c(head_content)

        violations = check_version_staleness(
            functions,
            "stale_version.c",
            CONFIG_DEFAULTS,
            content,
            head_functions,
            head_content,
        )
        assert violations == []
Activity · 6 steps
lines 77–77content = (FIXTURES_DIR / "stale_version.c").read_text()lines 78–78functions = parse_c(content)lines 81–83head_content = content.replace( "also_new_implementation();", "also_old_implementation();" ).replace("@version 1.1", "@version 1.0")lines 84–84head_functions = parse_c(head_content)lines 86–93violations = check_version_staleness( functions, "stale_version.c", CONFIG_DEFAULTS, content, head_functions, head_content, )lines 94–94assert violations == []

test_weak_macro_qualifier

test_guard_edge_cases.TestTypedefReturnsAndMacroQualifiers.test_weak_macro_qualifier(self)

tests/guard/test_guard_edge_cases.py:408

Show on the map →

Called by none

Calls parse_c

Checks

  • assert "default_handler" in names
  • assert names["default_handler"].doxygen is not None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-018measuredtest_weak_macro_qualifier → parse_c → parse_lang → parse_functions
REQ-DDB-GUARD-019measuredtest_weak_macro_qualifier → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_weak_macro_qualifier → parse_c → parse_lang → parse_functions → parse_functions_ts
REQ-DDB-GUARD-021inferredtest_weak_macro_qualifier → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-024inferredtest_weak_macro_qualifier → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_weak_macro_qualifier → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
Source · 7 lines
    def test_weak_macro_qualifier(self):
        content = (FIXTURES_DIR / "typedef_returns.c").read_text()
        functions = parse_c(content)
        names = {f.name: f for f in functions}
        assert "default_handler" in names
        assert names["default_handler"].doxygen is not None
Activity · 5 steps
lines 409–409content = (FIXTURES_DIR / "typedef_returns.c").read_text()lines 410–410functions = parse_c(content)lines 411–411names = {f.name: f for f in functions}lines 412–412assert "default_handler" in nameslines 413–413assert names["default_handler"].doxygen is not None