|
DBC Framework
DBC parsing and CAN signal decoding framework
|
Run from the repository root with a C++17 compiler:
Alternatively, build the standalone qmake project out of source:
The executable returns a nonzero exit code if any case fails. Checks remain active in release builds and do not depend on assert or an external test framework.
Coverage includes Motorola bit numbering within and across bytes, unaligned signals, signed values, scaling, 64-bit extraction, signed/unsigned boundary values (including INT64_MIN, INT64_MAX, and UINT64_MAX), numeric output, invalid lengths, insufficient payloads, and Intel regression cases. Frame validity means the definition was found; insufficient payloads are checked through signal validity.
Run from the repository root:
For qmake, use tests/dbc_parser_test.pro in a separate build directory, following the decoder instructions above, then run ./dbc_parser_test.
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.
Dispatch tests also verify exact keyword matching, handler construction and reuse, unknown statements, and independent parsing sessions, including recovery after errors.