upfate doxygen

This commit is contained in:
deeaitch committed 2026-10-20 13:40:44 -04:00
1 parent a55d1c58ed
commit c43222939f
433 files changed
+15617 -7061

No files matched your search

+40 -13
View File
@@ -93,7 +93,7 @@ $(document).ready(function(){initNavTree('md_tests_2README.html',''); initResiza
<div class="headertitle"><div class="title">QtTest regression tests</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><a class="anchor" id="autotoc_md137"></a> For instrumented builds, LCOV HTML reports, and Qt Creator coverage configuration, see <a href="../README.md#measuring-code-coverage">Measuring code coverage</a>. For the complete IDE build/run configuration set, see <a href="../README.md#configure-all-build-variants-in-qt-creator">Configure all build variants in Qt Creator</a>. The Coverage configuration uses <code>coverage_report.sh</code> after its instrumented build; the script takes the source and build directories as its two arguments.</p>
<div class="textblock"><p><a class="anchor" id="autotoc_md155"></a> For instrumented builds, LCOV HTML reports, and Qt Creator coverage configuration, see <a href="../README.md#measuring-code-coverage">Measuring code coverage</a>. For the complete IDE build/run configuration set, see <a href="../README.md#configure-all-build-variants-in-qt-creator">Configure all build variants in Qt Creator</a>. The Coverage configuration uses <code>coverage_report.sh</code> after its instrumented build; the script takes the source and build directories as its two arguments.</p>
<p>Open the repository's root <code>dbc.pro</code> in Qt Creator. It contains <code>core</code> (a static C++17 library) and <code>tests</code> (the <code>dbc_tests</code> QtTest executable). Core is built first; tests link its archive rather than compiling its implementation again. Qt Core and Qt Test development packages are required for tests only. The optional model tests also link QtGui, which is provided by Qt base development packages. The adapter library itself still links only QtCore.</p>
<p>Build from the repository root with the installed Qt 6.8.2:</p>
<div class="fragment"><div class="line">mkdir build</div>
@@ -101,7 +101,7 @@ $(document).ready(function(){initNavTree('md_tests_2README.html',''); initResiza
<div class="line">qmake6 ../dbc.pro</div>
<div class="line">make -j</div>
<div class="line">make check</div>
</div><!-- fragment --><p>Or run <code>./tests/dbc_tests</code> directly. Parser, decoder, lifetime, validation, and additional coverage suites run, and the executable returns nonzero when any suite fails. Decoder cases appear as individual QtTest data rows; parser checks are grouped into named test slots. Checks also run in release builds.</p>
</div><!-- fragment --><p>Or run <code>./tests/dbc_tests</code> directly. Parser, decoder, pipeline, lifetime, validation, and additional coverage suites run, and the executable returns nonzero when any suite fails. Decoder cases appear as individual QtTest data rows; parser checks are grouped into named test slots. Checks also run in release builds.</p>
<p>To build tests separately against an existing core build:</p>
<div class="fragment"><div class="line">mkdir /tmp/dbc-tests-build</div>
<div class="line">cd /tmp/dbc-tests-build</div>
@@ -109,31 +109,58 @@ $(document).ready(function(){initNavTree('md_tests_2README.html',''); initResiza
<div class="line"> DBC_CORE_BUILD_DIR=/absolute/path/to/build/core</div>
<div class="line">make</div>
<div class="line">make check</div>
</div><!-- fragment --><p><code>parser_tests.pri</code> and <code>decoder_tests.pri</code> include the original test sources; <code>tests.pro</code> also includes <code><a class="el" href="dbc__coverage__test_8cpp_source.html">dbc_coverage_test.cpp</a></code>, <code><a class="el" href="dbc__lifetime__test_8cpp_source.html">dbc_lifetime_test.cpp</a></code>, and <code><a class="el" href="dbc__validation__test_8cpp_source.html">dbc_validation_test.cpp</a></code>. <code>../core/core.pri</code> supplies the library include path and linkage.</p>
<h1><a class="anchor" id="autotoc_md138"></a>
</div><!-- fragment --><p><code>parser_tests.pri</code> and <code>decoder_tests.pri</code> include the original test sources; <code>tests.pro</code> also includes <code><a class="el" href="dbc__coverage__test_8cpp_source.html">dbc_coverage_test.cpp</a></code>, <code><a class="el" href="dbc__lifetime__test_8cpp_source.html">dbc_lifetime_test.cpp</a></code>, <code><a class="el" href="dbc__validation__test_8cpp_source.html">dbc_validation_test.cpp</a></code>, and <code><a class="el" href="dbc__pipeline__test_8cpp_source.html">dbc_pipeline_test.cpp</a></code>. <code>../core/core.pri</code> supplies the library include path and linkage.</p>
<h1><a class="anchor" id="autotoc_md156"></a>
Decoder coverage</h1>
<p>Coverage includes Motorola bit numbering within and across bytes, unaligned signals, signed values, scaling, 64-bit extraction, signed/unsigned boundary values (including <code>INT64_MIN</code>, <code>INT64_MAX</code>, and <code>UINT64_MAX</code>), numeric output, invalid lengths, insufficient payloads, and Intel regression cases. Frame validity means the definition was found; frame status reports unknown frames, short payloads, and signal errors. Tests exercise empty/short/exact/long payloads, ignored trailing bytes, signals outside declared DLC, invalid enum metadata and overflowing start bits rejected at construction, and preservation of successful signals on partial payloads. Physical conversion checks cover NaN/Inf parameters rejected at construction, multiplication/addition overflow, finite limits, signed/unsigned raw retention, and raw selector activation after physical conversion failure.</p>
<h1><a class="anchor" id="autotoc_md139"></a>
<h1><a class="anchor" id="autotoc_md157"></a>
Parser coverage</h1>
<p>Structured diagnostic tests cover severity, code, supplied path, and physical line numbers for skipped syntax and immediate/deferred errors; warnings preceding an error are retained, and failed parses return an empty database. Common headers and namespace symbol lists stay quiet. Tests also check file-open errors, fresh parse sessions, and compatibility with the legacy throwing API. The diagnostic audit also covers 15 unsupported-statement variants, all namespace termination forms, CRLF and missing final newlines, relative paths with spaces, first-error stopping, deferred diagnostic ordering, duplicate definitions/values, selector ranges, overlaps, and preservation of supported decoding and metadata. On Linux, reading a directory exercises the distinct <code>FileReadError</code> path.</p>
<p>Parser tests cover standard and extended CAN IDs, whitespace, payload storage boundaries, missing fields, malformed and overflowing numbers, reserved ID bits, error paths and line numbers, and integration with signals and comments. Duplicate definitions are rejected at their source lines, including equivalent extended ID encodings and repeated signal names within a frame. Standard and extended frames may share a numeric ID, and separate frames may reuse signal names. Signal tests cover complete syntax and numeric validation, scientific notation, finite physical parameters and ordered ranges, spaces and tabs, receiver lists, unsupported multiplexing, and Intel/Motorola declared-payload boundaries. Value-description tests cover full <code>VAL_</code> syntax, whitespace, escaped quotes, empty text, exact integer boundaries, duplicate keys within and across statements, deferred and normalized frame references, missing targets, error locations, raw lookup with scaling, unknown/invalid values, and both database builders. Temporary DBC fixtures are created in the system temporary directory and removed automatically.</p>
<p>Structured diagnostic tests cover severity, code, supplied path, and physical line numbers for skipped syntax and immediate/deferred errors; warnings preceding an error are retained, and failed parses return an empty database. Common headers and namespace symbol lists stay quiet. Tests also check file-open errors, fresh parse sessions, and compatibility with the legacy throwing API. The diagnostic audit also covers 13 unsupported-statement variants, all namespace termination forms, CRLF and missing final newlines, relative paths with spaces, first-error stopping, deferred diagnostic ordering, duplicate definitions/values, selector ranges, overlaps, and preservation of supported decoding and metadata. On Linux, reading a directory exercises the distinct <code>FileReadError</code> path.</p>
<p>Parser tests cover standard and extended CAN IDs, whitespace, payload storage boundaries, missing fields, malformed and overflowing numbers, reserved ID bits, error paths and line numbers, and integration with signals and comments. Comment regressions cover tabs, escaped quotes/backslashes, multiline text with blank lines and indentation, CRLF, missing final newlines, comments preceding frame/signal definitions, last-wins and empty overwrites, normalized ID boundaries, standard/extended separation, malformed syntax/IDs, and missing targets. Errors verify both structured diagnostics and the throwing API at the starting line. Duplicate definitions are rejected at their source lines, including equivalent extended ID encodings and repeated signal names within a frame. Standard and extended frames may share a numeric ID, and separate frames may reuse signal names. Signal tests cover complete syntax and numeric validation, scientific notation, finite physical parameters and ordered ranges, spaces and tabs, receiver lists, unsupported multiplexing, and Intel/Motorola declared-payload boundaries. Physical-number tests apply a custom comma-decimal C++ locale and an available named comma-decimal C numeric locale. They check all four physical fields, leading signs, fractions, scientific notation, finite boundaries, zero, malformed numbers, comma/grouped numbers, overflow/underflow, and reversed ranges. Locale changes are restored after each test. The named C locale case skips if none of the supported locale names are installed; the custom C++ locale case always runs. On Linux with locale sources and <code>localedef</code>, run both cases without installing a system locale:</p>
<div class="fragment"><div class="line">mkdir -p /tmp/dbc-test-locales</div>
<div class="line">localedef --no-archive -i de_DE -f UTF-8 /tmp/dbc-test-locales/de_DE.UTF-8</div>
<div class="line">LOCPATH=/tmp/dbc-test-locales make check</div>
</div><!-- fragment --><p>Run <code>make check</code> from the build directory as usual. Value-description tests cover full <code>VAL_</code> syntax, whitespace, escaped quotes, empty text, exact integer boundaries, duplicate keys within and across statements, deferred and normalized frame references, missing targets, error locations, raw lookup with scaling, unknown/invalid values, and both database builders. Temporary DBC fixtures are created in the system temporary directory and removed automatically.</p>
<p>Dispatch tests also verify exact keyword matching, handler construction and reuse, unknown statements, and independent parsing sessions, including recovery after errors.</p>
<h1><a class="anchor" id="autotoc_md140"></a>
<h1><a class="anchor" id="autotoc_md158"></a>
Tree and optional model tests</h1>
<p><code><a class="el" href="tree__node__test_8cpp_source.html">tree_node_test.cpp</a></code> is a standalone C++17 executable without Qt; see the root README for its compiler command. It checks parents, sibling positions, null children, bounds, and unique_ptr transfer.</p>
<p><code><a class="el" href="tree__node__test_8cpp_source.html">tree_node_test.cpp</a></code> is a standalone C++17 executable without Qt; see the root README for its compiler command. It is also built as <code>dbc_tree_tests</code> and run by qmake's <code>make check</code>, without Qt linkage. It checks empty trees, parent/child round trips, sibling positions, const/mutable bounds, null children, vector growth, and unique_ptr transfer. Compile-time checks reject node copying and movement. Self/ancestor insertion must throw without consuming ownership or changing links. Key tests cover frame/signal identity, standard/extended separation, repeated signal names across frames, missing keys, source replacement, and row-independent identity.</p>
<p>Enable <code>CONFIG+=dbc_qt</code> in the root qmake invocation to build <code>dbc_qt</code> and <code>dbc_model_tests</code> alongside existing tests. Qt 6.8.2 is required. <code>make check</code> runs all suites. Model tests parse a temporary DBC fixture and use QAbstractItemModelTester, verify navigation across columns, invalid/foreign indexes, metadata and exact VAL_ integers, and persistent-index invalidation when reloading or clearing the tree. Their QGuiApplication registers graphical metatypes used by QAbstractItemModelTester, avoiding the invalid QPixmap type warning in Qt 6.8.2. The test executable defaults to <code>QT_QPA_PLATFORM=offscreen</code> when the variable is unset or empty, so no display server is needed. An explicit platform setting is preserved.</p>
<p>Basic multiplexing coverage includes selector declarations after branches, Intel/Motorola branch overlap, signed active values and VAL_ lookup, unconditional signals, inactive branches, missing selector/branch payloads, exact UINT64_MAX selector matching, malformed runtime selectors, source locations, and rejection of invalid markers, selector references/ranges, overlaps, and SG_MUL_VAL_.</p>
<h1><a class="anchor" id="autotoc_md141"></a>
<h1><a class="anchor" id="autotoc_md159"></a>
Additional regression coverage</h1>
<p><code><a class="el" href="dbc__coverage__test_8cpp_source.html">dbc_coverage_test.cpp</a></code> runs as part of <code>dbc_tests</code>. It covers signed boundaries below 64 bits, deterministic extraction comparisons for both byte orders across lengths 1–64, frame lookup failures, exact decode statuses, construction rejection of malformed runtime multiplexing, PGN boundaries, comment handling, file formatting, metadata copying and source lifetime, physical conversion, and <a class="el" href="classTypeFactory.html" title="Registry-based factory for creating objects by runtime identifier.">TypeFactory</a> registration/creation. Direct resolver tests construct ambiguous databases through the public metadata API, verify source locations, and check that ambiguous targets receive no values.</p>
<p>J1939 regressions in <code><a class="el" href="dbc__coverage__test_8cpp_source.html">dbc_coverage_test.cpp</a></code> verify explicit parser opt-in and ordinary extended CAN defaults, PF 239/240 and all data-page combinations, PGN zero, PDU1 destination exclusion, PDU2 group-extension matching, changed source and priority, standard/invalid-ID exclusion, and inconsistent manual metadata. They also cover exact-ID precedence, order-independent ambiguous PGNs for both PDU formats, mixed ordinary/J1939 definitions, selected-signal definition keys, raw/physical values, and owning PGN handles across snapshot replacement. The pipeline fixture explicitly enables J1939 through the diagnostic parser API. Verified in <code>build/</code> with <code>qmake6 ../dbc.pro</code>, <code>make -j4</code>, and <code>make check</code>: all six QtTest suites and the Qt-free tree target passed. The existing named comma-decimal C locale regression skipped because that locale is not installed.</p>
<p>All QtTest targets use Qt 6.8.2 and <code>QVERIFY_THROWS_EXCEPTION</code>. Exception tests explicitly discard <code>nodiscard</code> results when only the exception is being checked. The standalone tree test requires only a C++17 compiler.</p>
<h1><a class="anchor" id="autotoc_md142"></a>
<h1><a class="anchor" id="autotoc_md160"></a>
Definition lifetime and reload coverage</h1>
<p><code><a class="el" href="dbc__lifetime__test_8cpp_source.html">dbc_lifetime_test.cpp</a></code> checks retained definitions and value-description strings across reload, clear, and destruction; independently saved signal results; copied/moved results and database copies; owning lookup handles; and release of the old snapshot after its final owner is removed. Compile-time checks enforce const access to runtime metadata. Reload fixtures change ordering, frame names, scaling, units, and descriptions, remove definitions, and rename signals.</p>
<p>Key tests check equality and hashing, standard/extended separation, the same signal name in different frames, and missing lookups. Constructor tests reject duplicate runtime keys, including manually supplied parsed metadata. Failed reload leaves the active database intact; empty reload clears it. Invalid/unknown results and insufficient payloads retain their documented ownership and status behavior. Inactive branches and unavailable selectors also retain definitions across reload.</p>
<h1><a class="anchor" id="autotoc_md143"></a>
<h1><a class="anchor" id="autotoc_md161"></a>
Database validation coverage</h1>
<p><code><a class="el" href="dbc__validation__test_8cpp_source.html">dbc_validation_test.cpp</a></code> checks direct construction and manually assembled <code><a class="el" href="structDbcDatabase.html" title="Parsed DBC content stored in a simple internal form.">DbcDatabase</a></code> input to <code><a class="el" href="classDbcDecodeBuilder.html" title="Converts parsed DBC data into runtime decode database.">DbcDecodeBuilder</a></code>: standard/extended CAN ID limits, encoded/reserved ID bits, duplicate keys, lengths 0/1–64/65/UINT32_MAX, Intel/Motorola payload boundaries and overflowing start bits, invalid enums, NaN and both infinities in every numeric parameter, and reversed physical ranges. Selector tests include missing, duplicate, and signed selectors, branch ranges, UINT64_MAX selection, mixed-order overlaps, and exclusive branches sharing bits. Valid definitions cover the full byte-count storage range, including zero-byte frames without signals and 255-byte frames. Existing extraction tests cover lengths 1–64. Snapshot tests mutate retained frame, signal, and description aliases after rvalue construction, and verify unchanged lookups and metadata. Failed constructor/builder replacement preserves the active snapshot; clear removes its index while saved handles remain alive. </p>
<p><code><a class="el" href="dbc__validation__test_8cpp_source.html">dbc_validation_test.cpp</a></code> checks direct construction and manually assembled <code><a class="el" href="structDbcDatabase.html" title="Parsed DBC content stored in a simple internal form.">DbcDatabase</a></code> input to <code><a class="el" href="classDbcDecodeBuilder.html" title="Converts parsed DBC data into runtime decode database.">DbcDecodeBuilder</a></code>: standard/extended CAN ID limits, encoded/reserved ID bits, duplicate keys, lengths 0/1–64/65/UINT32_MAX, Intel/Motorola payload boundaries and overflowing start bits, invalid enums, NaN and both infinities in every numeric parameter, and reversed physical ranges. Selector tests include missing, duplicate, and signed selectors, branch ranges, UINT64_MAX selection, mixed-order overlaps, and exclusive branches sharing bits. Valid definitions cover the full byte-count storage range, including zero-byte frames without signals and 255-byte frames. Existing extraction tests cover lengths 1–64. Snapshot tests mutate retained frame, signal, and description aliases after rvalue construction, and verify unchanged lookups and metadata. Failed constructor/builder replacement preserves the active snapshot; clear removes its index while saved handles remain alive.</p>
<p>Layout validation is also compared with independent DBC bit traversal for every start position through one byte beyond payload sizes 0, 1, 8, 64, and 255, and all lengths 1–64, for both byte orders. Zero/65-bit lengths and uint32 maximum inputs are rejected. Builder snapshots survive input mutation and destruction; failed replacement with duplicate frame or signal keys preserves the existing frame and signal lookups.</p>
<h1><a class="anchor" id="autotoc_md162"></a>
End-to-end pipeline coverage</h1>
<p><code><a class="el" href="dbc__pipeline__test_8cpp_source.html">dbc_pipeline_test.cpp</a></code> parses temporary DBC files and checks independent expected metadata against the parser, runtime builder, and tree builder. It exercises standard and extended frames with the same numeric ID and signal name, Intel and signed Motorola decoding, scaling, raw value descriptions, basic multiplexing, PGN metadata, receivers, units, ranges, and frame/signal comments. Tree checks include node types, payloads, parents, rows, names, and child counts.</p>
<p>Empty and headers-only fixtures produce an empty runtime database and a valid empty tree root. Replacement fixtures change definitions, metadata and decoded values, remove old lookup keys, and then clear both outputs through an empty fixture. Saved decoded results and trees retain their original metadata.</p>
<h1><a class="anchor" id="autotoc_md163"></a>
Attribute coverage</h1>
<p>Parser slots <code>attributes</code>, <code>invalidAttributes</code>, and <code>attributeWarnings</code> cover all five scopes and types, deferred definitions/defaults/targets, explicit values overriding defaults, repeated assignments, escaped strings, typed range/scope errors, duplicate definitions/defaults, unknown attributes and missing targets. They check source diagnostics and the throwing API, distinct standard/extended targets, frame cycle times and enum labels, unsupported formats and ID conflicts, unchanged J1939 opt-in, and runtime/tree propagation. Existing unsupported-statement checks now use relation forms, which remain unsupported, instead of supported attribute forms.</p>
<p>Attribute changes were verified with <code>qmake6 ../dbc.pro</code>, <code>make -j4</code>, and <code>make check</code> in <code>build/</code>: all six QtTest suites and the qmake tree target passed. The standalone C++17 tree test also passed. The existing named comma-decimal C locale test skipped because the locale is not installed.</p>
<h1><a class="anchor" id="autotoc_md164"></a>
Extended validation</h1>
<p><code>attributeNumbers</code> checks signed 64-bit limits, leading plus signs, decimal HEX values, FLOAT fractions/exponents, and default overrides under a comma-decimal C++ locale. Node/environment defaults remain on definitions without becoming database attributes. <code>invalidAttributeNumbers</code> supplies 39 data rows, each checked in both definition bounds, a default, and an explicit assignment. The throwing and diagnostic APIs must reject malformed signs, trailing text, hexadecimal notation, non-finite values, overflow, and underflow with the correct error line. Additional malformed-attribute cases cover token separators, scope/type names, reversed FLOAT bounds, value types/ranges, and invalid CAN references.</p>
<p>Run AddressSanitizer and UndefinedBehaviorSanitizer in a separate directory:</p>
<div class="fragment"><div class="line">mkdir -p build-sanitize</div>
<div class="line">cd build-sanitize</div>
<div class="line">qmake6 ../dbc.pro CONFIG+=dbc_qt CONFIG+=debug CONFIG-=release \</div>
<div class="line"> &#39;QMAKE_CXXFLAGS+=-fsanitize=address,undefined -fno-omit-frame-pointer&#39; \</div>
<div class="line"> &#39;QMAKE_LFLAGS+=-fsanitize=address,undefined&#39;</div>
<div class="line">make -j4</div>
<div class="line">ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=halt_on_error=1 \</div>
<div class="line"> QT_FATAL_WARNINGS=1 LOCPATH=/tmp/dbc-test-locales make check</div>
</div><!-- fragment --><p>Generate the optional German locale as described above before setting LOCPATH. LeakSanitizer cannot run under this environment's tracer: <code>detect_leaks=1</code> completes the core QtTest suites but fails during leak checking with the message that LeakSanitizer does not work under ptrace. Disabling leak checking retains AddressSanitizer and UndefinedBehaviorSanitizer checks; it does not verify leaks. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->