diff --git a/docs/how-to-guides/testing/index.rst b/docs/how-to-guides/testing/index.rst index 01f5f6d..73f56be 100644 --- a/docs/how-to-guides/testing/index.rst +++ b/docs/how-to-guides/testing/index.rst @@ -1,15 +1,15 @@ .. _testing: :octicon:`beaker` Test Management and Traceability -=================================================== +================================================== -.. toctree:: +.. toctree:: requirements :maxdepth: 1 :hidden: - requirements - -This guide demonstrates how to integrate test reports into your documentation with full traceability between test specifications, test cases, source code, and test results. +This guide demonstrates how to integrate test reports into your +documentation with full traceability between test specifications, test +cases, source code, and test results. Overview -------- @@ -22,12 +22,14 @@ A comprehensive testing approach includes: * **Traceability**: Links between all these elements * **Test Reports**: Results from test execution -By using Sphinx-Needs for test specifications, sphinx-codelinks for code tracing, and sphinx-test-reports for test results, we create a complete traceable testing ecosystem. +By using Sphinx-Needs for test specifications, sphinx-codelinks for +code tracing, and sphinx-test-reports for test results, we create a +complete traceable testing ecosystem. Workflow -------- -.. mermaid:: +.. mermaid:: graph LR REQ[Requirements] --> TS[Test Specifications] @@ -36,7 +38,7 @@ Workflow TC --> RUN[Test Execution] RUN --> REPORT[Test Reports] REPORT --> DOC[Documentation] - + style REQ fill:#FFB300 style TS fill:#A6BDD7 style TC fill:#A6BDD7 @@ -45,9 +47,10 @@ Workflow style DOC fill:#F6768E Step 1: Define Test Specifications ------------------------------------ +---------------------------------- -Create test specifications using the ``test-spec`` directive to define what needs to be tested: +Create test specifications using the ``test-spec`` directive to define +what needs to be tested: .. test-spec:: Factorial Function Test Specification :id: TS_FACTORIAL @@ -55,12 +58,13 @@ Create test specifications using the ``test-spec`` directive to define what need :tags: factorial, math Test the factorial function for: - + * Negative numbers (should return 1) * Zero (should return 1) * Positive numbers (should return correct factorial) - - The factorial function is critical for mathematical operations and must handle edge cases correctly. + + The factorial function is critical for mathematical operations and + must handle edge cases correctly. .. test-spec:: Prime Number Check Test Specification :id: TS_PRIME @@ -68,17 +72,19 @@ Create test specifications using the ``test-spec`` directive to define what need :tags: prime, math Test the IsPrime function for: - + * Negative numbers (should return false) * Trivial cases (0, 1, 2, 3) * Positive numbers (both prime and composite) - - Prime number detection is used in cryptographic operations and must be accurate. + + Prime number detection is used in cryptographic operations and must be + accurate. Step 2: Annotate Test Cases in Code ------------------------------------- +----------------------------------- -Add sphinx-codelinks annotations to your test cases. The annotation format is e.g.: +Add sphinx-codelinks annotations to your test cases. The annotation +format is e.g.: .. code-block:: cpp @@ -94,20 +100,25 @@ Example from ``sample1_unittest.cpp``: :lines: 76-88 :caption: Annotated test case with GTest properties -The annotation ``@Test negative factorial values, T_FACT_001, test`` creates a traceable link between the test code and the documentation. +The annotation ``@Test negative factorial values, T_FACT_001, test`` +creates a traceable link between the test code and the documentation. **GTest Properties** (``RecordProperty``): -* ``need_id``: Links the test execution result to the test case need (T_FACT_001) +* ``need_id``: Links the test execution result to the test case need + (T_FACT_001) * ``requirement``: Links to the requirement being tested (REQ_MATH_001) * ``test_spec``: Links to the test specification (TS_FACTORIAL) -These properties are included in the XML test report and enable automatic linking between test results and documentation needs. +These properties are included in the XML test report and enable +automatic linking between test results and documentation needs. Step 3: Link Test Cases to Specifications ------------------------------------------- +----------------------------------------- -Test cases are automatically discovered from source code using sphinx-codelinks. The test files contain ``@`` annotations that define test needs: +Test cases are automatically discovered from source code using +sphinx-codelinks. The test files contain ``@`` annotations that define +test needs: .. code-block:: cpp @@ -119,35 +130,40 @@ Test cases are automatically discovered from source code using sphinx-codelinks. // ... test implementation } -These annotations are parsed by sphinx-codelinks and automatically create test needs. Below are all test cases discovered from the test files: +These annotations are parsed by sphinx-codelinks and automatically +create test needs. Below are all test cases discovered from the test +files: -.. src-trace:: - :project: eac-cpp +.. src-trace:: + :project: x-as-code-cpp :file: sample1_unittest.cpp The test cases link to: -* **Test specifications** (e.g., ``TS_FACTORIAL``) via the ``:spec:`` field -* **Implementation** (e.g., ``IMPL_2``) via the ``:implements:`` field +* **Test specifications** (e.g., ``TS_FACTORIAL``) via the ``:spec:`` + field +* **Implementation** (e.g., ``IMPL_2``) via the ``:implements:`` field * **Requirements** (e.g., ``REQ_MATH_001``) via GTest properties Step 4: Show Code Traceability -------------------------------- +------------------------------ Use sphinx-codelinks to display where test cases are implemented: .. code-block:: rst - .. src-trace:: Test Case Implementation - :project: eac-cpp - :directory: src + .. src-trace:: Test Case Implementation + :project: x-as-code-cpp + :directory: src -This shows all annotated code locations, creating bidirectional links between documentation and source code. +This shows all annotated code locations, creating bidirectional links +between documentation and source code. Step 5: Integrate Test Reports -------------------------------- +------------------------------ -After running tests, integrate the test results using sphinx-test-reports: +After running tests, integrate the test results using +sphinx-test-reports: .. code-block:: bash @@ -158,13 +174,14 @@ After running tests, integrate the test results using sphinx-test-reports: cd build ./eac_test --gtest_output=xml:test-results.xml -The test results XML file contains properties that link back to the test case needs, enabling complete traceability. +The test results XML file contains properties that link back to the +test case needs, enabling complete traceability. Traceability Matrix ------------------- Test Specifications to Test Cases -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ View which test cases implement each test specification: @@ -174,7 +191,7 @@ View which test cases implement each test specification: :style: table Test Cases to Implementation -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ View the connection between test cases and the code they test: @@ -191,7 +208,7 @@ To generate code coverage reports with line-level detail: # Run tests with coverage ./scripts/test_with_coverage.sh - + # View coverage report open src/build/coverage_html/index.html @@ -214,12 +231,12 @@ Integrate testing into your CI/CD pipeline: cd src cmake -S . -B build cmake --build build - + - name: Run Tests run: | cd src/build ./eac_test --gtest_output=xml:test-results.xml - + - name: Upload Test Results uses: actions/upload-artifact@v4 with: @@ -227,7 +244,7 @@ Integrate testing into your CI/CD pipeline: path: src/build/test-results.xml Complete Traceability Flow ---------------------------- +-------------------------- The complete flow from requirements to test results: @@ -254,11 +271,10 @@ By combining: You create a fully traceable testing ecosystem where: -✅ Every test links to its specification -✅ Every test links to the code it verifies -✅ Test results are automatically integrated -✅ Coverage is measured and reported -✅ Traceability is bidirectional and complete +✅ Every test links to its specification ✅ Every test links to the +code it verifies ✅ Test results are automatically integrated ✅ +Coverage is measured and reported ✅ Traceability is bidirectional and +complete Additional Resources -------------------- @@ -266,4 +282,4 @@ Additional Resources * `GoogleTest Documentation `_ * `Sphinx-Test-Reports `_ * `Sphinx-Codelinks `_ -* `Code Coverage with lcov `_ \ No newline at end of file +* `Code Coverage with lcov `_ diff --git a/docs/how-to-guides/trace-code/index.rst b/docs/how-to-guides/trace-code/index.rst index a410074..5bd6f5f 100644 --- a/docs/how-to-guides/trace-code/index.rst +++ b/docs/how-to-guides/trace-code/index.rst @@ -3,7 +3,8 @@ :octicon:`link` Tracing Source Code =================================== -This guide explains how to use CodeLinks to trace source code files and lines to needs in your documentation. +This guide explains how to use CodeLinks to trace source code files +and lines to needs in your documentation. **Step 1: Install CodeLinks** @@ -11,56 +12,63 @@ Follow the installation instructions in the `CodeLinks documentation ` to avoid duplicate need IDs. +**Note**: Test files are traced separately in the :ref:`testing guide ` +to avoid duplicate need IDs. **Summary** -By following these steps, you can easily trace source code to requirements, improving traceability and documentation quality. +By following these steps, you can easily trace source code to +requirements, improving traceability and documentation quality. Advanced configuration options and features are available in the `CodeLinks documentation `__. Linking Requirements to Code ------------------------------ +---------------------------- Finally you can link from/to the traced source code lines like this: @@ -68,11 +76,13 @@ Finally you can link from/to the traced source code lines like this: :id: REQ_0815 :status: open - This is a requirement that links to a need that has traced source code lines. + This is a requirement that links to a need that has traced source code + lines. .. note:: - Current limitation: ``ubCode`` is not aware of this need id yet. This means that - the ``ubCode`` navigation inside Visual Studio Code will not work and jumping from - this ``rst`` file to the source code line will not work. This will be implemented - and supported in a future release. \ No newline at end of file + Current limitation: ``ubCode`` is not aware of this need id yet. This + means that the ``ubCode`` navigation inside Visual Studio Code will + not work and jumping from this ``rst`` file to the source code line + will not work. This will be implemented and supported in a future + release. diff --git a/docs/src_trace.toml b/docs/src_trace.toml index 6dde64e..69c7b66 100644 --- a/docs/src_trace.toml +++ b/docs/src_trace.toml @@ -6,10 +6,10 @@ set_remote_url = true # Set to true to enable remote url to be generat remote_url_field = "remote-url" # Need's field name for remote URL -[codelinks.projects.eac-cpp] -remote_url_pattern = "https://github.com/useblocks/eac/blob/{commit}/{path}#L{line}" # URL pattern for remote source code +[codelinks.projects.x-as-code-cpp] +remote_url_pattern = "https://github.com/useblocks/x-as-code/blob/{commit}/{path}#L{line}" # URL pattern for remote source code -[codelinks.projects.eac-cpp.source_discover] +[codelinks.projects.x-as-code-cpp.source_discover] src_dir = "../src" # Relative path from this TOML config to the source directory include = [ "*.cpp", @@ -19,12 +19,12 @@ exclude=[] gitignore = true comment_type = "cpp" -[codelinks.projects.eac-cpp.analyse] +[codelinks.projects.x-as-code-cpp.analyse] get_need_id_refs = true get_oneline_needs = true get_rst = true -[codelinks.projects.eac-cpp.analyse.oneline_comment_style] +[codelinks.projects.x-as-code-cpp.analyse.oneline_comment_style] # start_sequence = "@" # end_sequence for the online comments; default is an os-dependant newline character field_split_char = "," diff --git a/docs/tutorials/sphinx-needs-setup.rst b/docs/tutorials/sphinx-needs-setup.rst index 949b8a8..def38a3 100644 --- a/docs/tutorials/sphinx-needs-setup.rst +++ b/docs/tutorials/sphinx-needs-setup.rst @@ -1,7 +1,7 @@ .. _tutorial-sphinx-needs-setup: :octicon:`rocket` Setting Up a Sphinx-Needs Project -==================================================== +=================================================== This tutorial guides you through setting up a new Sphinx documentation project with sphinx-needs from scratch. By the end, you'll have a @@ -19,7 +19,8 @@ Prerequisites Before starting, ensure you have: -* **Python 3.12+** installed on your system (required by Sphinx 9.x and sphinx-needs 6.x) +* **Python 3.12+** installed on your system (required by Sphinx 9.x and + sphinx-needs 6.x) * **uv** - a fast Python package and project manager * A terminal/command line * A text editor or IDE (VS Code with ubCode extension recommended) @@ -46,10 +47,10 @@ If you don't have ``uv`` installed, install it first: **What is uv?** - uv is an extremely fast Python package and project manager written - in Rust. It's 10-100x faster than pip and replaces pip, virtualenv, - and pyenv in a single tool. It handles virtual environments, - dependencies, and Python version management seamlessly. + uv is an extremely fast Python package and project manager written in + Rust. It's 10-100x faster than pip and replaces pip, virtualenv, and + pyenv in a single tool. It handles virtual environments, dependencies, + and Python version management seamlessly. What is Sphinx? --------------- @@ -87,8 +88,8 @@ Sphinx-needs manages "need items" through a lifecycle: 1. **Collection**: Needs are parsed from RST files during the read phase 2. **Resolution**: Dynamic fields and links are resolved -3. **Analysis**: Directives like ``needtable`` and ``needflow`` query - the collected needs +3. **Analysis**: Directives like ``needtable`` and ``needflow`` query the + collected needs 4. **Rendering**: Needs are rendered to HTML, PDF, or other formats 5. **Validation**: Constraints and warnings are checked @@ -100,13 +101,10 @@ Each need is a node in a graph structure with: * Optional **metadata** (status, tags, priority, etc.) * **Links** to other needs -.. seealso:: - - For comprehensive documentation, see the - `official sphinx-needs website `_. +.. seealso:: For comprehensive documentation, see the `official sphinx-needs website `_. Step 1: Create Project Directory ---------------------------------- +-------------------------------- Create a new directory for your documentation project: @@ -116,7 +114,7 @@ Create a new directory for your documentation project: cd my-docs-project Step 2: Set Up Python Environment with uv ------------------------------------------- +----------------------------------------- Initialize a new Python project with uv: @@ -152,7 +150,7 @@ Your project structure now looks like: used. Step 3: Install Dependencies ------------------------------ +---------------------------- Add Sphinx and sphinx-needs to your project: @@ -175,7 +173,7 @@ This installs: # Output: sphinx-build 8.3.0 Step 4: Initialize Sphinx Project ----------------------------------- +--------------------------------- Run the Sphinx quickstart wizard. This creates a source directory and generates a default ``conf.py`` with useful configuration values: @@ -211,11 +209,11 @@ This creates the following structure: └── pyproject.toml Step 5: Create the ubproject.toml Configuration ------------------------------------------------- +----------------------------------------------- Instead of configuring sphinx-needs directly in ``conf.py``, we use a -separate ``ubproject.toml`` file. This declarative approach has several -advantages: +separate ``ubproject.toml`` file. This declarative approach has +several advantages: * **Clean separation**: Configuration is separate from Python code * **Tooling support**: Works with ubCode (VS Code extension) for @@ -230,9 +228,9 @@ advantages: ubCode is a VS Code extension that provides a lightning-fast language server for Sphinx-Needs projects. It offers real-time RST previews, - linting, smart need filtering, and editor navigation. The - ``ubproject.toml`` file is the standard configuration format for - ubCode-compatible projects. + linting, smart need filtering, and editor navigation. The ``ubproject.toml`` + file is the standard configuration format for ubCode-compatible + projects. Create ``docs/ubproject.toml``: @@ -340,12 +338,12 @@ Create ``docs/ubproject.toml``: * `Extra Links `_ Step 6: Configure conf.py --------------------------- +------------------------- Edit ``docs/conf.py`` to enable sphinx-needs and load the TOML configuration. The ``conf.py`` file is executed as Python, allowing -complex customization, but we keep it minimal by delegating sphinx-needs -configuration to the TOML file: +complex customization, but we keep it minimal by delegating +sphinx-needs configuration to the TOML file: .. code-block:: python @@ -377,11 +375,12 @@ configuration to the TOML file: html_static_path = ['_static'] The key line is ``needs_from_toml = "ubproject.toml"`` which tells -sphinx-needs to read its configuration from the TOML file. All settings -in the ``[needs]`` section of the TOML file are loaded automatically. +sphinx-needs to read its configuration from the TOML file. All +settings in the ``[needs]`` section of the TOML file are loaded +automatically. Step 7: Create Your First Documentation ----------------------------------------- +--------------------------------------- Replace the contents of ``docs/index.rst`` with: @@ -407,7 +406,7 @@ Replace the contents of ``docs/index.rst`` with: * :ref:`search` Step 8: Write Requirements ---------------------------- +-------------------------- Create ``docs/requirements.rst``: @@ -459,8 +458,7 @@ Syntax Reference * ``.. req:: Title`` - Creates a requirement (the directive name comes from ``needs.types``) * ``:id: REQ_001`` - Unique identifier (must match ``id_regex``) -* ``:status: open`` - Current status (custom option from - ``extra_options``) +* ``:status: open`` - Current status (custom option from ``extra_options``) * ``:priority: high`` - Priority level (custom option) * ``:derives: REQ_001`` - Link to another need (from ``extra_links``) @@ -468,7 +466,7 @@ The content of a need can include any RST markup: lists, code blocks, tables, images, and more. Step 9: Add Specifications and Tests -------------------------------------- +------------------------------------ Create ``docs/specifications.rst``: @@ -549,10 +547,10 @@ Create ``docs/specifications.rst``: **Expected Result**: 401 response with error message Step 10: Create Traceability Views ------------------------------------ +---------------------------------- -Create ``docs/traceability.rst`` to visualize the relationships between -your needs: +Create ``docs/traceability.rst`` to visualize the relationships +between your needs: .. code-block:: rst @@ -599,8 +597,7 @@ your needs: We use ``:engine: graphviz`` here because Graphviz is easier to set up (no Java required). For more advanced diagrams and - additional directives like ``needsequence`` or ``needuml``, see - :ref:`tutorial-plantuml-setup`. + additional directives like ``needsequence`` or ``needuml``. Specifications Matrix --------------------- @@ -634,7 +631,7 @@ your needs: :sort: type Step 11: Build the Documentation ---------------------------------- +-------------------------------- Generate HTML documentation: @@ -680,7 +677,7 @@ You should see your documentation with: browser. Final Project Structure ------------------------- +----------------------- Your complete project structure: @@ -706,7 +703,7 @@ Your complete project structure: └── pyproject.toml Understanding ubproject.toml ------------------------------ +---------------------------- The ``ubproject.toml`` file follows a specific structure. Here's a reference of the key sections: @@ -761,8 +758,8 @@ Use ``[[needs.types]]`` (double brackets for arrays): color = "#FFB300" # Hex color for diagrams style = "node" # PlantUML style -Available styles: ``node``, ``artifact``, ``frame``, ``storage``, -``database``, ``actor`` +Available styles: ``node``, ``artifact``, ``frame``, ``storage``, ``database``, +``actor`` Link Types ~~~~~~~~~~ @@ -785,8 +782,9 @@ Use ``[[needs.extra_links]]`` for traceability relationships: Schema Validation (sphinx-needs 6.0+) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Starting with sphinx-needs 6.0, you can define typed extra options with -JSON schema constraints. This provides validation for custom fields: +Starting with sphinx-needs 6.0, you can define typed extra options +with JSON schema constraints. This provides validation for custom +fields: .. code-block:: toml @@ -808,17 +806,17 @@ JSON schema constraints. This provides validation for custom fields: This approach provides: -* **Type checking** - Ensure values match expected types (string, integer, - boolean, array) +* **Type checking** - Ensure values match expected types (string, + integer, boolean, array) * **Enum constraints** - Restrict values to a predefined set * **Range validation** - Set minimum/maximum for numeric fields * **Build-time warnings** - Invalid values trigger warnings during build -When schema violations occur, sphinx-needs generates a -``schema_violations.json`` file alongside ``needs.json`` for debugging. +When schema violations occur, sphinx-needs generates a ``schema_violations.json`` +file alongside ``needs.json`` for debugging. VS Code Setup with ubCode --------------------------- +------------------------- For the best editing experience, install the ubCode extension: @@ -848,7 +846,7 @@ Create ``.vscode/settings.json``: } Common Commands Reference --------------------------- +------------------------- .. code-block:: bash @@ -874,7 +872,8 @@ Common Commands Reference Next Steps ---------- -Now that you have a working Sphinx-Needs project, explore these topics: +Now that you have a working Sphinx-Needs project, explore these +topics: **Enhance Your Configuration:** @@ -929,8 +928,8 @@ these important changes: * Requires Sphinx 7.4+ and Python 3.10+ * Introduced JSON schema validation for extra options -* Removed deprecated ``needfilter`` directive (use ``needtable`` or - ``needlist`` instead) +* Removed deprecated ``needfilter`` directive (use ``needtable`` or ``needlist`` + instead) * Variant syntax changed to require ``<< >>`` wrappers * Default values only apply to missing/None fields (not falsy values like empty strings) @@ -940,8 +939,7 @@ Official Documentation * `Sphinx Documentation `_ * `Sphinx-Needs Documentation `_ -* `Sphinx-Needs Configuration - `_ +* `Sphinx-Needs Configuration `_ * `ubCode Documentation `_ * `uv Documentation `_ @@ -977,7 +975,6 @@ The ``needflow`` directive supports two rendering engines: 1. **Graphviz** (recommended for getting started) - Requires only the Graphviz system package. Use ``:engine: graphviz`` in your directive. - 2. **PlantUML** (default) - Requires Java + PlantUML JAR + sphinxcontrib-plantuml. Provides more styling options. @@ -996,17 +993,17 @@ Install Graphviz for basic diagram generation: **PlantUML errors (Java/JAR not found)** -If you see errors like ``plantuml command cannot be run`` or -``FileNotFoundError: java``, you're using the default PlantUML engine -without proper setup. You have two options: +If you see errors like ``plantuml command cannot be run`` or ``FileNotFoundError: java``, +you're using the default PlantUML engine without proper setup. You +have two options: 1. **Quick fix**: Add ``:engine: graphviz`` to your ``needflow`` directives 2. **Full setup**: Follow :ref:`tutorial-plantuml-setup` to install PlantUML -To set Graphviz as the default engine for all needflow directives, -add to ``conf.py``: +To set Graphviz as the default engine for all needflow directives, add +to ``conf.py``: .. code-block:: python @@ -1039,8 +1036,8 @@ case-sensitive. Use the generated ``needs.json`` to verify all IDs. **Schema validation warnings (sphinx-needs 6.0+)** -If you're using typed extra options with schema validation, you may see -warnings like ``sn_schema_warning`` or ``sn_schema_violation``. To +If you're using typed extra options with schema validation, you may +see warnings like ``sn_schema_warning`` or ``sn_schema_violation``. To suppress specific warning types, add to ``conf.py``: .. code-block:: python @@ -1057,24 +1054,35 @@ details about validation failures. Next Steps ---------- -Now that you have a working sphinx-needs project, explore these topics: +Now that you have a working sphinx-needs project, explore these +topics: -* :ref:`tutorial-plantuml-setup` - Enable PlantUML for advanced diagrams (needsequence, needuml, needgantt) -* :ref:`tutorial-creating-dashboards` - Create visual dashboards with charts and diagrams -* :ref:`how-to-write-requirements` - Best practices for writing requirements +* :ref:`tutorial-plantuml-setup` - Enable PlantUML for advanced diagrams + (needsequence, needuml, needgantt) +* :ref:`tutorial-creating-dashboards` - Create visual dashboards with + charts and diagrams +* :ref:`how-to-write-requirements` - Best practices for writing + requirements * :ref:`external-needs` - Import needs from external systems like Jira .. seealso:: **sphinx-needs Reference:** - * `Official sphinx-needs Docs `_ - Getting started guide - * `Directives Reference `_ - All available directives - * `Configuration Options `_ - Complete configuration reference - * `Filter Expressions `_ - Query and filter your needs - * `Layouts & Styles `_ - Customize how needs are displayed + * `Official sphinx-needs Docs `_ + - Getting started guide + * `Directives Reference `_ + - All available directives + * `Configuration Options `_ + - Complete configuration reference + * `Filter Expressions `_ + - Query and filter your needs + * `Layouts & Styles `_ + - Customize how needs are displayed **Related Tools:** - * `Official Sphinx Docs `_ - Sphinx documentation generator - * `reStructuredText Primer `_ - RST syntax guide + * `Official Sphinx Docs `_ - + Sphinx documentation generator + * `reStructuredText Primer `_ + - RST syntax guide diff --git a/docs/ubproject.toml b/docs/ubproject.toml index c47d6e6..0975b09 100644 --- a/docs/ubproject.toml +++ b/docs/ubproject.toml @@ -13,6 +13,12 @@ name = "X-as-Code (XaC)" description = "Showcases for working with Sphinx-Needs" srcdir = "." +[parse] +ignore_directives = [ + # src-trace is not recognized by ubcode and produces a warning lint. + "src-trace" +] + # Rules for the ubCode formater, to get a nice looking documentation. [format_rst] fail_on_warning = [] @@ -80,7 +86,7 @@ id_regex = "[A-Z_]{3,10}(_[\\d]{1,3})*" [needs.global_options.style] predicates = [ - + ] [needs.global_options.runs] @@ -171,7 +177,7 @@ style = "node" [[needs.types]] directive = "test-spec" -title = "Test Specification" +title = "Test Specification" prefix = "TS_" color = "#A6BDD7" style = "node" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 74c9c31..b2f6160 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,6 +18,7 @@ include(FetchContent) FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip + DOWNLOAD_EXTRACT_TIMESTAMP TRUE ) FetchContent_MakeAvailable(googletest) @@ -25,7 +26,7 @@ FetchContent_MakeAvailable(googletest) set(SOURCE_FILES main.cpp) # Add executable target with source files listed in SOURCE_FILES variable -add_executable(eac-cpp ${SOURCE_FILES}) +add_executable(x-as-code-cpp ${SOURCE_FILES}) # Library with the code to be tested add_library( @@ -66,24 +67,24 @@ if(ENABLE_COVERAGE) add_custom_target(coverage # Clear previous coverage data COMMAND ${LCOV_PATH} --directory . --zerocounters - + # Run tests COMMAND ${CMAKE_CURRENT_BINARY_DIR}/eac_test - + # Capture coverage data, ignoring errors from GoogleTest COMMAND ${LCOV_PATH} --directory . --capture --output-file coverage.info --ignore-errors mismatch,inconsistent,negative,format --rc derive_function_end_line=0 - + # Remove system headers, external dependencies, and test files from coverage COMMAND ${LCOV_PATH} --remove coverage.info '/usr/*' '*/_deps/*' '*/test/*' '*_unittest.cpp' '*_test.cpp' 'eac_test.cpp' --output-file coverage_filtered.info --ignore-errors unused - + # Generate HTML report COMMAND ${GENHTML_PATH} coverage_filtered.info --output-directory coverage_html --ignore-errors source - + DEPENDS eac_test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating code coverage report..." ) - + message(STATUS "Code coverage targets available: 'make coverage'") else() message(WARNING "lcov or genhtml not found. Coverage report generation will not be available.")