Closes #33
This commit is contained in:
1 parent
f60faea2e7
commit
f03882d3f4
86 files changed
+3539
-2688
No files matched your search
@@ -123,7 +123,7 @@ 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_md163"></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 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>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 11 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, invalid 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>
|
||||
@@ -160,10 +160,15 @@ 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_md170"></a>
|
||||
Unsupported signal value types</h1>
|
||||
<p><code>unsupportedSignalValueTypes</code> verifies that both parser APIs reject <code>SIG_VALTYPE_</code> declarations with <code>UnsupportedSignalType</code>, the original file path and physical line, and an empty database. Cases include float32/float64, declarations before signal definitions, extended IDs, tabs/CRLF, no final newline, type 0, unknown types, and malformed declarations. Prior warnings are retained; <code>SIG_VALTYPE_</code> symbols inside <code>NS_</code> lists remain quiet.</p>
|
||||
<p>The pipeline suite checks the IEEE 754 bytes for float32 and float64 <code>1.0</code>. Adding a type declaration must prevent publication of an integer definition, so building from the error result cannot produce a valid decoded signal. The same payloads still decode to exact integers when defined only by supported <code>SG_</code> statements. New cases are included in the existing qmake targets.</p>
|
||||
<p>Verified with Qt 6.8.2 in separate Release and ASan/UBSan builds with <code>CONFIG+=dbc_qt</code>: each passed 2,420 core QtTest checks, seven model checks, and the qmake tree test. One named-locale case skipped because its locale is unavailable. ASan/UBSan used fatal errors and <code>detect_leaks=0</code> because of the previously documented ptrace restriction. The separately built demo was checked with float32 and float64 declarations (exit 2, source-located error, no decode output), a supported integer definition (exit 0), and an unknown extension (exit 0 with a visible warning).</p>
|
||||
<h1><a class="anchor" id="autotoc_md171"></a>
|
||||
Long signal definitions</h1>
|
||||
<p><code>longSignalDefinitions</code> reproduces the former stack overflow with a 50,000-character unit string. Both parser APIs are exercised with long units, signal names, receivers, decimal numbers, and a list of 10,001 receivers. Valid input must parse without truncating units; malformed input (including missing quotes, delimiters, receiver separators, numeric suffixes, overflow, and trailing receiver commas) must return an empty database and an <code>InvalidStatement</code> diagnostic at the signal's source line, or throw a source-located error through <code>ParseFile()</code>. These cases run as part of the existing parser target and sanitizer builds.</p>
|
||||
<p>Verified with Qt 6.8.2 in separate Release and ASan/UBSan builds, both with <code>CONFIG+=dbc_qt</code>: <code>make check</code> passed 2,409 core QtTest checks, seven model checks, and the qmake tree test in each build. The named comma-decimal C locale test skipped because the required locale is not installed. The sanitizer run used <code>ASAN_OPTIONS=detect_leaks=0:halt_on_error=1</code> and <code>UBSAN_OPTIONS=halt_on_error=1</code>; address and undefined-behavior checks passed, while leak checking was disabled because of the environment's previously documented ptrace restriction.</p>
|
||||
<h1><a class="anchor" id="autotoc_md171"></a>
|
||||
<h1><a class="anchor" id="autotoc_md172"></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>
|
||||
|
||||
Reference in new issue
Block a user