Closes #16
This commit is contained in:
1 parent
7022c84941
commit
c3d3bd51fb
72 files changed
+3703
-2484
No files matched your search
@@ -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, 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, 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,10 +109,10 @@ $(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> and <code><a class="el" href="dbc__lifetime__test_8cpp_source.html">dbc_lifetime_test.cpp</a></code>. <code>../core/core.pri</code> supplies the library include path and linkage.</p>
|
||||
</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>
|
||||
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, and preservation of successful signals. Physical conversion checks cover NaN/Inf parameters, multiplication/addition overflow, finite limits, signed/unsigned raw retention, and raw selector activation after physical conversion failure.</p>
|
||||
<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>
|
||||
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>
|
||||
@@ -125,12 +125,15 @@ Tree and optional model tests</h1>
|
||||
<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>
|
||||
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, 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><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>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>
|
||||
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>
|
||||
<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>
|
||||
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>
|
||||
</div></div><!-- contents -->
|
||||
</div><!-- PageDoc -->
|
||||
</div><!-- doc-content -->
|
||||
|
||||
Reference in new issue
Block a user