140 lines
11 KiB
HTML
140 lines
11 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||
<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: 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>
|
||
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
||
<script type="text/javascript" src="resize.js"></script>
|
||
<script type="text/javascript" src="navtreedata.js"></script>
|
||
<script type="text/javascript" src="navtree.js"></script>
|
||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||
<script type="text/javascript" src="search/search.js"></script>
|
||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||
</head>
|
||
<body>
|
||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||
<div id="titlearea">
|
||
<table cellspacing="0" cellpadding="0">
|
||
<tbody>
|
||
<tr id="projectrow">
|
||
<td id="projectalign">
|
||
<div id="projectname">DBC Framework
|
||
</div>
|
||
<div id="projectbrief">DBC parsing and CAN signal decoding framework</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<!-- end header part -->
|
||
<!-- Generated by Doxygen 1.9.8 -->
|
||
<script type="text/javascript">
|
||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||
/* @license-end */
|
||
</script>
|
||
<script type="text/javascript" src="menudata.js"></script>
|
||
<script type="text/javascript" src="menu.js"></script>
|
||
<script type="text/javascript">
|
||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||
$(function() {
|
||
initMenu('',true,false,'search.php','Search');
|
||
$(document).ready(function() { init_search(); });
|
||
});
|
||
/* @license-end */
|
||
</script>
|
||
<div id="main-nav"></div>
|
||
</div><!-- top -->
|
||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||
<div id="nav-tree">
|
||
<div id="nav-tree-contents">
|
||
<div id="nav-sync" class="sync"></div>
|
||
</div>
|
||
</div>
|
||
<div id="splitbar" style="-moz-user-select:none;"
|
||
class="ui-resizable-handle">
|
||
</div>
|
||
</div>
|
||
<script type="text/javascript">
|
||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||
$(document).ready(function(){initNavTree('md_tests_2README.html',''); initResizable(); });
|
||
/* @license-end */
|
||
</script>
|
||
<div id="doc-content">
|
||
<!-- window showing the filter options -->
|
||
<div id="MSearchSelectWindow"
|
||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||
</div>
|
||
|
||
<!-- iframe showing the search results (closed by default) -->
|
||
<div id="MSearchResultsWindow">
|
||
<div id="MSearchResults">
|
||
<div class="SRPage">
|
||
<div id="SRIndex">
|
||
<div id="SRResults"></div>
|
||
<div class="SRStatus" id="Loading">Loading...</div>
|
||
<div class="SRStatus" id="Searching">Searching...</div>
|
||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div><div class="header">
|
||
<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_md128"></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>
|
||
<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. Parser, decoder, 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>
|
||
<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">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>../core/core.pri</code> supplies the library include path and linkage.</p>
|
||
<h1><a class="anchor" id="autotoc_md129"></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; insufficient payloads are checked through signal validity.</p>
|
||
<h1><a class="anchor" id="autotoc_md130"></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. 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>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_md131"></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>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_md132"></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>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>
|
||
</div></div><!-- contents -->
|
||
</div><!-- PageDoc -->
|
||
</div><!-- doc-content -->
|
||
<!-- start footer part -->
|
||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||
<ul>
|
||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
|
||
</ul>
|
||
</div>
|
||
</body>
|
||
</html>
|