test_guard_parser.py¶
tests/guard/test_guard_parser.py
Tests for clew.guard.parser (absorbed from doxygen-guard).
test_arbitrary_tags_are_parsed
test_guard_parser.TestParseFunctions.test_arbitrary_tags_are_parsed(self)
The parser is vocabulary-agnostic; validation decides what is known.
tests/guard/test_guard_parser.py:146
Checks
assert tags["some_custom_tag"] == ["VALUE_ONE"]assert tags["another_tag"] == ["second value"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_arbitrary_tags_are_parsed → parse_c → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_arbitrary_tags_are_parsed → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_arbitrary_tags_are_parsed → parse_c → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_arbitrary_tags_are_parsed → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_arbitrary_tags_are_parsed → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_arbitrary_tags_are_parsed → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 21 lines
def test_arbitrary_tags_are_parsed(self):
"""The parser is vocabulary-agnostic; validation decides what is known.
Kept separate from the fixture so the fixture can stay free of tags the tool
does not act on, while still proving custom tags reach Function.doxygen.tags.
"""
content = """\
/**
* @brief Do work.
* @version 1.0
* @some_custom_tag VALUE_ONE
* @another_tag second value
*/
void Work(void) { }
"""
functions = parse_c(content)
tags = functions[0].doxygen.tags
assert tags["some_custom_tag"] == ["VALUE_ONE"]
assert tags["another_tag"] == ["second value"]
test_backslash_escape_is_not_a_tag
test_guard_parser.TestEscapedAtSign.test_backslash_escape_is_not_a_tag(self)
tests/guard/test_guard_parser.py:270
Checks
assert "req" not in tagsassert tags["return"] == ["Each row with its declared @req IDs"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_backslash_escape_is_not_a_tag → parse_doxygen_tags |
Source · 5 lines
def test_backslash_escape_is_not_a_tag(self):
tags = parse_doxygen_tags(r"@return Each row with its declared \@req IDs")
assert "req" not in tags
assert tags["return"] == ["Each row with its declared @req IDs"]
Activity · 3 steps
test_body_end_tracking
test_guard_parser.TestParseFunctions.test_body_end_tracking(self)
tests/guard/test_guard_parser.py:109
Checks
assert len(functions) == 2assert functions[0].name == "Func_A"assert functions[0].body_end == 8 # closing brace of Func_Aassert functions[1].name == "Func_B"assert functions[1].body_end == 16 # closing brace of Func_B
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_body_end_tracking → parse_c → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_body_end_tracking → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_body_end_tracking → parse_c → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_body_end_tracking → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_body_end_tracking → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_body_end_tracking → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 27 lines
def test_body_end_tracking(self):
content = """\
/**
* @brief Func A.
* @version 1.0
*/
void Func_A(void) {
if (x) {
y();
}
}
/**
* @brief Func B.
* @version 1.0
*/
void Func_B(void) {
z();
}
"""
functions = parse_c(content)
assert len(functions) == 2
assert functions[0].name == "Func_A"
assert functions[0].body_end == 8 # closing brace of Func_A
assert functions[1].name == "Func_B"
assert functions[1].body_end == 16 # closing brace of Func_B
test_class_level_block_does_not_leak_to_first_member
test_guard_parser.TestCppFirstMemberDoxygen.test_class_level_block_does_not_leak_to_first_member(self)
tests/guard/test_guard_parser.py:248
Checks
assert by_name["undocumented"].doxygen is None
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_class_level_block_does_not_leak_to_first_member → parse_cpp → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_class_level_block_does_not_leak_to_first_member → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_class_level_block_does_not_leak_to_first_member → parse_cpp → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_class_level_block_does_not_leak_to_first_member → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_class_level_block_does_not_leak_to_first_member → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_class_level_block_does_not_leak_to_first_member → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 14 lines
def test_class_level_block_does_not_leak_to_first_member(self):
content = """\
/**
* @brief Doc for the class itself.
* @version 9.9
*/
class Leaky {
int undocumented() { return 0; }
};
"""
by_name = {f.name: f for f in parse_cpp(content)}
assert by_name["undocumented"].doxygen is None
test_class_qualified_method
test_guard_parser.TestParseFunctionsCpp.test_class_qualified_method(self, fixtures_dir)
tests/guard/test_guard_parser.py:195
Checks
assert "contains" in by_nameassert "getData" in by_name
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_class_qualified_method → parse_cpp → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_class_qualified_method → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_class_qualified_method → parse_cpp → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_class_qualified_method → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_class_qualified_method → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_class_qualified_method → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 7 lines
def test_class_qualified_method(self, fixtures_dir):
content = (fixtures_dir / "cpp_methods.cpp").read_text()
functions = parse_cpp(content)
by_name = {f.name: f for f in functions}
assert "contains" in by_name
assert "getData" in by_name
Activity · 5 steps
test_cpp_fixture_file
test_guard_parser.TestParseFunctionsCpp.test_cpp_fixture_file(self, fixtures_dir)
tests/guard/test_guard_parser.py:170
Checks
assert "parse_name" in namesassert "entropic_free" in namesassert "contains" in namesassert "getData" in namesassert "simple_func" in namesassert "Undocumented_Method" in names
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_cpp_fixture_file → parse_cpp → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_cpp_fixture_file → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_cpp_fixture_file → parse_cpp → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_cpp_fixture_file → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_cpp_fixture_file → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_cpp_fixture_file → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 11 lines
def test_cpp_fixture_file(self, fixtures_dir):
content = (fixtures_dir / "cpp_methods.cpp").read_text()
functions = parse_cpp(content)
names = [f.name for f in functions]
assert "parse_name" in names
assert "entropic_free" in names
assert "contains" in names
assert "getData" in names
assert "simple_func" in names
assert "Undocumented_Method" in names
Activity · 9 steps
test_double_at_escape_is_not_a_tag
test_guard_parser.TestEscapedAtSign.test_double_at_escape_is_not_a_tag(self)
tests/guard/test_guard_parser.py:275
Checks
assert "req" not in tagsassert tags["return"] == ["Each row with its declared @req IDs"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_double_at_escape_is_not_a_tag → parse_doxygen_tags |
Source · 5 lines
def test_double_at_escape_is_not_a_tag(self):
tags = parse_doxygen_tags("@return Each row with its declared @@req IDs")
assert "req" not in tags
assert tags["return"] == ["Each row with its declared @req IDs"]
Activity · 3 steps
test_duplicate_tags
test_guard_parser.TestParseTags.test_duplicate_tags(self)
tests/guard/test_guard_parser.py:30
Checks
assert len(tags["req"]) == 2assert "REQ-0001" in tags["req"]assert "REQ-0002" in tags["req"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_duplicate_tags → parse_doxygen_tags |
Source · 12 lines
def test_duplicate_tags(self):
block = """\
/**
* @brief Something.
* @req REQ-0001
* @req REQ-0002
*/"""
tags = parse_doxygen_tags(block)
assert len(tags["req"]) == 2
assert "REQ-0001" in tags["req"]
assert "REQ-0002" in tags["req"]
test_empty_block
test_guard_parser.TestParseTags.test_empty_block(self)
tests/guard/test_guard_parser.py:42
Checks
assert tags == {}
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_empty_block → parse_doxygen_tags |
Source · 6 lines
def test_empty_block(self):
block = "/** */"
tags = parse_doxygen_tags(block)
assert tags == {}
Activity · 3 steps
test_escape_at_start_of_line_is_not_a_tag
test_guard_parser.TestEscapedAtSign.test_escape_at_start_of_line_is_not_a_tag(self)
tests/guard/test_guard_parser.py:302
Checks
assert "version" not in tagsassert tags["brief"] == ["Doc @version is written like this"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_escape_at_start_of_line_is_not_a_tag → parse_doxygen_tags |
Source · 5 lines
def test_escape_at_start_of_line_is_not_a_tag(self):
tags = parse_doxygen_tags("@brief Doc\n\\@version is written like this")
assert "version" not in tags
assert tags["brief"] == ["Doc @version is written like this"]
Activity · 3 steps
test_escape_in_brief_round_trips_single_at
test_guard_parser.TestEscapedAtSign.test_escape_in_brief_round_trips_single_at(self)
tests/guard/test_guard_parser.py:285
Checks
assert "internal" not in tagsassert tags["brief"] == ["Skip functions marked @internal here"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_escape_in_brief_round_trips_single_at → parse_doxygen_tags |
Source · 5 lines
def test_escape_in_brief_round_trips_single_at(self):
tags = parse_doxygen_tags(r"@brief Skip functions marked \@internal here")
assert "internal" not in tags
assert tags["brief"] == ["Skip functions marked @internal here"]
Activity · 3 steps
test_escaped_and_real_tag_on_one_line
test_guard_parser.TestEscapedAtSign.test_escaped_and_real_tag_on_one_line(self)
tests/guard/test_guard_parser.py:296
Checks
assert tags["brief"] == ["Mentions @req only"]assert tags["version"] == ["2.0"]assert "req" not in tags
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_escaped_and_real_tag_on_one_line → parse_doxygen_tags |
Source · 6 lines
def test_escaped_and_real_tag_on_one_line(self):
tags = parse_doxygen_tags(r"@brief Mentions \@req only @version 2.0")
assert tags["brief"] == ["Mentions @req only"]
assert tags["version"] == ["2.0"]
assert "req" not in tags
Activity · 4 steps
test_exclude_names
test_guard_parser.TestParseFunctions.test_exclude_names(self)
tests/guard/test_guard_parser.py:90
Checks
assert "Real_Func" in namesassert "if" not in namesassert "return" not in names
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_exclude_names → parse_c → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_exclude_names → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_exclude_names → parse_c → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_exclude_names → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_exclude_names → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_exclude_names → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 19 lines
def test_exclude_names(self):
content = """\
/**
* @brief Real function.
* @version 1.0
*/
void Real_Func(void) {
if (x) {
return;
}
}
"""
functions = parse_c(content)
names = [f.name for f in functions]
assert "Real_Func" in names
# 'if' and 'return' should not appear even though they might match the pattern
assert "if" not in names
assert "return" not in names
test_extern_c_linkage
test_guard_parser.TestParseFunctionsCpp.test_extern_c_linkage(self, fixtures_dir)
tests/guard/test_guard_parser.py:188
Checks
assert "entropic_free" in by_nameassert by_name["entropic_free"].doxygen is not None
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_extern_c_linkage → parse_cpp → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_extern_c_linkage → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_extern_c_linkage → parse_cpp → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_extern_c_linkage → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_extern_c_linkage → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_extern_c_linkage → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 7 lines
def test_extern_c_linkage(self, fixtures_dir):
content = (fixtures_dir / "cpp_methods.cpp").read_text()
functions = parse_cpp(content)
by_name = {f.name: f for f in functions}
assert "entropic_free" in by_name
assert by_name["entropic_free"].doxygen is not None
Activity · 5 steps
test_first_member_after_access_specifier
test_guard_parser.TestCppFirstMemberDoxygen.test_first_member_after_access_specifier(self)
tests/guard/test_guard_parser.py:217
Checks
assert by_name["alpha"].doxygen is not Noneassert by_name["alpha"].doxygen.tags["version"] == ["1.0"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_first_member_after_access_specifier → parse_cpp → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_first_member_after_access_specifier → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_first_member_after_access_specifier → parse_cpp → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_first_member_after_access_specifier → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_first_member_after_access_specifier → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_first_member_after_access_specifier → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 16 lines
def test_first_member_after_access_specifier(self):
content = """\
class Widget {
public:
/**
* @brief First method after the access specifier.
* @version 1.0
* @return one
*/
int alpha() { return 1; }
};
"""
by_name = {f.name: f for f in parse_cpp(content)}
assert by_name["alpha"].doxygen is not None
assert by_name["alpha"].doxygen.tags["version"] == ["1.0"]
test_first_member_with_no_access_specifier
test_guard_parser.TestCppFirstMemberDoxygen.test_first_member_with_no_access_specifier(self)
tests/guard/test_guard_parser.py:233
Checks
assert by_name["gamma"].doxygen is not Noneassert by_name["gamma"].doxygen.tags["version"] == ["2.0"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_first_member_with_no_access_specifier → parse_cpp → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_first_member_with_no_access_specifier → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_first_member_with_no_access_specifier → parse_cpp → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_first_member_with_no_access_specifier → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_first_member_with_no_access_specifier → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_first_member_with_no_access_specifier → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 15 lines
def test_first_member_with_no_access_specifier(self):
content = """\
class Bare {
/**
* @brief First member, nothing before it in the class body.
* @version 2.0
* @return three
*/
int gamma() { return 3; }
};
"""
by_name = {f.name: f for f in parse_cpp(content)}
assert by_name["gamma"].doxygen is not None
assert by_name["gamma"].doxygen.tags["version"] == ["2.0"]
test_forward_declarations_are_always_skipped
test_guard_parser.TestParseFunctions.test_forward_declarations_are_always_skipped(self, fixtures_dir)
Bodyless declarations are never reported, and this is not configurable.
tests/guard/test_guard_parser.py:76
Checks
assert len(functions) == 1assert functions[0].name == "Module_Init"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_forward_declarations_are_always_skipped → parse_c → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_forward_declarations_are_always_skipped → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_forward_declarations_are_always_skipped → parse_c → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_forward_declarations_are_always_skipped → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_forward_declarations_are_always_skipped → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_forward_declarations_are_always_skipped → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 14 lines
def test_forward_declarations_are_always_skipped(self, fixtures_dir):
"""Bodyless declarations are never reported, and this is not configurable.
Replaces a test that asserted skip_fwd=False yielded 3 functions. That passed
only against the regex path, which no shipped language reaches: the production
AST path skips bodyless functions unconditionally. The knob it exercised
(presence.skip_forward_declarations) never did anything and has been removed.
"""
content = (fixtures_dir / "forward_decl.c").read_text()
functions = parse_c(content, skip_fwd=False)
assert len(functions) == 1
assert functions[0].name == "Module_Init"
Activity · 4 steps
test_forward_declarations_skipped
test_guard_parser.TestParseFunctions.test_forward_declarations_skipped(self, fixtures_dir)
tests/guard/test_guard_parser.py:67
Checks
assert len(functions) == 1assert functions[0].name == "Module_Init"assert functions[0].doxygen is not None
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_forward_declarations_skipped → parse_c → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_forward_declarations_skipped → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_forward_declarations_skipped → parse_c → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_forward_declarations_skipped → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_forward_declarations_skipped → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_forward_declarations_skipped → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 9 lines
def test_forward_declarations_skipped(self, fixtures_dir):
content = (fixtures_dir / "forward_decl.c").read_text()
functions = parse_c(content)
# Only the definition should be found, not the forward declarations
assert len(functions) == 1
assert functions[0].name == "Module_Init"
assert functions[0].doxygen is not None
Activity · 5 steps
test_genuine_inline_multi_tag_line_still_parses
test_guard_parser.TestEscapedAtSign.test_genuine_inline_multi_tag_line_still_parses(self)
tests/guard/test_guard_parser.py:290
Checks
assert tags["brief"] == ["Do work"]assert tags["version"] == ["1.0"]assert tags["return"] == ["zero"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_genuine_inline_multi_tag_line_still_parses → parse_doxygen_tags |
Source · 6 lines
def test_genuine_inline_multi_tag_line_still_parses(self):
tags = parse_doxygen_tags("@brief Do work @version 1.0 @return zero")
assert tags["brief"] == ["Do work"]
assert tags["version"] == ["1.0"]
assert tags["return"] == ["zero"]
Activity · 4 steps
test_multiple_escapes_on_one_line
test_guard_parser.TestEscapedAtSign.test_multiple_escapes_on_one_line(self)
tests/guard/test_guard_parser.py:307
Checks
assert tags["brief"] == ["Either @req or @internal applies"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_multiple_escapes_on_one_line → parse_doxygen_tags |
Source · 4 lines
def test_multiple_escapes_on_one_line(self):
tags = parse_doxygen_tags(r"@brief Either \@req or \@internal applies")
assert tags["brief"] == ["Either @req or @internal applies"]
Activity · 2 steps
test_multiple_tags
test_guard_parser.TestParseTags.test_multiple_tags(self)
tests/guard/test_guard_parser.py:18
Checks
assert tags["brief"] == ["Do something."]assert tags["version"] == ["1.0"]assert tags["req"] == ["REQ-0001"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_multiple_tags → parse_doxygen_tags |
Source · 12 lines
def test_multiple_tags(self):
block = """\
/**
* @brief Do something.
* @version 1.0
* @req REQ-0001
*/"""
tags = parse_doxygen_tags(block)
assert tags["brief"] == ["Do something."]
assert tags["version"] == ["1.0"]
assert tags["req"] == ["REQ-0001"]
test_namespaced_return_type
test_guard_parser.TestParseFunctionsCpp.test_namespaced_return_type(self, fixtures_dir)
tests/guard/test_guard_parser.py:181
Checks
assert by_name["parse_name"].doxygen is not Noneassert "brief" in by_name["parse_name"].doxygen.tags
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_namespaced_return_type → parse_cpp → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_namespaced_return_type → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_namespaced_return_type → parse_cpp → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_namespaced_return_type → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_namespaced_return_type → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_namespaced_return_type → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 7 lines
def test_namespaced_return_type(self, fixtures_dir):
content = (fixtures_dir / "cpp_methods.cpp").read_text()
functions = parse_cpp(content)
by_name = {f.name: f for f in functions}
assert by_name["parse_name"].doxygen is not None
assert "brief" in by_name["parse_name"].doxygen.tags
Activity · 5 steps
test_no_sentinel_leaks_into_output
test_guard_parser.TestEscapedAtSign.test_no_sentinel_leaks_into_output(self)
tests/guard/test_guard_parser.py:311
Checks
assert "\x00" not in tags["brief"][0]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_no_sentinel_leaks_into_output → parse_doxygen_tags |
Source · 3 lines
def test_no_sentinel_leaks_into_output(self):
tags = parse_doxygen_tags(r"@brief Escaped \@req here")
assert "\x00" not in tags["brief"][0]1 more lines, not shown
Activity · 2 steps
test_simple_c_file
test_guard_parser.TestParseFunctions.test_simple_c_file(self, fixtures_dir)
tests/guard/test_guard_parser.py:51
Checks
assert len(functions) == 3assert functions[0].name == "Module_Init"assert functions[0].doxygen is not Noneassert "brief" in functions[0].doxygen.tagsassert functions[1].name == "Module_Process"assert functions[1].doxygen is not Noneassert "version" in functions[1].doxygen.tagsassert functions[2].name == "Undocumented_Function"assert functions[2].doxygen is None
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_simple_c_file → parse_c → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_simple_c_file → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_simple_c_file → parse_c → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_simple_c_file → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_simple_c_file → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_simple_c_file → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 16 lines
def test_simple_c_file(self, fixtures_dir):
content = (fixtures_dir / "simple.c").read_text()
functions = parse_c(content)
assert len(functions) == 3
assert functions[0].name == "Module_Init"
assert functions[0].doxygen is not None
assert "brief" in functions[0].doxygen.tags
assert functions[1].name == "Module_Process"
assert functions[1].doxygen is not None
assert "version" in functions[1].doxygen.tags
assert functions[2].name == "Undocumented_Function"
assert functions[2].doxygen is None
Activity · 11 steps
test_single_tag
test_guard_parser.TestParseTags.test_single_tag(self)
tests/guard/test_guard_parser.py:12
Checks
assert "brief" in tagsassert tags["brief"] == ["Initialize the module."]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_single_tag → parse_doxygen_tags |
Source · 6 lines
def test_single_tag(self):
block = "/** @brief Initialize the module. */"
tags = parse_doxygen_tags(block)
assert "brief" in tags
assert tags["brief"] == ["Initialize the module."]
Activity · 4 steps
test_tags_parsed_correctly
test_guard_parser.TestParseFunctions.test_tags_parsed_correctly(self, fixtures_dir)
tests/guard/test_guard_parser.py:136
Checks
assert process_func.name == "Module_Process"assert process_func.doxygen is not Noneassert process_func.doxygen.tags["brief"] == ["Process incoming data."]assert process_func.doxygen.tags["version"] == ["1.2"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_tags_parsed_correctly → parse_c → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_tags_parsed_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_tags_parsed_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | inferred | test_tags_parsed_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_tags_parsed_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_tags_parsed_correctly → parse_c → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 10 lines
def test_tags_parsed_correctly(self, fixtures_dir):
content = (fixtures_dir / "simple.c").read_text()
functions = parse_c(content)
process_func = functions[1]
assert process_func.name == "Module_Process"
assert process_func.doxygen is not None
assert process_func.doxygen.tags["brief"] == ["Process incoming data."]
assert process_func.doxygen.tags["version"] == ["1.2"]
Activity · 7 steps
test_undocumented_detected
test_guard_parser.TestParseFunctionsCpp.test_undocumented_detected(self, fixtures_dir)
tests/guard/test_guard_parser.py:202
Checks
assert by_name["Undocumented_Method"].doxygen is None
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-018 | measured | test_undocumented_detected → parse_cpp → parse_lang → parse_functions |
| REQ-DDB-GUARD-019 | measured | test_undocumented_detected → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags |
| REQ-DDB-GUARD-020 | measured | test_undocumented_detected → parse_cpp → parse_lang → parse_functions → parse_functions_ts |
| REQ-DDB-GUARD-021 | measured | test_undocumented_detected → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block |
| REQ-DDB-GUARD-024 | inferred | test_undocumented_detected → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item |
| REQ-DDB-GUARD-025 | measured | test_undocumented_detected → parse_cpp → parse_lang → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void |
Source · 7 lines
def test_undocumented_detected(self, fixtures_dir):
content = (fixtures_dir / "cpp_methods.cpp").read_text()
functions = parse_cpp(content)
by_name = {f.name: f for f in functions}
assert by_name["Undocumented_Method"].doxygen is None
Activity · 4 steps
test_unescaped_mention_is_still_a_tag
test_guard_parser.TestEscapedAtSign.test_unescaped_mention_is_still_a_tag(self)
Doxygen-correct: an unescaped
tests/guard/test_guard_parser.py:280
Checks
assert tags["req"] == ["IDs"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-019 | measured | test_unescaped_mention_is_still_a_tag → parse_doxygen_tags |
Source · 5 lines
def test_unescaped_mention_is_still_a_tag(self):
"""Doxygen-correct: an unescaped @word anywhere IS a command."""
tags = parse_doxygen_tags("@return Each row with its declared @req IDs")
assert tags["req"] == ["IDs"]