Closes #16
This commit is contained in:
1 parent
7022c84941
commit
c3d3bd51fb
72 files changed
+3703
-2484
No files matched your search
+27
-8
@@ -24,7 +24,7 @@ make -j
|
||||
make check
|
||||
```
|
||||
|
||||
Or run `./tests/dbc_tests` directly. Parser, decoder, lifetime, and additional coverage
|
||||
Or run `./tests/dbc_tests` 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.
|
||||
@@ -41,7 +41,8 @@ make check
|
||||
```
|
||||
|
||||
`parser_tests.pri` and `decoder_tests.pri` include the original test sources;
|
||||
`tests.pro` also includes `dbc_coverage_test.cpp` and `dbc_lifetime_test.cpp`.
|
||||
`tests.pro` also includes `dbc_coverage_test.cpp`, `dbc_lifetime_test.cpp`, and
|
||||
`dbc_validation_test.cpp`.
|
||||
`../core/core.pri` supplies the library include path and linkage.
|
||||
|
||||
## Decoder coverage
|
||||
@@ -52,10 +53,11 @@ signals, signed values, scaling, 64-bit extraction, signed/unsigned boundary val
|
||||
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.
|
||||
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.
|
||||
|
||||
## Parser coverage
|
||||
|
||||
@@ -116,8 +118,9 @@ of invalid markers, selector references/ranges, overlaps, and SG_MUL_VAL_.
|
||||
|
||||
`dbc_coverage_test.cpp` runs as part of `dbc_tests`. 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
|
||||
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 TypeFactory registration/creation.
|
||||
Direct resolver tests construct ambiguous databases through the public metadata
|
||||
API, verify source locations, and check that ambiguous targets receive no values.
|
||||
@@ -141,3 +144,19 @@ duplicate runtime keys, including manually supplied parsed metadata. Failed relo
|
||||
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.
|
||||
|
||||
## Database validation coverage
|
||||
|
||||
`dbc_validation_test.cpp` checks direct construction and manually assembled
|
||||
`DbcDatabase` input to `DbcDecodeBuilder`: 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.
|
||||
Reference in new issue
Block a user