Closes #11
This commit is contained in:
1 parent
0067cb4ddd
commit
f17ddb6aad
104 files changed
+1928
-889
No files matched your search
@@ -5,7 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>DBC Framework: Decoder regression tests</title>
|
||||
<title>DBC Framework: QtTest regression tests</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
@@ -90,28 +90,30 @@ $(document).ready(function(){initNavTree('md_tests_2README.html',''); initResiza
|
||||
</div>
|
||||
|
||||
<div><div class="header">
|
||||
<div class="headertitle"><div class="title">Decoder regression tests</div></div>
|
||||
<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_md104"></a> Run from the repository root with a C++17 compiler:</p>
|
||||
<div class="fragment"><div class="line">g++ -std=c++17 -Wall -Wextra -Wpedantic -I. \</div>
|
||||
<div class="line"> tests/dbc_decoder_test.cpp dbc_decoder.cpp -o /tmp/dbc_decoder_test</div>
|
||||
<div class="line">/tmp/dbc_decoder_test</div>
|
||||
</div><!-- fragment --><p>Alternatively, build the standalone qmake project out of source:</p>
|
||||
<div class="fragment"><div class="line">mkdir -p /tmp/dbc_decoder_test_build</div>
|
||||
<div class="line">cd /tmp/dbc_decoder_test_build</div>
|
||||
<div class="line">qmake /absolute/path/to/dbc/tests/dbc_decoder_test.pro</div>
|
||||
<div class="textblock"><p><a class="anchor" id="autotoc_md104"></a> 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.</p>
|
||||
<p>Build from the repository root with Qt 6 (use <code>qmake</code> for Qt 5):</p>
|
||||
<div class="fragment"><div class="line">mkdir build</div>
|
||||
<div class="line">cd build</div>
|
||||
<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. Both parser and decoder suites run, and the executable returns nonzero when either 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>
|
||||
<div class="line">qmake6 /absolute/path/to/dbc/tests/tests.pro \</div>
|
||||
<div class="line"> DBC_CORE_BUILD_DIR=/absolute/path/to/build/core</div>
|
||||
<div class="line">make</div>
|
||||
<div class="line">./dbc_decoder_test</div>
|
||||
</div><!-- fragment --><p>The executable returns a nonzero exit code if any case fails. Checks remain active in release builds and do not depend on <code>assert</code> or an external test framework.</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; insufficient payloads are checked through signal validity.</p>
|
||||
<div class="line">make check</div>
|
||||
</div><!-- fragment --><p><code>parser_tests.pri</code> and <code>decoder_tests.pri</code> include the test sources. <code>../core/core.pri</code> supplies the library include path and linkage.</p>
|
||||
<h1><a class="anchor" id="autotoc_md105"></a>
|
||||
Parser regression tests</h1>
|
||||
<p>Run from the repository root:</p>
|
||||
<div class="fragment"><div class="line">g++ -std=c++17 -Wall -Wextra -Wpedantic -Werror -I. \</div>
|
||||
<div class="line"> tests/dbc_parser_test.cpp dbc_parser.cpp dbc_statement_handler.cpp -o /tmp/dbc_parser_test</div>
|
||||
<div class="line">/tmp/dbc_parser_test</div>
|
||||
</div><!-- fragment --><p>For qmake, use <code>tests/dbc_parser_test.pro</code> in a separate build directory, following the decoder instructions above, then run <code>./dbc_parser_test</code>.</p>
|
||||
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; insufficient payloads are checked through signal validity.</p>
|
||||
<h1><a class="anchor" id="autotoc_md106"></a>
|
||||
Parser coverage</h1>
|
||||
<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. 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. 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>
|
||||
</div></div><!-- contents -->
|
||||
|
||||
Reference in new issue
Block a user